mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 04:23:51 +00:00
Cosmetics.
This commit is contained in:
parent
cb0bc67790
commit
3005d5a939
@ -135,7 +135,8 @@ int main( int argc, char** argv )
|
|||||||
|
|
||||||
// encode a pair of "real pid, real tid" from a trace into a
|
// encode a pair of "real pid, real tid" from a trace into a
|
||||||
// pseudo thread ID living in the single namespace of Tracy threads.
|
// pseudo thread ID living in the single namespace of Tracy threads.
|
||||||
struct PidTidEncoder {
|
struct PidTidEncoder
|
||||||
|
{
|
||||||
uint64_t tid;
|
uint64_t tid;
|
||||||
uint64_t pid;
|
uint64_t pid;
|
||||||
uint64_t pseudo_tid; // fake thread id, unique within Tracy
|
uint64_t pseudo_tid; // fake thread id, unique within Tracy
|
||||||
@ -150,15 +151,15 @@ int main( int argc, char** argv )
|
|||||||
const auto getPseudoTid = [&](json& val) -> uint64_t {
|
const auto getPseudoTid = [&](json& val) -> uint64_t {
|
||||||
const auto real_tid = val["tid"].get<uint64_t>();
|
const auto real_tid = val["tid"].get<uint64_t>();
|
||||||
|
|
||||||
if ( val.contains( "pid" ) ) {
|
if( val.contains( "pid" ) )
|
||||||
|
{
|
||||||
// there might be multiple processes so we allocate a pseudo-tid
|
// there might be multiple processes so we allocate a pseudo-tid
|
||||||
// for each pair (pid, real_tid)
|
// for each pair (pid, real_tid)
|
||||||
const auto pid = val["pid"].get<uint64_t>();
|
const auto pid = val["pid"].get<uint64_t>();
|
||||||
|
|
||||||
for ( auto &pair : tid_encoders) {
|
for ( auto &pair : tid_encoders)
|
||||||
if ( pair.pid == pid && pair.tid == real_tid ) {
|
{
|
||||||
return pair.pseudo_tid;
|
if( pair.pid == pid && pair.tid == real_tid ) return pair.pseudo_tid;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto pseudo_tid = tid_encoders.size();
|
const auto pseudo_tid = tid_encoders.size();
|
||||||
@ -192,9 +193,7 @@ int main( int argc, char** argv )
|
|||||||
for( auto& kv : v["args"].items() )
|
for( auto& kv : v["args"].items() )
|
||||||
{
|
{
|
||||||
const auto val = kv.value();
|
const auto val = kv.value();
|
||||||
const std::string s =
|
const std::string s = val.is_string() ? val.get<std::string>() : val.dump();
|
||||||
val.is_string() ?
|
|
||||||
val.get<std::string>() : val.dump();
|
|
||||||
zoneText += kv.key() + ": " + s + "\n";
|
zoneText += kv.key() + ": " + s + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user