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

Side by Side Diff: base/trace_event.cc

Issue 4092: Change to Hi Res timers on Windows.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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/time_win.cc ('k') | no next file » | 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) 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 #include "base/trace_event.h" 5 #include "base/trace_event.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/platform_thread.h" 9 #include "base/platform_thread.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void TraceLog::Trace(const std::string& name, 129 void TraceLog::Trace(const std::string& name,
130 EventType type, 130 EventType type,
131 const void* id, 131 const void* id,
132 const std::string& extra, 132 const std::string& extra,
133 const char* file, 133 const char* file,
134 int line) { 134 int line) {
135 if (!enabled_) 135 if (!enabled_)
136 return; 136 return;
137 137
138 #ifdef USE_UNRELIABLE_NOW 138 #ifdef USE_UNRELIABLE_NOW
139 TimeTicks tick = TimeTicks::UnreliableHighResNow(); 139 TimeTicks tick = TimeTicks::HighResNow();
140 #else 140 #else
141 TimeTicks tick = TimeTicks::Now(); 141 TimeTicks tick = TimeTicks::Now();
142 #endif 142 #endif
143 TimeDelta delta = tick - trace_start_time_; 143 TimeDelta delta = tick - trace_start_time_;
144 int64 usec = delta.InMicroseconds(); 144 int64 usec = delta.InMicroseconds();
145 std::string msg = 145 std::string msg =
146 StringPrintf("{'pid':'0x%lx', 'tid':'0x%lx', 'type':'%s', " 146 StringPrintf("{'pid':'0x%lx', 'tid':'0x%lx', 'type':'%s', "
147 "'name':'%s', 'id':'0x%lx', 'extra':'%s', 'file':'%s', " 147 "'name':'%s', 'id':'0x%lx', 'extra':'%s', 'file':'%s', "
148 "'line_number':'%d', 'usec_begin': %I64d},\r\n", 148 "'line_number':'%d', 'usec_begin': %I64d},\r\n",
149 process_util::GetCurrentProcId(), 149 process_util::GetCurrentProcId(),
(...skipping 16 matching lines...) Expand all
166 SetFilePointer(log_file_, 0, 0, SEEK_END); 166 SetFilePointer(log_file_, 0, 0, SEEK_END);
167 DWORD num; 167 DWORD num;
168 WriteFile(log_file_, (void*)msg.c_str(), (DWORD)msg.length(), &num, NULL); 168 WriteFile(log_file_, (void*)msg.c_str(), (DWORD)msg.length(), &num, NULL);
169 #elif defined (OS_POSIX) 169 #elif defined (OS_POSIX)
170 fprintf(log_file_, "%s", msg.c_str()); 170 fprintf(log_file_, "%s", msg.c_str());
171 #endif 171 #endif
172 } 172 }
173 173
174 } // namespace base 174 } // namespace base
175 175
OLDNEW
« no previous file with comments | « base/time_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698