OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_V8_PLATFORM_H_ | 5 #ifndef V8_V8_PLATFORM_H_ |
6 #define V8_V8_PLATFORM_H_ | 6 #define V8_V8_PLATFORM_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 namespace v8 { | 10 namespace v8 { |
9 | 11 |
10 class Isolate; | 12 class Isolate; |
11 | 13 |
12 /** | 14 /** |
13 * A Task represents a unit of work. | 15 * A Task represents a unit of work. |
14 */ | 16 */ |
15 class Task { | 17 class Task { |
16 public: | 18 public: |
17 virtual ~Task() {} | 19 virtual ~Task() {} |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 102 } |
101 | 103 |
102 /** | 104 /** |
103 * Monotonically increasing time in seconds from an arbitrary fixed point in | 105 * Monotonically increasing time in seconds from an arbitrary fixed point in |
104 * the past. This function is expected to return at least | 106 * the past. This function is expected to return at least |
105 * millisecond-precision values. For this reason, | 107 * millisecond-precision values. For this reason, |
106 * it is recommended that the fixed point be no further in the past than | 108 * it is recommended that the fixed point be no further in the past than |
107 * the epoch. | 109 * the epoch. |
108 **/ | 110 **/ |
109 virtual double MonotonicallyIncreasingTime() = 0; | 111 virtual double MonotonicallyIncreasingTime() = 0; |
| 112 |
| 113 /** |
| 114 * Called by TRACE_EVENT* macros, don't call this directly. |
| 115 * The name parameter is a category group for example: |
| 116 * TRACE_EVENT0("v8,parse", "V8.Parse") |
| 117 * The pointer returned points to a value with zero or more of the bits |
| 118 * defined in CategoryGroupEnabledFlags. |
| 119 **/ |
| 120 virtual const uint8_t* GetCategoryGroupEnabled(const char* name) { |
| 121 static uint8_t no = 0; |
| 122 return &no; |
| 123 } |
| 124 |
| 125 /** |
| 126 * Gets the category group name of the given category_enabled_flag pointer. |
| 127 * Usually used while serliazing TRACE_EVENTs. |
| 128 **/ |
| 129 virtual const char* GetCategoryGroupName( |
| 130 const uint8_t* category_enabled_flag) { |
| 131 static const char dummy[] = "dummy"; |
| 132 return dummy; |
| 133 } |
| 134 |
| 135 /** |
| 136 * Adds a trace event to the platform tracing system. This function call is |
| 137 * usually the result of a TRACE_* macro from trace_event_common.h when |
| 138 * tracing and the category of the particular trace are enabled. It is not |
| 139 * advisable to call this function on its own; it is really only meant to be |
| 140 * used by the trace macros. The returned handle can be used by |
| 141 * UpdateTraceEventDuration to update the duration of COMPLETE events. |
| 142 */ |
| 143 virtual uint64_t AddTraceEvent( |
| 144 char phase, const uint8_t* category_enabled_flag, const char* name, |
| 145 uint64_t id, uint64_t bind_id, int32_t num_args, const char** arg_names, |
| 146 const uint8_t* arg_types, const uint64_t* arg_values, |
| 147 unsigned int flags) { |
| 148 return 0; |
| 149 } |
| 150 |
| 151 /** |
| 152 * Sets the duration field of a COMPLETE trace event. It must be called with |
| 153 * the handle returned from AddTraceEvent(). |
| 154 **/ |
| 155 virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, |
| 156 const char* name, uint64_t handle) {} |
110 }; | 157 }; |
111 | 158 |
112 } // namespace v8 | 159 } // namespace v8 |
113 | 160 |
114 #endif // V8_V8_PLATFORM_H_ | 161 #endif // V8_V8_PLATFORM_H_ |
OLD | NEW |