mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Merge pull request #168 from jkriegshauser/improve-import
Improve chrome import
This commit is contained in:
+17
-4
@@ -275,10 +275,11 @@ Worker::Worker( const char* addr, uint16_t port )
|
||||
m_threadNet = std::thread( [this] { SetThreadName( "Tracy Network" ); Network(); } );
|
||||
}
|
||||
|
||||
Worker::Worker( const std::string& program, const std::vector<ImportEventTimeline>& timeline, const std::vector<ImportEventMessages>& messages, const std::vector<ImportEventPlots>& plots )
|
||||
Worker::Worker( const char* name, const char* program, const std::vector<ImportEventTimeline>& timeline, const std::vector<ImportEventMessages>& messages, const std::vector<ImportEventPlots>& plots, const std::unordered_map<uint64_t, std::string>& threadNames )
|
||||
: m_hasData( true )
|
||||
, m_delay( 0 )
|
||||
, m_resolution( 0 )
|
||||
, m_captureName( name )
|
||||
, m_captureProgram( program )
|
||||
, m_captureTime( 0 )
|
||||
, m_pid( 0 )
|
||||
@@ -428,9 +429,19 @@ Worker::Worker( const std::string& program, const std::vector<ImportEventTimelin
|
||||
|
||||
for( auto& t : m_threadMap )
|
||||
{
|
||||
char buf[64];
|
||||
sprintf( buf, "%" PRIu64, t.first );
|
||||
AddThreadString( t.first, buf, strlen( buf ) );
|
||||
auto name = threadNames.find(t.first);
|
||||
if (name != threadNames.end())
|
||||
{
|
||||
char buf[128];
|
||||
int len = snprintf(buf, sizeof(buf), "(%" PRIu64 ") %s", t.first, name->second.c_str());
|
||||
AddThreadString(t.first, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[64];
|
||||
sprintf( buf, "%" PRIu64, t.first );
|
||||
AddThreadString( t.first, buf, strlen( buf ) );
|
||||
}
|
||||
}
|
||||
|
||||
m_data.framesBase = m_data.frames.Retrieve( 0, [this] ( uint64_t name ) {
|
||||
@@ -512,6 +523,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
char tmp[1024];
|
||||
f.Read( tmp, sz );
|
||||
m_captureName = std::string( tmp, tmp+sz );
|
||||
if (m_captureName.empty())
|
||||
m_captureName = f.GetFilename();
|
||||
}
|
||||
{
|
||||
f.Read( sz );
|
||||
|
||||
Reference in New Issue
Block a user