| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "include/libplatform/v8-tracing.h" | |
| 6 | |
| 7 #include "src/base/platform/platform.h" | |
| 8 #include "src/base/platform/time.h" | |
| 9 | |
| 10 namespace v8 { | |
| 11 namespace platform { | |
| 12 namespace tracing { | |
| 13 | |
| 14 void TraceObject::Initialize(char phase, const uint8_t* category_enabled_flag, | |
| 15 const char* name, const char* scope, uint64_t id, | |
| 16 uint64_t bind_id, int num_args, | |
| 17 const char** arg_names, const uint8_t* arg_types, | |
| 18 const uint64_t* arg_values, unsigned int flags) { | |
| 19 pid_ = base::OS::GetCurrentProcessId(); | |
| 20 tid_ = base::OS::GetCurrentThreadId(); | |
| 21 phase_ = phase; | |
| 22 category_enabled_flag_ = category_enabled_flag; | |
| 23 name_ = name; | |
| 24 scope_ = scope; | |
| 25 id_ = id; | |
| 26 bind_id_ = bind_id; | |
| 27 num_args_ = num_args; | |
| 28 flags_ = flags; | |
| 29 ts_ = base::TimeTicks::HighResolutionNow().ToInternalValue(); | |
| 30 tts_ = base::ThreadTicks::Now().ToInternalValue(); | |
| 31 duration_ = 0; | |
| 32 cpu_duration_ = 0; | |
| 33 } | |
| 34 | |
| 35 void TraceObject::UpdateDuration() { | |
| 36 duration_ = base::TimeTicks::HighResolutionNow().ToInternalValue() - ts_; | |
| 37 cpu_duration_ = base::ThreadTicks::Now().ToInternalValue() - tts_; | |
| 38 } | |
| 39 | |
| 40 void TraceObject::InitializeForTesting( | |
| 41 char phase, const uint8_t* category_enabled_flag, const char* name, | |
| 42 const char* scope, uint64_t id, uint64_t bind_id, int num_args, | |
| 43 const char** arg_names, const uint8_t* arg_types, | |
| 44 const uint64_t* arg_values, unsigned int flags, int pid, int tid, | |
| 45 int64_t ts, int64_t tts, uint64_t duration, uint64_t cpu_duration) { | |
| 46 pid_ = pid; | |
| 47 tid_ = tid; | |
| 48 phase_ = phase; | |
| 49 category_enabled_flag_ = category_enabled_flag; | |
| 50 name_ = name; | |
| 51 scope_ = scope; | |
| 52 id_ = id; | |
| 53 bind_id_ = bind_id; | |
| 54 num_args_ = num_args; | |
| 55 flags_ = flags; | |
| 56 ts_ = ts; | |
| 57 tts_ = tts; | |
| 58 duration_ = duration; | |
| 59 cpu_duration_ = cpu_duration; | |
| 60 } | |
| 61 | |
| 62 } // namespace tracing | |
| 63 } // namespace platform | |
| 64 } // namespace v8 | |
| OLD | NEW |