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

Unified Diff: Source/core/inspector/InspectorProfilerAgent.cpp

Issue 23690005: Allow configuring CPU profiler sampling interval (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | « Source/core/inspector/InspectorProfilerAgent.h ('k') | Source/devtools/front_end/ProfilesPanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorProfilerAgent.cpp
diff --git a/Source/core/inspector/InspectorProfilerAgent.cpp b/Source/core/inspector/InspectorProfilerAgent.cpp
index 4af971556144025a25650620b286b264f090eb91..d5a1b9e5ef53bdf59cb9027fa7598e4872c09fd8 100644
--- a/Source/core/inspector/InspectorProfilerAgent.cpp
+++ b/Source/core/inspector/InspectorProfilerAgent.cpp
@@ -47,6 +47,7 @@
namespace WebCore {
namespace ProfilerAgentState {
+static const char samplingInterval[] = "samplingInterval";
static const char userInitiatedProfiling[] = "userInitiatedProfiling";
static const char profilerEnabled[] = "profilerEnabled";
static const char profileHeadersRequested[] = "profileHeadersRequested";
@@ -134,6 +135,16 @@ bool InspectorProfilerAgent::enabled()
return m_state->getBoolean(ProfilerAgentState::profilerEnabled);
}
+void InspectorProfilerAgent::setSamplingInterval(ErrorString* error, int interval)
+{
+ if (m_recordingCPUProfile) {
+ *error = "Cannot change sampling interval when profiling.";
+ return;
+ }
+ m_state->setLong(ProfilerAgentState::samplingInterval, interval);
+ ScriptProfiler::setSamplingInterval(interval);
+}
+
String InspectorProfilerAgent::getCurrentUserInitiatedProfileName(bool incrementProfileNumber)
{
if (incrementProfileNumber)
@@ -212,6 +223,8 @@ void InspectorProfilerAgent::clearFrontend()
void InspectorProfilerAgent::restore()
{
resetFrontendProfiles();
+ if (long interval = m_state->getLong(ProfilerAgentState::samplingInterval, interval))
+ ScriptProfiler::setSamplingInterval(interval);
if (m_state->getBoolean(ProfilerAgentState::userInitiatedProfiling))
start();
}
« no previous file with comments | « Source/core/inspector/InspectorProfilerAgent.h ('k') | Source/devtools/front_end/ProfilesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698