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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8-sampler.h ('k') | src/d8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8-tracing-controller.h
diff --git a/include/v8-tracing-controller.h b/include/v8-tracing-controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..bfcc02b0fd8f09aa7fe847ec93ae5b7fd60af630
--- /dev/null
+++ b/include/v8-tracing-controller.h
@@ -0,0 +1,63 @@
+// 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.
+
+#ifndef V8_TRACING_CONTROLLER_H_
+#define V8_TRACING_CONTROLLER_H_
+
+#include "include/v8-sampler.h"
+#include "src/base/platform/elapsed-timer.h"
+
+namespace v8 {
+
+namespace internal {
+struct TickSample;
+}
+
+class Isolate;
+class Profiler;
+class Ticker;
+class TracingLogger;
+struct JitCodeEvent;
+
+class TracingController {
+ public:
+ static void SetUp() {
+ if (!TracingController::mutex_)
+ TracingController::mutex_ = new base::Mutex();
+ V8Sampler::SetUp();
+ }
+ static void TearDown() {
+ V8Sampler::TearDown();
+ delete mutex_;
+ mutex_ = NULL;
+ }
+ static void StartTracing(Isolate* isolate);
+ static void StopTracing();
+ static void SetInterval(int interval);
+
+ Isolate* isolate() const { return isolate_; }
+ bool IsTracing() const { return is_tracing_; }
+ private:
+ static void InstallJitCodeEventHandler(Isolate* isolate, void* data);
+ static void HandleJitCodeEvent(const JitCodeEvent* event);
+ void Start();
+ void Stop();
+ TracingController(Isolate* isolate);
+ void LogSample(i::TickSample* sample, bool overflow);
+ friend class Profiler;
+ friend class Ticker;
+
+ base::ElapsedTimer timer_;
+ bool is_tracing_;
+ Isolate* isolate_;
+ Profiler* profiler_;
+ Ticker* ticker_;
+ TracingLogger* logger_;
+ static base::Mutex* mutex_;
+ static TracingController* tracing_controller_;
+};
+
+}
+
+#endif // V8_TRACING_CONTROLLER_H_
« 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