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

Side by Side Diff: base/trace_event.cc

Issue 147154: Use C99 standard format macros for 64-bit values. (Closed)
Patch Set: ... Created 11 years, 6 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
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/format_macros.h"
7 #include "base/file_path.h" 8 #include "base/file_path.h"
8 #include "base/file_util.h" 9 #include "base/file_util.h"
9 #include "base/path_service.h" 10 #include "base/path_service.h"
10 #include "base/platform_thread.h" 11 #include "base/platform_thread.h"
11 #include "base/process_util.h" 12 #include "base/process_util.h"
12 #include "base/string_util.h" 13 #include "base/string_util.h"
13 #include "base/time.h" 14 #include "base/time.h"
14 15
15 #define USE_UNRELIABLE_NOW 16 #define USE_UNRELIABLE_NOW
16 17
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #ifdef USE_UNRELIABLE_NOW 126 #ifdef USE_UNRELIABLE_NOW
126 TimeTicks tick = TimeTicks::HighResNow(); 127 TimeTicks tick = TimeTicks::HighResNow();
127 #else 128 #else
128 TimeTicks tick = TimeTicks::Now(); 129 TimeTicks tick = TimeTicks::Now();
129 #endif 130 #endif
130 TimeDelta delta = tick - trace_start_time_; 131 TimeDelta delta = tick - trace_start_time_;
131 int64 usec = delta.InMicroseconds(); 132 int64 usec = delta.InMicroseconds();
132 std::string msg = 133 std::string msg =
133 StringPrintf("{'pid':'0x%lx', 'tid':'0x%lx', 'type':'%s', " 134 StringPrintf("{'pid':'0x%lx', 'tid':'0x%lx', 'type':'%s', "
134 "'name':'%s', 'id':'0x%lx', 'extra':'%s', 'file':'%s', " 135 "'name':'%s', 'id':'0x%lx', 'extra':'%s', 'file':'%s', "
135 "'line_number':'%d', 'usec_begin': %I64d},\n", 136 "'line_number':'%d', 'usec_begin': %" PRId64 "},\n",
136 base::GetCurrentProcId(), 137 base::GetCurrentProcId(),
137 PlatformThread::CurrentId(), 138 PlatformThread::CurrentId(),
138 kEventTypeNames[type], 139 kEventTypeNames[type],
139 name.c_str(), 140 name.c_str(),
140 id, 141 id,
141 extra.c_str(), 142 extra.c_str(),
142 file, 143 file,
143 line, 144 line,
144 usec); 145 usec);
145 146
146 Log(msg); 147 Log(msg);
147 } 148 }
148 149
149 void TraceLog::Log(const std::string& msg) { 150 void TraceLog::Log(const std::string& msg) {
150 AutoLock lock(file_lock_); 151 AutoLock lock(file_lock_);
151 152
152 fprintf(log_file_, "%s", msg.c_str()); 153 fprintf(log_file_, "%s", msg.c_str());
153 } 154 }
154 155
155 } // namespace base 156 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698