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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
(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, std::string name,
15 std::string category_group, uint64_t id,
16 uint64_t bind_id, int num_args, int flags) {
17 pid_ = base::OS::GetCurrentProcessId();
18 tid_ = base::OS::GetCurrentThreadId();
19 phase_ = phase;
20 name_ = name;
21 category_group_ = category_group;
22 id_ = id;
23 bind_id_ = bind_id;
24 num_args_ = num_args;
25 flags_ = flags;
26 ts_ = base::TimeTicks::HighResolutionNow().ToInternalValue();
27 tts_ = base::ThreadTicks::Now().ToInternalValue();
28 duration_ = 0;
29 cpu_duration_ = 0;
30 }
31
32 void TraceObject::UpdateDuration() {
33 duration_ = base::TimeTicks::HighResolutionNow().ToInternalValue() - ts_;
34 cpu_duration_ = base::ThreadTicks::Now().ToInternalValue() - tts_;
35 }
36
37 void TraceObject::InitializeForTesting(char phase, std::string name,
38 std::string category_group, uint64_t id,
39 uint64_t bind_id, int num_args,
40 int flags, int pid, int tid, int64_t ts,
41 int64_t tts, uint64_t duration,
42 uint64_t cpu_duration) {
43 pid_ = pid;
44 tid_ = tid;
45 phase_ = phase;
46 name_ = name;
47 category_group_ = category_group;
48 id_ = id;
49 bind_id_ = bind_id;
50 num_args_ = num_args;
51 flags_ = flags;
52 ts_ = ts;
53 tts_ = tts;
54 duration_ = duration;
55 cpu_duration_ = cpu_duration;
56 }
57
58 } // namespace tracing
59 } // namespace platform
60 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698