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

Side by Side Diff: base/trace_event/trace_event_android.cc

Issue 1546033002: Switch to standard integer types in base/trace_event/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_event_argument.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/trace_event_impl.h" 5 #include "base/trace_event/trace_event_impl.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stddef.h>
9 #include <stdint.h>
8 10
9 #include "base/format_macros.h" 11 #include "base/format_macros.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/posix/eintr_wrapper.h" 13 #include "base/posix/eintr_wrapper.h"
12 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
13 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
14 #include "base/trace_event/trace_event.h" 16 #include "base/trace_event/trace_event.h"
15 17
16 namespace base { 18 namespace base {
17 namespace trace_event { 19 namespace trace_event {
(...skipping 23 matching lines...) Expand all
41 const char* category_group, 43 const char* category_group,
42 const char* name, 44 const char* name,
43 unsigned long long id, 45 unsigned long long id,
44 const char** arg_names, 46 const char** arg_names,
45 const unsigned char* arg_types, 47 const unsigned char* arg_types,
46 const TraceEvent::TraceValue* arg_values, 48 const TraceEvent::TraceValue* arg_values,
47 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, 49 const scoped_refptr<ConvertableToTraceFormat>* convertable_values,
48 unsigned int flags) { 50 unsigned int flags) {
49 std::string out = StringPrintf("%c|%d|%s", phase, getpid(), name); 51 std::string out = StringPrintf("%c|%d|%s", phase, getpid(), name);
50 if (flags & TRACE_EVENT_FLAG_HAS_ID) 52 if (flags & TRACE_EVENT_FLAG_HAS_ID)
51 StringAppendF(&out, "-%" PRIx64, static_cast<uint64>(id)); 53 StringAppendF(&out, "-%" PRIx64, static_cast<uint64_t>(id));
52 out += '|'; 54 out += '|';
53 55
54 for (int i = 0; i < kTraceMaxNumArgs && arg_names[i]; 56 for (int i = 0; i < kTraceMaxNumArgs && arg_names[i];
55 ++i) { 57 ++i) {
56 if (i) 58 if (i)
57 out += ';'; 59 out += ';';
58 out += arg_names[i]; 60 out += arg_names[i];
59 out += '='; 61 out += '=';
60 std::string::size_type value_start = out.length(); 62 std::string::size_type value_start = out.length();
61 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) 63 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 flags_); 172 flags_);
171 WriteToATrace(g_atrace_fd, "E", 1); 173 WriteToATrace(g_atrace_fd, "E", 1);
172 break; 174 break;
173 175
174 case TRACE_EVENT_PHASE_COUNTER: 176 case TRACE_EVENT_PHASE_COUNTER:
175 for (int i = 0; i < kTraceMaxNumArgs && arg_names_[i]; ++i) { 177 for (int i = 0; i < kTraceMaxNumArgs && arg_names_[i]; ++i) {
176 DCHECK(arg_types_[i] == TRACE_VALUE_TYPE_INT); 178 DCHECK(arg_types_[i] == TRACE_VALUE_TYPE_INT);
177 std::string out = base::StringPrintf( 179 std::string out = base::StringPrintf(
178 "C|%d|%s-%s", getpid(), name_, arg_names_[i]); 180 "C|%d|%s-%s", getpid(), name_, arg_names_[i]);
179 if (flags_ & TRACE_EVENT_FLAG_HAS_ID) 181 if (flags_ & TRACE_EVENT_FLAG_HAS_ID)
180 StringAppendF(&out, "-%" PRIx64, static_cast<uint64>(id_)); 182 StringAppendF(&out, "-%" PRIx64, static_cast<uint64_t>(id_));
181 StringAppendF(&out, "|%d|%s", 183 StringAppendF(&out, "|%d|%s",
182 static_cast<int>(arg_values_[i].as_int), category_group); 184 static_cast<int>(arg_values_[i].as_int), category_group);
183 WriteToATrace(g_atrace_fd, out.c_str(), out.size()); 185 WriteToATrace(g_atrace_fd, out.c_str(), out.size());
184 } 186 }
185 break; 187 break;
186 188
187 default: 189 default:
188 // Do nothing. 190 // Do nothing.
189 break; 191 break;
190 } 192 }
(...skipping 12 matching lines...) Expand all
203 // trace buffer. 205 // trace buffer.
204 double now_in_seconds = (TimeTicks::Now() - TimeTicks()).InSecondsF(); 206 double now_in_seconds = (TimeTicks::Now() - TimeTicks()).InSecondsF();
205 std::string marker = StringPrintf( 207 std::string marker = StringPrintf(
206 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); 208 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
207 WriteToATrace(atrace_fd, marker.c_str(), marker.size()); 209 WriteToATrace(atrace_fd, marker.c_str(), marker.size());
208 close(atrace_fd); 210 close(atrace_fd);
209 } 211 }
210 212
211 } // namespace trace_event 213 } // namespace trace_event
212 } // namespace base 214 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_event_argument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698