From 6957f968a4f0f691fc6905c06f8f32bb2e2e1cb4 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 22 May 2026 02:06:58 +0200 Subject: [PATCH] Include trace time span in llm system message. --- profiler/src/llm/system.prompt.md | 2 +- profiler/src/profiler/TracyLlm.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/profiler/src/llm/system.prompt.md b/profiler/src/llm/system.prompt.md index a6024b23..dd1d438a 100644 --- a/profiler/src/llm/system.prompt.md +++ b/profiler/src/llm/system.prompt.md @@ -33,7 +33,7 @@ If the user thanks you for your help, ask them to consider making a donation at # User's program -The program being profiled is named %PROGRAMNAME%. It was built at %PROGRAMTIME%. The profiling session was performed at %PROFILETIME%.%PROFILEDESCRIPTION% +The program being profiled is named %PROGRAMNAME%. It was built at %PROGRAMTIME%. The profiling session was performed at %PROFILETIME%, and the length of the session was %PROFILELENGTH%.%PROFILEDESCRIPTION% Here are instructions you must follow when you are asked to work with program the user is profiling. diff --git a/profiler/src/profiler/TracyLlm.cpp b/profiler/src/profiler/TracyLlm.cpp index 908573d2..c262f7af 100644 --- a/profiler/src/profiler/TracyLlm.cpp +++ b/profiler/src/profiler/TracyLlm.cpp @@ -924,6 +924,7 @@ void TracyLlm::UpdateSystemPrompt() static constexpr std::string_view ProgramNameToken = "%PROGRAMNAME%"; static constexpr std::string_view ProgramTimeToken = "%PROGRAMTIME%"; static constexpr std::string_view ProfileTimeToken = "%PROFILETIME%"; + static constexpr std::string_view ProfileLengthToken = "%PROFILELENGTH%"; static constexpr std::string_view ProfileDescriptionToken = "%PROFILEDESCRIPTION%"; static constexpr std::string_view SkillsToken = "%SKILLS%"; @@ -932,6 +933,8 @@ void TracyLlm::UpdateSystemPrompt() const auto exectime = m_worker.GetExecutableTime(); const auto capturetime = m_worker.GetCaptureTime(); + const auto firstTime = m_worker.GetFirstTime(); + const auto lastTime = m_worker.GetLastTime(); char etime[64], ctime[64]; @@ -961,6 +964,7 @@ void TracyLlm::UpdateSystemPrompt() Replace( systemPrompt, ProgramNameToken, m_worker.GetCaptureProgram() ); Replace( systemPrompt, ProgramTimeToken, etime ); Replace( systemPrompt, ProfileTimeToken, ctime ); + Replace( systemPrompt, ProfileLengthToken, TimeToString( lastTime - firstTime ) ); Replace( systemPrompt, ProfileDescriptionToken, descStr ); Replace( systemPrompt, SkillsToken, skills );