summaryrefslogtreecommitdiffstats
path: root/webkit/glue/devtools
diff options
context:
space:
mode:
authormnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-02 13:06:49 +0000
committermnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-02 13:06:49 +0000
commitf67131a62cfde0397fe4f442fdf7aa4925986c73 (patch)
tree93c56254846aeca0613498933f8776bad5962de6 /webkit/glue/devtools
parent4b9fa0c7b1844d11c5428d27f9ef68b5461222e4 (diff)
downloadchromium_src-f67131a62cfde0397fe4f442fdf7aa4925986c73.zip
chromium_src-f67131a62cfde0397fe4f442fdf7aa4925986c73.tar.gz
chromium_src-f67131a62cfde0397fe4f442fdf7aa4925986c73.tar.bz2
DevTools Profiler: use sampling rate reported by V8 profiler.
Also fix a small problem with displaying "Processing..." icon: handle the case when log processing finishes prior to 'didIsProfilingStarted_' arrived. BUG=none TEST=none Review URL: http://codereview.chromium.org/119039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/devtools')
-rw-r--r--webkit/glue/devtools/js/debugger_agent.js3
-rw-r--r--webkit/glue/devtools/js/profiler_processor.js36
2 files changed, 30 insertions, 9 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js
index 3f7d14fb..8603634 100644
--- a/webkit/glue/devtools/js/debugger_agent.js
+++ b/webkit/glue/devtools/js/debugger_agent.js
@@ -611,7 +611,8 @@ devtools.DebuggerAgent.prototype.didIsProfilingStarted_ = function(
if (is_started && !this.isProfilingStarted_) {
// Start to query log data.
RemoteDebuggerAgent.GetLogLines(this.lastProfileLogPosition_);
- } else if (!is_started && this.isProfilingStarted_) {
+ } else if (!is_started && this.isProfilingStarted_ &&
+ this.profilerProcessor_.isProcessingProfile()) {
// Display a temporary icon / message indicating that the profile
// is being processed.
var processingIcon = new WebInspector.SidebarTreeElement(
diff --git a/webkit/glue/devtools/js/profiler_processor.js b/webkit/glue/devtools/js/profiler_processor.js
index 4c4e7ef..117afc8 100644
--- a/webkit/glue/devtools/js/profiler_processor.js
+++ b/webkit/glue/devtools/js/profiler_processor.js
@@ -77,10 +77,10 @@ devtools.profiler.Processor = function(newProfileCallback) {
this.currentProfile_ = null;
/**
- * Builder of profile views.
+ * Builder of profile views. Created during "profiler,begin" event processing.
* @type {devtools.profiler.ViewBuilder}
*/
- this.viewBuilder_ = new devtools.profiler.ViewBuilder(1);
+ this.viewBuilder_ = null;
/**
* Next profile id.
@@ -103,7 +103,7 @@ devtools.profiler.Processor.RecordsDispatch_ = {
processor: 'processCodeDelete_', needsProfile: true },
'tick': { parsers: [parseInt, parseInt, parseInt, 'var-args'],
processor: 'processTick_', needsProfile: true },
- 'profiler': { parsers: [null], processor: 'processProfiler_',
+ 'profiler': { parsers: [null, 'var-args'], processor: 'processProfiler_',
needsProfile: false },
// Not used in DevTools Profiler.
'shared-library': null,
@@ -115,6 +115,15 @@ devtools.profiler.Processor.RecordsDispatch_ = {
/**
+ * Returns whether a profile is currently processed.
+ * @return {boolean}
+ */
+devtools.profiler.Processor.prototype.isProcessingProfile = function() {
+ return this.currentProfile_ != null;
+};
+
+
+/**
* Sets new profile callback.
* @param {function(devtools.profiler.ProfileView)} callback Callback function.
*/
@@ -197,11 +206,13 @@ devtools.profiler.Processor.prototype.dispatchLogRow_ = function(fields) {
};
-devtools.profiler.Processor.prototype.processProfiler_ = function(state) {
+devtools.profiler.Processor.prototype.processProfiler_ = function(state, params) {
switch (state) {
case "resume":
- this.currentProfile_ = new devtools.profiler.JsProfile();
- this.profiles_.push(this.currentProfile_);
+ if (this.currentProfile_ == null) {
+ this.currentProfile_ = new devtools.profiler.JsProfile();
+ this.profiles_.push(this.currentProfile_);
+ }
break;
case "pause":
if (this.currentProfile_ != null) {
@@ -209,8 +220,17 @@ devtools.profiler.Processor.prototype.processProfiler_ = function(state) {
this.currentProfile_ = null;
}
break;
- // These events are valid but are not used.
- case "begin": break;
+ case "begin":
+ var samplingRate = NaN;
+ if (params.length > 0) {
+ samplingRate = parseInt(params[0]);
+ }
+ if (isNaN(samplingRate)) {
+ samplingRate = 1;
+ }
+ this.viewBuilder_ = new devtools.profiler.ViewBuilder(samplingRate);
+ break;
+ // This event is valid but isn't used.
case "end": break;
default:
throw new Error("unknown profiler state: " + state);