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

Unified Diff: webkit/glue/devtools/js/profiler_processor.js

Issue 119039: DevTools Profiler: use sampling rate reported by V8 profiler.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 | « webkit/glue/devtools/js/debugger_agent.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/devtools/js/profiler_processor.js
===================================================================
--- webkit/glue/devtools/js/profiler_processor.js (revision 17399)
+++ webkit/glue/devtools/js/profiler_processor.js (working copy)
@@ -77,10 +77,10 @@
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 @@
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 @@
/**
+ * 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.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 @@
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);
« no previous file with comments | « webkit/glue/devtools/js/debugger_agent.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698