OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Trace events to track application performance. Events consist of a name | 5 // Trace events to track application performance. Events consist of a name |
6 // a type (BEGIN, END or INSTANT), a tracking id and extra string data. | 6 // a type (BEGIN, END or INSTANT), a tracking id and extra string data. |
7 // In addition, the current process id, thread id, a timestamp down to the | 7 // In addition, the current process id, thread id, a timestamp down to the |
8 // microsecond and a file and line number of the calling location. | 8 // microsecond and a file and line number of the calling location. |
9 // | 9 // |
10 // The current implementation logs these events into a log file of the form | 10 // The current implementation logs these events into a log file of the form |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 __FILE__, \ | 66 __FILE__, \ |
67 __LINE__) | 67 __LINE__) |
68 #else | 68 #else |
69 // TODO(erikkay): temporarily disable the macros on other platforms | 69 // TODO(erikkay): temporarily disable the macros on other platforms |
70 // until I can add the files to the other platform build files. | 70 // until I can add the files to the other platform build files. |
71 #define TRACE_EVENT_BEGIN(name, id, extra) | 71 #define TRACE_EVENT_BEGIN(name, id, extra) |
72 #define TRACE_EVENT_END(name, id, extra) | 72 #define TRACE_EVENT_END(name, id, extra) |
73 #define TRACE_EVENT_INSTANT(name, id, extra) | 73 #define TRACE_EVENT_INSTANT(name, id, extra) |
74 #endif | 74 #endif |
75 | 75 |
76 namespace process_util { | 76 namespace base { |
77 class ProcessMetrics; | 77 class ProcessMetrics; |
78 } | 78 } |
79 | 79 |
80 namespace base { | 80 namespace base { |
81 | 81 |
82 class TraceLog { | 82 class TraceLog { |
83 public: | 83 public: |
84 enum EventType { | 84 enum EventType { |
85 EVENT_BEGIN, | 85 EVENT_BEGIN, |
86 EVENT_END, | 86 EVENT_END, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void CloseLogFile(); | 119 void CloseLogFile(); |
120 bool Start(); | 120 bool Start(); |
121 void Stop(); | 121 void Stop(); |
122 void Heartbeat(); | 122 void Heartbeat(); |
123 void Log(const std::string& msg); | 123 void Log(const std::string& msg); |
124 | 124 |
125 bool enabled_; | 125 bool enabled_; |
126 FILE* log_file_; | 126 FILE* log_file_; |
127 Lock file_lock_; | 127 Lock file_lock_; |
128 TimeTicks trace_start_time_; | 128 TimeTicks trace_start_time_; |
129 scoped_ptr<process_util::ProcessMetrics> process_metrics_; | 129 scoped_ptr<base::ProcessMetrics> process_metrics_; |
130 RepeatingTimer<TraceLog> timer_; | 130 RepeatingTimer<TraceLog> timer_; |
131 }; | 131 }; |
132 | 132 |
133 } // namespace base | 133 } // namespace base |
134 | 134 |
135 #endif // BASE_TRACE_EVENT_H_ | 135 #endif // BASE_TRACE_EVENT_H_ |
OLD | NEW |