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

Side by Side Diff: include/libplatform/v8-tracing.h

Issue 2190973003: [Tracing] V8 Tracing Controller - Add args and copy support (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use V8_INLINE static for non-class functions Created 4 years, 4 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project 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 #ifndef V8_LIBPLATFORM_V8_TRACING_H_ 5 #ifndef V8_LIBPLATFORM_V8_TRACING_H_
6 #define V8_LIBPLATFORM_V8_TRACING_H_ 6 #define V8_LIBPLATFORM_V8_TRACING_H_
7 7
8 #include <fstream> 8 #include <fstream>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace platform { 13 namespace platform {
14 namespace tracing { 14 namespace tracing {
15 15
16 const int kTraceMaxNumArgs = 2;
17
16 class TraceObject { 18 class TraceObject {
17 public: 19 public:
20 union ArgValue {
21 bool as_bool;
22 uint64_t as_uint;
23 int64_t as_int;
24 double as_double;
25 const void* as_pointer;
26 const char* as_string;
27 };
28
18 TraceObject() {} 29 TraceObject() {}
30 ~TraceObject();
19 void Initialize(char phase, const uint8_t* category_enabled_flag, 31 void Initialize(char phase, const uint8_t* category_enabled_flag,
20 const char* name, const char* scope, uint64_t id, 32 const char* name, const char* scope, uint64_t id,
21 uint64_t bind_id, int num_args, const char** arg_names, 33 uint64_t bind_id, int num_args, const char** arg_names,
22 const uint8_t* arg_types, const uint64_t* arg_values, 34 const uint8_t* arg_types, const uint64_t* arg_values,
23 unsigned int flags); 35 unsigned int flags);
24 void UpdateDuration(); 36 void UpdateDuration();
25 void InitializeForTesting(char phase, const uint8_t* category_enabled_flag, 37 void InitializeForTesting(char phase, const uint8_t* category_enabled_flag,
26 const char* name, const char* scope, uint64_t id, 38 const char* name, const char* scope, uint64_t id,
27 uint64_t bind_id, int num_args, 39 uint64_t bind_id, int num_args,
28 const char** arg_names, const uint8_t* arg_types, 40 const char** arg_names, const uint8_t* arg_types,
29 const uint64_t* arg_values, unsigned int flags, 41 const uint64_t* arg_values, unsigned int flags,
30 int pid, int tid, int64_t ts, int64_t tts, 42 int pid, int tid, int64_t ts, int64_t tts,
31 uint64_t duration, uint64_t cpu_duration); 43 uint64_t duration, uint64_t cpu_duration);
32 44
33 int pid() const { return pid_; } 45 int pid() const { return pid_; }
34 int tid() const { return tid_; } 46 int tid() const { return tid_; }
35 char phase() const { return phase_; } 47 char phase() const { return phase_; }
36 const uint8_t* category_enabled_flag() const { 48 const uint8_t* category_enabled_flag() const {
37 return category_enabled_flag_; 49 return category_enabled_flag_;
38 } 50 }
39 const char* name() const { return name_; } 51 const char* name() const { return name_; }
40 const char* scope() const { return scope_; } 52 const char* scope() const { return scope_; }
41 uint64_t id() const { return id_; } 53 uint64_t id() const { return id_; }
42 uint64_t bind_id() const { return bind_id_; } 54 uint64_t bind_id() const { return bind_id_; }
55 int num_args() const { return num_args_; }
56 const char** arg_names() { return arg_names_; }
57 uint8_t* arg_types() { return arg_types_; }
58 ArgValue* arg_values() { return arg_values_; }
43 unsigned int flags() const { return flags_; } 59 unsigned int flags() const { return flags_; }
44 int64_t ts() { return ts_; } 60 int64_t ts() { return ts_; }
45 int64_t tts() { return tts_; } 61 int64_t tts() { return tts_; }
46 uint64_t duration() { return duration_; } 62 uint64_t duration() { return duration_; }
47 uint64_t cpu_duration() { return cpu_duration_; } 63 uint64_t cpu_duration() { return cpu_duration_; }
48 64
49 private: 65 private:
50 int pid_; 66 int pid_;
51 int tid_; 67 int tid_;
52 char phase_; 68 char phase_;
53 const char* name_; 69 const char* name_;
54 const char* scope_; 70 const char* scope_;
55 const uint8_t* category_enabled_flag_; 71 const uint8_t* category_enabled_flag_;
56 uint64_t id_; 72 uint64_t id_;
57 uint64_t bind_id_; 73 uint64_t bind_id_;
58 int num_args_; 74 int num_args_;
75 const char* arg_names_[kTraceMaxNumArgs];
76 uint8_t arg_types_[kTraceMaxNumArgs];
77 ArgValue arg_values_[kTraceMaxNumArgs];
78 char* parameter_copy_storage_ = nullptr;
59 unsigned int flags_; 79 unsigned int flags_;
60 int64_t ts_; 80 int64_t ts_;
61 int64_t tts_; 81 int64_t tts_;
62 uint64_t duration_; 82 uint64_t duration_;
63 uint64_t cpu_duration_; 83 uint64_t cpu_duration_;
64 // TODO(fmeawad): Add args support.
65 84
66 // Disallow copy and assign 85 // Disallow copy and assign
67 TraceObject(const TraceObject&) = delete; 86 TraceObject(const TraceObject&) = delete;
68 void operator=(const TraceObject&) = delete; 87 void operator=(const TraceObject&) = delete;
69 }; 88 };
70 89
71 class TraceWriter { 90 class TraceWriter {
72 public: 91 public:
73 TraceWriter() {} 92 TraceWriter() {}
74 virtual ~TraceWriter() {} 93 virtual ~TraceWriter() {}
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // Disallow copy and assign 242 // Disallow copy and assign
224 TracingController(const TracingController&) = delete; 243 TracingController(const TracingController&) = delete;
225 void operator=(const TracingController&) = delete; 244 void operator=(const TracingController&) = delete;
226 }; 245 };
227 246
228 } // namespace tracing 247 } // namespace tracing
229 } // namespace platform 248 } // namespace platform
230 } // namespace v8 249 } // namespace v8
231 250
232 #endif // V8_LIBPLATFORM_V8_TRACING_H_ 251 #endif // V8_LIBPLATFORM_V8_TRACING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698