Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoshuakr <joshuakr@nvidia.com>2021-01-22 04:07:31 +0300
committerjoshuakr <joshuakr@nvidia.com>2021-01-22 04:26:00 +0300
commit2920f97911c1499dadcc751b1022f61c4df40867 (patch)
treee8505cfa1f603bb12af026c8cb4792b8ae24d75b /import-chrome
parent25a95d99c0cef635817822cd6ae0e251bcbf5d60 (diff)
Imported Chrome traces bring over thread names
Diffstat (limited to 'import-chrome')
-rw-r--r--import-chrome/src/import-chrome.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/import-chrome/src/import-chrome.cpp b/import-chrome/src/import-chrome.cpp
index a5186e4d..a03888d9 100644
--- a/import-chrome/src/import-chrome.cpp
+++ b/import-chrome/src/import-chrome.cpp
@@ -6,6 +6,7 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unordered_map>
#include "json.hpp"
@@ -56,6 +57,7 @@ int main( int argc, char** argv )
std::vector<tracy::Worker::ImportEventTimeline> timeline;
std::vector<tracy::Worker::ImportEventMessages> messages;
std::vector<tracy::Worker::ImportEventPlots> plots;
+ std::unordered_map<uint64_t, std::string> threadNames;
if( j.is_object() && j.contains( "traceEvents" ) )
{
@@ -156,6 +158,13 @@ int main( int argc, char** argv )
}
}
}
+ else if (type == "M")
+ {
+ if (v.contains("name") && v["name"] == "thread_name" && v.contains("args") && v["args"].is_object() && v["args"].contains("name"))
+ {
+ threadNames[v["tid"].get<uint64_t>()] = v["args"]["name"].get<std::string>();
+ }
+ }
}
std::stable_sort( timeline.begin(), timeline.end(), [] ( const auto& l, const auto& r ) { return l.timestamp < r.timestamp; } );
@@ -189,7 +198,7 @@ int main( int argc, char** argv )
while( *program ) program++;
program--;
while( program > input && ( *program != '/' || *program != '\\' ) ) program--;
- tracy::Worker worker( program, timeline, messages, plots );
+ tracy::Worker worker( program, timeline, messages, plots, threadNames );
auto w = std::unique_ptr<tracy::FileWrite>( tracy::FileWrite::Open( output, clev ) );
if( !w )