diff options
Diffstat (limited to 'base/trace_event.h')
-rw-r--r-- | base/trace_event.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/base/trace_event.h b/base/trace_event.h index b01a71e..932c784 100644 --- a/base/trace_event.h +++ b/base/trace_event.h @@ -24,8 +24,10 @@ #include <string> #include "base/lock.h" +#include "base/scoped_ptr.h" #include "base/singleton.h" #include "base/time.h" +#include "base/timer.h" // Use the following macros rather than using the TraceLog class directly as the // underlying implementation may change in the future. Here's a sample usage: @@ -40,7 +42,7 @@ #define TRACE_EVENT_BEGIN(name, id, extra) \ Singleton<base::TraceLog>::get()->Trace(name, \ base::TraceLog::EVENT_BEGIN, \ - reinterpret_cast<void*>(id), \ + reinterpret_cast<const void*>(id), \ extra, \ __FILE__, \ __LINE__) @@ -50,7 +52,7 @@ #define TRACE_EVENT_END(name, id, extra) \ Singleton<base::TraceLog>::get()->Trace(name, \ base::TraceLog::EVENT_END, \ - reinterpret_cast<void*>(id), \ + reinterpret_cast<const void*>(id), \ extra, \ __FILE__, \ __LINE__) @@ -59,7 +61,7 @@ #define TRACE_EVENT_INSTANT(name, id, extra) \ Singleton<base::TraceLog>::get()->Trace(name, \ base::TraceLog::EVENT_INSTANT, \ - reinterpret_cast<void*>(id), \ + reinterpret_cast<const void*>(id), \ extra, \ __FILE__, \ __LINE__) @@ -77,6 +79,10 @@ typedef HANDLE FileHandle; typedef FILE* FileHandle; #endif +namespace process_util { +class ProcessMetrics; +} + namespace base { class TraceLog { @@ -97,13 +103,13 @@ class TraceLog { // Log a trace event of (name, type, id) with the optional extra string. void Trace(const std::string& name, EventType type, - void* id, + const void* id, const std::wstring& extra, const char* file, int line); void Trace(const std::string& name, EventType type, - void* id, + const void* id, const std::string& extra, const char* file, int line); @@ -119,12 +125,15 @@ class TraceLog { void CloseLogFile(); bool Start(); void Stop(); + void Heartbeat(); void Log(const std::string& msg); bool enabled_; FileHandle log_file_; Lock file_lock_; TimeTicks trace_start_time_; + scoped_ptr<process_util::ProcessMetrics> process_metrics_; + RepeatingTimer<TraceLog> timer_; }; } // namespace base |