From db734e3e0a1577a3e93685bc140101c4770fe3c3 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 11 May 2021 01:27:48 +0200 Subject: [PATCH] Parse custom location tags. --- import-chrome/src/import-chrome.cpp | 23 +++++++++++++++++++++-- server/TracyWorker.hpp | 2 ++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/import-chrome/src/import-chrome.cpp b/import-chrome/src/import-chrome.cpp index 126e3797..dc6a4f08 100644 --- a/import-chrome/src/import-chrome.cpp +++ b/import-chrome/src/import-chrome.cpp @@ -199,6 +199,23 @@ int main( int argc, char** argv ) } } + std::string locFile; + uint32_t locLine = 0; + if( v.contains( "loc" ) ) + { + auto loc = v["loc"].get(); + const auto lpos = loc.find_last_of( ':' ); + if( lpos == std::string::npos ) + { + std::swap( loc, locFile ); + } + else + { + locFile = loc.substr( 0, lpos ); + locLine = atoi( loc.c_str() + lpos + 1 ); + } + } + if( type == "B" ) { timeline.emplace_back( tracy::Worker::ImportEventTimeline { @@ -206,7 +223,9 @@ int main( int argc, char** argv ) uint64_t( v["ts"].get() * 1000. ), v["name"].get(), std::move(zoneText), - false + false, + std::move(locFile), + locLine } ); } else if( type == "E" ) @@ -225,7 +244,7 @@ int main( int argc, char** argv ) const auto ts0 = uint64_t( v["ts"].get() * 1000. ); const auto ts1 = ts0 + uint64_t( v["dur"].get() * 1000. ); const auto name = v["name"].get(); - timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts0, name, std::move(zoneText), false } ); + timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts0, name, std::move(zoneText), false, std::move(locFile), locLine } ); timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts1, "", "", true } ); } else if( type == "i" || type == "I" ) diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 5d6366d0..5e8f21f0 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -99,6 +99,8 @@ public: std::string name; std::string text; bool isEnd; + std::string locFile; + uint32_t locLine; }; struct ImportEventMessages