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:
authorSimon Cruanes <simon.cruanes.2007@m4x.org>2021-05-10 18:49:07 +0300
committerSimon Cruanes <simon.cruanes.2007@m4x.org>2021-05-10 18:49:07 +0300
commitb512ce3fa822cf88d16313c694c7873a995290c3 (patch)
treeb3bab29dad2bebb481090e18ee8741e7db4f803e /import-chrome
parentd38f579ec392ac386b0eb1eab0aca797bcc0ab9a (diff)
do not mangle tid if there is no pid
Diffstat (limited to 'import-chrome')
-rw-r--r--import-chrome/src/import-chrome.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/import-chrome/src/import-chrome.cpp b/import-chrome/src/import-chrome.cpp
index 29d7406e..126e3797 100644
--- a/import-chrome/src/import-chrome.cpp
+++ b/import-chrome/src/import-chrome.cpp
@@ -148,22 +148,27 @@ int main( int argc, char** argv )
std::unordered_map<uint64_t, std::string> threadNames;
const auto getPseudoTid = [&](json& val) -> uint64_t {
- uint64_t pid = 0;
- if ( val.contains( "pid" ) ) {
- pid = val["pid"].get<uint64_t>();
- }
-
const auto real_tid = val["tid"].get<uint64_t>();
- for ( auto &pair : tid_encoders) {
- if ( pair.pid == pid && pair.tid == real_tid ) {
+ if ( val.contains( "pid" ) ) {
+ // there might be multiple processes so we allocate a pseudo-tid
+ // for each pair (pid, real_tid)
+ const auto pid = val["pid"].get<uint64_t>();
+
+ for ( auto &pair : tid_encoders) {
+ if ( pair.pid == pid && pair.tid == real_tid ) {
return pair.pseudo_tid;
+ }
}
- }
- const auto pseudo_tid = tid_encoders.size();
- tid_encoders.emplace_back(PidTidEncoder {real_tid, pid, pseudo_tid});
- return pseudo_tid;
+ const auto pseudo_tid = tid_encoders.size();
+ tid_encoders.emplace_back(PidTidEncoder {real_tid, pid, pseudo_tid});
+ return pseudo_tid;
+ }
+ else
+ {
+ return real_tid;
+ }
};
if( j.is_object() && j.contains( "traceEvents" ) )