diff options
author | Tor Lillqvist <tml@collabora.com> | 2021-06-17 14:24:58 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2021-06-21 12:43:17 +0300 |
commit | b2f4776781e9c0616393978e178e6de9d6db1762 (patch) | |
tree | 54e84bcd66b0354fbe8069a99b03e9cf8cc8a22e | |
parent | Output a Trace Event metadata event identifying each named thread (diff) | |
download | online-b2f4776781e9c0616393978e178e6de9d6db1762.tar.gz online-b2f4776781e9c0616393978e178e6de9d6db1762.zip |
No need to add the thread name to the args of Trace Events now
We automatically emit metadata events that identify threads.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Icb25b5cfc29b28ba7112ca72de56dbb697c8dd5a
-rw-r--r-- | common/TraceEvent.cpp | 18 | ||||
-rw-r--r-- | common/TraceEvent.hpp | 15 | ||||
-rw-r--r-- | wsd/ClientSession.cpp | 8 |
3 files changed, 2 insertions, 39 deletions
diff --git a/common/TraceEvent.cpp b/common/TraceEvent.cpp index 1aba7720a1..dbc26558bf 100644 --- a/common/TraceEvent.cpp +++ b/common/TraceEvent.cpp @@ -25,12 +25,6 @@ void TraceEvent::emitInstantEvent(const std::string& name, const std::string& ar if (!recordingOn) return; - std::string args; - if (argsOrEmpty.length() == 0) - args = createDefaultArgsString(); - else - args = argsOrEmpty; - emitOneRecording("{" "\"name\":\"" + name @@ -46,8 +40,7 @@ void TraceEvent::emitInstantEvent(const std::string& name, const std::string& ar + "," "\"tid\":" + std::to_string(getThreadId()) - + ",\"args\":" - + args + + (argsOrEmpty.length() == 0 ? "" : ",\"args\":" + argsOrEmpty) + "}" // We add a trailing comma and newline, it is up to the code that handles these "recordings" // (outputs them into a JSON array) to remove the final comma before adding the terminating @@ -72,12 +65,6 @@ void ProfileZone::emitRecording() // Generate a single "Complete Event" (type X) auto duration = now - _createTime; - std::string args; - if (_args.length() == 0) - args = createDefaultArgsString(); - else - args = _args; - std::string recordingData( "{" "\"name\":\"" @@ -97,8 +84,7 @@ void ProfileZone::emitRecording() + "," "\"tid\":" + std::to_string(getThreadId()) - + ",\"args\":" - + args + + (_args.length() == 0 ? "" : ",\"args\":" + _args) + "}" // We emit a trailing comma and newline, it is up to the code that handles these "recordings" // (outputs them into a JSON array) to remove the final comma before emiting the terminating diff --git a/common/TraceEvent.hpp b/common/TraceEvent.hpp index 8780bb24e7..2b68e39523 100644 --- a/common/TraceEvent.hpp +++ b/common/TraceEvent.hpp @@ -54,20 +54,6 @@ protected: #endif } - static std::string getThreadName() - { -#ifdef TEST_TRACEEVENT_EXE - return "thread-" + std::to_string(getThreadId()); -#else - return Util::getThreadName(); -#endif - } - - static std::string createDefaultArgsString() - { - return "{\"thread\":\"" + std::string(getThreadName()) + "\"}"; - } - static std::string createArgsString(const std::map<std::string, std::string>& args) { if (!recordingOn) @@ -86,7 +72,6 @@ protected: result += '"'; first = false; } - result += ",\"thread\":\"" + std::string(getThreadName()) + "\""; result += '}'; return result; diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index 585c154847..dd9abac764 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -359,14 +359,6 @@ bool ClientSession::_handleInput(const char *buffer, int length) if (tokens.size() >= 5 && getTokenString(tokens, "args", args)) args = ",\"args\":" + args; - if (args.length() > 0 && args.back() == '}') - { - args.pop_back(); - args = args + ",\"thread\":\"" + Util::getThreadName() + "\"}"; - } else if (args.length() == 0) { - args = ",\"args\":{\"thread\":\"" + std::string(Util::getThreadName()) + "\"}"; - } - uint64_t id; uint64_t dur; if (ph == "i") |