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

Unified Diff: src/libplatform/tracing/trace-object.cc

Issue 2137013006: [Tracing] V8 Tracing Controller (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add Setters for TraceConfig categories Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/libplatform/tracing/trace-config.cc ('k') | src/libplatform/tracing/trace-writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/libplatform/tracing/trace-object.cc
diff --git a/src/libplatform/tracing/trace-object.cc b/src/libplatform/tracing/trace-object.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f8a827409d28872ed93df8a430b2dc86cc54698a
--- /dev/null
+++ b/src/libplatform/tracing/trace-object.cc
@@ -0,0 +1,64 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "include/libplatform/v8-tracing.h"
+
+#include "src/base/platform/platform.h"
+#include "src/base/platform/time.h"
+
+namespace v8 {
+namespace platform {
+namespace tracing {
+
+void TraceObject::Initialize(char phase, const uint8_t* category_enabled_flag,
+ const char* name, const char* scope, uint64_t id,
+ uint64_t bind_id, int num_args,
+ const char** arg_names, const uint8_t* arg_types,
+ const uint64_t* arg_values, unsigned int flags) {
+ pid_ = base::OS::GetCurrentProcessId();
+ tid_ = base::OS::GetCurrentThreadId();
+ phase_ = phase;
+ category_enabled_flag_ = category_enabled_flag;
+ name_ = name;
+ scope_ = scope;
+ id_ = id;
+ bind_id_ = bind_id;
+ num_args_ = num_args;
+ flags_ = flags;
+ ts_ = base::TimeTicks::HighResolutionNow().ToInternalValue();
+ tts_ = base::ThreadTicks::Now().ToInternalValue();
+ duration_ = 0;
+ cpu_duration_ = 0;
+}
+
+void TraceObject::UpdateDuration() {
+ duration_ = base::TimeTicks::HighResolutionNow().ToInternalValue() - ts_;
+ cpu_duration_ = base::ThreadTicks::Now().ToInternalValue() - tts_;
+}
+
+void TraceObject::InitializeForTesting(
+ char phase, const uint8_t* category_enabled_flag, const char* name,
+ const char* scope, uint64_t id, uint64_t bind_id, int num_args,
+ const char** arg_names, const uint8_t* arg_types,
+ const uint64_t* arg_values, unsigned int flags, int pid, int tid,
+ int64_t ts, int64_t tts, uint64_t duration, uint64_t cpu_duration) {
+ pid_ = pid;
+ tid_ = tid;
+ phase_ = phase;
+ category_enabled_flag_ = category_enabled_flag;
+ name_ = name;
+ scope_ = scope;
+ id_ = id;
+ bind_id_ = bind_id;
+ num_args_ = num_args;
+ flags_ = flags;
+ ts_ = ts;
+ tts_ = tts;
+ duration_ = duration;
+ cpu_duration_ = cpu_duration;
+}
+
+} // namespace tracing
+} // namespace platform
+} // namespace v8
« no previous file with comments | « src/libplatform/tracing/trace-config.cc ('k') | src/libplatform/tracing/trace-writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698