2
0
mirror of https://github.com/wolfpld/tracy synced 2026-02-21 15:42:13 +00:00

Make chrome:tracing importer support both array and object forms of input.

This commit is contained in:
Dmitry Ivanov
2019-12-16 21:41:57 +01:00
committed by Bartosz Taudul
parent 14e096d052
commit a4d12c26c7

View File

@@ -56,6 +56,17 @@ int main( int argc, char** argv )
std::vector<tracy::Worker::ImportEventTimeline> timeline;
std::vector<tracy::Worker::ImportEventMessages> messages;
if( j.is_object() && j.contains( "traceEvents" ) )
{
j = j["traceEvents"];
}
if( !j.is_array() )
{
fprintf( stderr, "Input must be either an array of events or an object containing an array of events under \"traceEvents\" key.\n" );
exit( 1 );
}
for( auto& v : j )
{
const auto type = v["ph"].get<std::string>();