From bcbf8edd8a50a31ee1927b9675ffc2f249b61f06 Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Tue, 12 May 2020 20:36:11 +0200 Subject: [PATCH] import-chrome: import zone metadata from "args" key --- NEWS | 1 + import-chrome/src/import-chrome.cpp | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index aaa4eb5b..b72d08d7 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ a mistake. v0.7 (xxxx-xx-xx) ----------------- +- chrome:tracing importer now imports zone metadata from "args" key. - Added display of statistical mode to find zone menu. - Automatic stack sampling is now available on windows. - Properly handle tracing on long-running systems. diff --git a/import-chrome/src/import-chrome.cpp b/import-chrome/src/import-chrome.cpp index 35a18f71..241e9198 100644 --- a/import-chrome/src/import-chrome.cpp +++ b/import-chrome/src/import-chrome.cpp @@ -70,13 +70,23 @@ int main( int argc, char** argv ) for( auto& v : j ) { const auto type = v["ph"].get(); + + std::string zoneText = ""; + if ( v.contains( "args" ) ) + { + for ( auto& kv : v["args"].items() ) + { + zoneText += kv.key() + ": " + kv.value().dump() + "\n"; + } + } + if( type == "B" ) { timeline.emplace_back( tracy::Worker::ImportEventTimeline { v["tid"].get(), uint64_t( v["ts"].get() * 1000. ), v["name"].get(), - "", + std::move(zoneText), false } ); } @@ -86,7 +96,7 @@ int main( int argc, char** argv ) v["tid"].get(), uint64_t( v["ts"].get() * 1000. ), "", - "", + std::move(zoneText), true } ); } @@ -96,7 +106,7 @@ 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, ts0, name, std::move(zoneText), false } ); timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts1, "", "", true } ); } else if( type == "i" || type == "I" )