Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3086)

Unified Diff: base/debug/trace_event.h

Issue 7495031: trace_event support for thread names (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove process names. With thread names, they are redundant. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/debug/trace_event.cc » ('j') | base/debug/trace_event.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event.h
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h
index d1c74180d16b41e93ca8fa4ff2cf20b5e825ff7d..4689eda89a5989e82ec289905da3731056613339 100644
--- a/base/debug/trace_event.h
+++ b/base/debug/trace_event.h
@@ -90,6 +90,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/hash_tables.h"
#include "base/memory/singleton.h"
#include "base/string_util.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
@@ -296,7 +297,8 @@ const size_t kTraceMaxNumArgs = 2;
enum TraceEventPhase {
TRACE_EVENT_PHASE_BEGIN,
TRACE_EVENT_PHASE_END,
- TRACE_EVENT_PHASE_INSTANT
+ TRACE_EVENT_PHASE_INSTANT,
+ TRACE_EVENT_PHASE_METADATA
};
// Simple union of values. This is much lighter weight than base::Value, which
@@ -500,6 +502,9 @@ class BASE_API TraceLog {
AddTraceEventEtw(phase, name, id, extra.c_str());
}
+ // Metadata
+ void SetCurrentThreadName(const char* name);
+
// Exposed for unittesting only, allows resurrecting our
// singleton instance post-AtExit processing.
static void Resurrect();
@@ -512,6 +517,7 @@ class BASE_API TraceLog {
TraceLog();
~TraceLog();
const TraceCategory* GetCategoryInternal(const char* name);
+ void AddCurrentMetadataEvents();
// TODO(nduca): switch to per-thread trace buffers to reduce thread
// synchronization.
@@ -521,6 +527,8 @@ class BASE_API TraceLog {
BufferFullCallback buffer_full_callback_;
std::vector<TraceEvent> logged_events_;
+ base::hash_map<PlatformThreadId, std::string> thread_names_;
Sigurður Ásgeirsson 2011/08/02 19:36:41 It looks like this map will grow without bounds as
+
DISALLOW_COPY_AND_ASSIGN(TraceLog);
};
« no previous file with comments | « no previous file | base/debug/trace_event.cc » ('j') | base/debug/trace_event.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698