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

Side by Side Diff: base/debug/trace_event.h

Issue 3945002: Move debug-related stuff from base to the base/debug directory and use the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/debug/stack_trace_win.cc ('k') | base/debug/trace_event.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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
11 // trace_<pid>.log where it's designed to be post-processed to generate a 11 // trace_<pid>.log where it's designed to be post-processed to generate a
12 // trace report. In the future, it may use another mechansim to facilitate 12 // trace report. In the future, it may use another mechansim to facilitate
13 // real-time analysis. 13 // real-time analysis.
14 14
15 #ifndef BASE_TRACE_EVENT_H_ 15 #ifndef BASE_DEBUG_TRACE_EVENT_H_
16 #define BASE_TRACE_EVENT_H_ 16 #define BASE_DEBUG_TRACE_EVENT_H_
17 #pragma once 17 #pragma once
18 18
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 20
21 #if defined(OS_WIN) 21 #if defined(OS_WIN)
22 // On Windows we always pull in an alternative implementation 22 // On Windows we always pull in an alternative implementation
23 // which logs to Event Tracing for Windows. 23 // which logs to Event Tracing for Windows.
24 // 24 //
25 // Note that the Windows implementation is always enabled, irrespective the 25 // Note that the Windows implementation is always enabled, irrespective the
26 // value of the CHROMIUM_ENABLE_TRACE_EVENT define. The Windows implementation 26 // value of the CHROMIUM_ENABLE_TRACE_EVENT define. The Windows implementation
27 // is controlled by Event Tracing for Windows, which will turn tracing on only 27 // is controlled by Event Tracing for Windows, which will turn tracing on only
28 // if there is someone listening for the events it generates. 28 // if there is someone listening for the events it generates.
29 #include "base/trace_event_win.h" 29 #include "base/debug/trace_event_win.h"
30 #else // defined(OS_WIN) 30 #else // defined(OS_WIN)
31 31
32 #include <string> 32 #include <string>
33 33
34 #include "base/lock.h" 34 #include "base/lock.h"
35 #include "base/scoped_ptr.h" 35 #include "base/scoped_ptr.h"
36 #include "base/singleton.h" 36 #include "base/singleton.h"
37 #include "base/time.h" 37 #include "base/time.h"
38 #include "base/timer.h" 38 #include "base/timer.h"
39 39
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #define TRACE_EVENT_INSTANT(name, id, extra) \ 73 #define TRACE_EVENT_INSTANT(name, id, extra) \
74 Singleton<base::TraceLog>::get()->Trace(name, \ 74 Singleton<base::TraceLog>::get()->Trace(name, \
75 base::TraceLog::EVENT_INSTANT, \ 75 base::TraceLog::EVENT_INSTANT, \
76 reinterpret_cast<const void*>(id), \ 76 reinterpret_cast<const void*>(id), \
77 extra, \ 77 extra, \
78 __FILE__, \ 78 __FILE__, \
79 __LINE__) 79 __LINE__)
80 #endif // CHROMIUM_ENABLE_TRACE_EVENT 80 #endif // CHROMIUM_ENABLE_TRACE_EVENT
81 81
82 namespace base { 82 namespace base {
83
83 class ProcessMetrics; 84 class ProcessMetrics;
84 }
85 85
86 namespace base { 86 namespace debug {
87 87
88 class TraceLog { 88 class TraceLog {
89 public: 89 public:
90 enum EventType { 90 enum EventType {
91 EVENT_BEGIN, 91 EVENT_BEGIN,
92 EVENT_END, 92 EVENT_END,
93 EVENT_INSTANT 93 EVENT_INSTANT
94 }; 94 };
95 95
96 // Is tracing currently enabled. 96 // Is tracing currently enabled.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void Log(const std::string& msg); 129 void Log(const std::string& msg);
130 130
131 bool enabled_; 131 bool enabled_;
132 FILE* log_file_; 132 FILE* log_file_;
133 Lock file_lock_; 133 Lock file_lock_;
134 TimeTicks trace_start_time_; 134 TimeTicks trace_start_time_;
135 scoped_ptr<base::ProcessMetrics> process_metrics_; 135 scoped_ptr<base::ProcessMetrics> process_metrics_;
136 RepeatingTimer<TraceLog> timer_; 136 RepeatingTimer<TraceLog> timer_;
137 }; 137 };
138 138
139 } // namespace base 139 } // namespace debug
140 } // namespace base
141
140 #endif // defined(OS_WIN) 142 #endif // defined(OS_WIN)
141 143
142 #endif // BASE_TRACE_EVENT_H_ 144 #endif // BASE_DEBUG_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « base/debug/stack_trace_win.cc ('k') | base/debug/trace_event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698