mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Make chrome:tracing importer support both array and object forms of input.
This commit is contained in:
parent
14e096d052
commit
a4d12c26c7
@ -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>();
|
||||
|
Loading…
Reference in New Issue
Block a user