Fix client identification in tracy-capture-daemon

Use '<pid>_<ip>_<port>' string as client ID instead of IP+port hash.
This allows:
- Same program restarting (new PID) to be recognized as new client
- Multiple instances of same program (different PIDs) to capture separately
This commit is contained in:
Bartosz Taudul
2026-03-02 22:59:32 +01:00
parent add9a77396
commit 80c849a2aa

View File

@@ -50,7 +50,7 @@ struct ClientStats
struct ClientSession
{
uint64_t id;
std::string id;
std::string programName;
std::string address;
uint16_t port;
@@ -62,7 +62,7 @@ struct ClientSession
std::atomic<uint64_t> fileSize{0};
};
static std::map<uint64_t, ClientSession*> g_clients;
static std::map<std::string, ClientSession*> g_clients;
static std::unordered_set<std::string> g_outputFiles;
[[noreturn]] void Usage()
@@ -353,7 +353,7 @@ int main( int argc, char** argv )
auto parsed = tracy::ParseBroadcastMessage( msg, len );
if( parsed )
{
uint64_t clientId = tracy::ClientUniqueID( clientAddr, parsed->listenPort );
std::string clientId = std::to_string( parsed->pid ) + "_" + clientAddr.GetText() + "_" + std::to_string( parsed->listenPort );
bool isNew = false;
{