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

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

Issue 1708573003: [WIP]Create a V8 sampler library and tracing controller. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « include/v8-sampler.h ('k') | src/d8.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef V8_TRACING_CONTROLLER_H_
6 #define V8_TRACING_CONTROLLER_H_
7
8 #include "include/v8-sampler.h"
9 #include "src/base/platform/elapsed-timer.h"
10
11 namespace v8 {
12
13 namespace internal {
14 struct TickSample;
15 }
16
17 class Isolate;
18 class Profiler;
19 class Ticker;
20 class TracingLogger;
21 struct JitCodeEvent;
22
23 class TracingController {
24 public:
25 static void SetUp() {
26 if (!TracingController::mutex_)
27 TracingController::mutex_ = new base::Mutex();
28 V8Sampler::SetUp();
29 }
30 static void TearDown() {
31 V8Sampler::TearDown();
32 delete mutex_;
33 mutex_ = NULL;
34 }
35 static void StartTracing(Isolate* isolate);
36 static void StopTracing();
37 static void SetInterval(int interval);
38
39 Isolate* isolate() const { return isolate_; }
40 bool IsTracing() const { return is_tracing_; }
41 private:
42 static void InstallJitCodeEventHandler(Isolate* isolate, void* data);
43 static void HandleJitCodeEvent(const JitCodeEvent* event);
44 void Start();
45 void Stop();
46 TracingController(Isolate* isolate);
47 void LogSample(i::TickSample* sample, bool overflow);
48 friend class Profiler;
49 friend class Ticker;
50
51 base::ElapsedTimer timer_;
52 bool is_tracing_;
53 Isolate* isolate_;
54 Profiler* profiler_;
55 Ticker* ticker_;
56 TracingLogger* logger_;
57 static base::Mutex* mutex_;
58 static TracingController* tracing_controller_;
59 };
60
61 }
62
63 #endif // V8_TRACING_CONTROLLER_H_
OLDNEW
« no previous file with comments | « include/v8-sampler.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698