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

Unified Diff: src/api.cc

Issue 159581: Add generic V8 API functions for controlling profiling aspects. (Closed)
Patch Set: Renamings Created 11 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 | « include/v8.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index edfa0fcef492c3721544be4781e2a3006c2eb716..08281012bdb05a012884b6375fa59f5357f85790 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3235,6 +3235,46 @@ bool V8::IsProfilerPaused() {
}
+void V8::ResumeProfilerEx(int flags) {
+#ifdef ENABLE_LOGGING_AND_PROFILING
+ if (flags & PROFILER_MODULE_CPU) {
+ i::Logger::ResumeProfiler();
+ }
+ if (flags & (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) {
+ i::FLAG_log_gc = true;
+ }
+#endif
+}
+
+
+void V8::PauseProfilerEx(int flags) {
+#ifdef ENABLE_LOGGING_AND_PROFILING
+ if (flags & PROFILER_MODULE_CPU) {
+ i::Logger::PauseProfiler();
+ }
+ if (flags & (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) {
+ i::FLAG_log_gc = false;
+ }
+#endif
+}
+
+
+int V8::GetActiveProfilerModules() {
+#ifdef ENABLE_LOGGING_AND_PROFILING
+ int result = PROFILER_MODULE_NONE;
+ if (!i::Logger::IsProfilerPaused()) {
+ result |= PROFILER_MODULE_CPU;
+ }
+ if (i::FLAG_log_gc) {
+ result |= PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS;
+ }
+ return result;
+#else
+ return PROFILER_MODULE_NONE;
+#endif
+}
+
+
int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) {
#ifdef ENABLE_LOGGING_AND_PROFILING
return i::Logger::GetLogLines(from_pos, dest_buf, max_size);
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698