mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-14 21:05:40 +00:00
Recalculate AddrStatData in AttachRangeToLlm.
For consistency, always provide the OS-level sampling data, not the hardware samples. Always disable inline propagation, which is intended as a local area help for a human. It does not make sense in context of an llm.
This commit is contained in:
@@ -1984,7 +1984,7 @@ std::tuple<size_t, size_t> SourceView::GetJumpRange( const AsmJumpData& jump )
|
||||
return std::make_tuple( minIdx, maxIdx );
|
||||
}
|
||||
|
||||
void SourceView::AttachRangeToLlm( size_t start, size_t stop, Worker& worker, View& view, const AddrStatData& as )
|
||||
void SourceView::AttachRangeToLlm( size_t start, size_t stop, Worker& worker, View& view )
|
||||
{
|
||||
auto sym = worker.GetSymbolData( m_symAddr );
|
||||
assert( sym );
|
||||
@@ -2008,6 +2008,29 @@ void SourceView::AttachRangeToLlm( size_t start, size_t stop, Worker& worker, Vi
|
||||
symName = worker.GetString( sym->name );
|
||||
}
|
||||
|
||||
const bool limitView = view.m_statRange.active;
|
||||
AddrStatData as;
|
||||
if( m_calcInlineStats )
|
||||
{
|
||||
GatherIpStats( m_symAddr, as, worker, limitView, view, m_source.filename(), false );
|
||||
GatherAdditionalIpStats( m_symAddr, as, worker, limitView, view, m_source.filename(), false );
|
||||
}
|
||||
else
|
||||
{
|
||||
GatherIpStats( m_baseAddr, as, worker, limitView, view, m_source.filename(), false );
|
||||
auto iptr = worker.GetInlineSymbolList( m_baseAddr, m_codeLen );
|
||||
if( iptr )
|
||||
{
|
||||
const auto symEnd = m_baseAddr + m_codeLen;
|
||||
while( *iptr < symEnd )
|
||||
{
|
||||
GatherIpStats( *iptr, as, worker, limitView, view, m_source.filename(), false );
|
||||
iptr++;
|
||||
}
|
||||
}
|
||||
GatherAdditionalIpStats( m_baseAddr, as, worker, limitView, view, m_source.filename(), false );
|
||||
}
|
||||
|
||||
nlohmann::json json = {
|
||||
{ "type", "assembly" },
|
||||
{ "symbol", symName },
|
||||
@@ -2140,7 +2163,7 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
|
||||
ImGui::SameLine();
|
||||
if( ImGui::SmallButton( ICON_FA_ROBOT ) )
|
||||
{
|
||||
AttachRangeToLlm( 0, m_asm.size(), worker, view, as );
|
||||
AttachRangeToLlm( 0, m_asm.size(), worker, view );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2408,7 +2431,7 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
|
||||
if( ImGui::MenuItem( ICON_FA_ROBOT " Attach jump range in chat" ) )
|
||||
{
|
||||
auto [start, stop] = GetJumpRange( it->second );
|
||||
AttachRangeToLlm( start, stop, worker, view, as );
|
||||
AttachRangeToLlm( start, stop, worker, view );
|
||||
}
|
||||
}
|
||||
if( needSeparator ) ImGui::Separator();
|
||||
|
||||
@@ -114,7 +114,7 @@ private:
|
||||
tracy_force_inline float CalcJumpSeparation( float scale );
|
||||
std::tuple<size_t, size_t> GetJumpRange( const AsmJumpData& jump );
|
||||
|
||||
void AttachRangeToLlm( size_t start, size_t stop, Worker& worker, View& view, const AddrStatData& as );
|
||||
void AttachRangeToLlm( size_t start, size_t stop, Worker& worker, View& view );
|
||||
|
||||
#ifndef TRACY_NO_FILESELECTOR
|
||||
void Save( const Worker& worker, size_t start = 0, size_t stop = std::numeric_limits<size_t>::max() );
|
||||
|
||||
Reference in New Issue
Block a user