mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
do not mangle tid if there is no pid
This commit is contained in:
parent
d38f579ec3
commit
b512ce3fa8
@ -148,13 +148,13 @@ 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>();
|
||||
|
||||
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;
|
||||
@ -164,6 +164,11 @@ int main( int argc, char** argv )
|
||||
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" ) )
|
||||
|
Loading…
Reference in New Issue
Block a user