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

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

Issue 1717283003: tracing: Make ConvertableToTraceFormat move-only scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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) 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> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 20 matching lines...) Expand all
31 if (written <= 0) 31 if (written <= 0)
32 break; 32 break;
33 total_written += written; 33 total_written += written;
34 } 34 }
35 if (total_written < size) { 35 if (total_written < size) {
36 PLOG(WARNING) << "Failed to write buffer '" << std::string(buffer, size) 36 PLOG(WARNING) << "Failed to write buffer '" << std::string(buffer, size)
37 << "' to " << kATraceMarkerFile; 37 << "' to " << kATraceMarkerFile;
38 } 38 }
39 } 39 }
40 40
41 void WriteEvent( 41 void WriteEvent(char phase,
42 char phase, 42 const char* category_group,
43 const char* category_group, 43 const char* name,
44 const char* name, 44 unsigned long long id,
45 unsigned long long id, 45 const char** arg_names,
46 const char** arg_names, 46 const unsigned char* arg_types,
47 const unsigned char* arg_types, 47 const TraceEvent::TraceValue* arg_values,
48 const TraceEvent::TraceValue* arg_values, 48 const scoped_ptr<ConvertableToTraceFormat>* convertable_values,
49 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, 49 unsigned int flags) {
50 unsigned int flags) {
51 std::string out = StringPrintf("%c|%d|%s", phase, getpid(), name); 50 std::string out = StringPrintf("%c|%d|%s", phase, getpid(), name);
52 if (flags & TRACE_EVENT_FLAG_HAS_ID) 51 if (flags & TRACE_EVENT_FLAG_HAS_ID)
53 StringAppendF(&out, "-%" PRIx64, static_cast<uint64_t>(id)); 52 StringAppendF(&out, "-%" PRIx64, static_cast<uint64_t>(id));
54 out += '|'; 53 out += '|';
55 54
56 for (int i = 0; i < kTraceMaxNumArgs && arg_names[i]; 55 for (int i = 0; i < kTraceMaxNumArgs && arg_names[i];
57 ++i) { 56 ++i) {
58 if (i) 57 if (i)
59 out += ';'; 58 out += ';';
60 out += arg_names[i]; 59 out += arg_names[i];
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // trace buffer. 204 // trace buffer.
206 double now_in_seconds = (TimeTicks::Now() - TimeTicks()).InSecondsF(); 205 double now_in_seconds = (TimeTicks::Now() - TimeTicks()).InSecondsF();
207 std::string marker = StringPrintf( 206 std::string marker = StringPrintf(
208 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); 207 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
209 WriteToATrace(atrace_fd, marker.c_str(), marker.size()); 208 WriteToATrace(atrace_fd, marker.c_str(), marker.size());
210 close(atrace_fd); 209 close(atrace_fd);
211 } 210 }
212 211
213 } // namespace trace_event 212 } // namespace trace_event
214 } // namespace base 213 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698