From 8e11cd5ebb38b488ea19bde071c6c7bf4bc6c792 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 12 May 2020 11:44:36 +0200 Subject: [PATCH] Add support for custom text in ImportEventTimeline. --- import-chrome/src/import-chrome.cpp | 6 ++++-- server/TracyWorker.cpp | 6 ++++++ server/TracyWorker.hpp | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/import-chrome/src/import-chrome.cpp b/import-chrome/src/import-chrome.cpp index 10bf55ed..35a18f71 100644 --- a/import-chrome/src/import-chrome.cpp +++ b/import-chrome/src/import-chrome.cpp @@ -76,6 +76,7 @@ int main( int argc, char** argv ) v["tid"].get(), uint64_t( v["ts"].get() * 1000. ), v["name"].get(), + "", false } ); } @@ -85,6 +86,7 @@ int main( int argc, char** argv ) v["tid"].get(), uint64_t( v["ts"].get() * 1000. ), "", + "", true } ); } @@ -94,8 +96,8 @@ int main( int argc, char** argv ) const auto ts0 = uint64_t( v["ts"].get() * 1000. ); const auto ts1 = v["dur"].is_object() ? ts0 + uint64_t( v["dur"].get() * 1000. ) : ts0; const auto name = v["name"].get(); - timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts0, name, false } ); - timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts1, "", true } ); + timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts0, name, "", false } ); + timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts1, "", "", true } ); } else if( type == "i" || type == "I" ) { diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index dc4cc742..0e06a13c 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -328,6 +328,12 @@ Worker::Worker( const std::string& program, const std::vectorSetEnd( -1 ); zone->SetChild( -1 ); + if( !v.text.empty() ) + { + auto& extra = RequestZoneExtra( *zone ); + extra.text = StringIdx( StoreString( v.text.c_str(), v.text.size() ).idx ); + } + m_threadCtxData = NoticeThread( v.tid ); NewZone( zone, v.tid ); } diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index f5b258f5..0dce667d 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -95,6 +95,7 @@ public: uint64_t tid; uint64_t timestamp; std::string name; + std::string text; bool isEnd; };