diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 15:10:28 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 15:10:28 +0000 |
commit | ae5f2a5b0f283a5b39378d945ee745c10bd7a4b4 (patch) | |
tree | 3b6527e76ed9d678afa04ebeacd1cf5ae2437730 /webkit/glue/devtools/js/profiler_processor.js | |
parent | ea041c5e5d368bf25b3e851def37e11751e11e40 (diff) | |
download | chromium_src-ae5f2a5b0f283a5b39378d945ee745c10bd7a4b4.zip chromium_src-ae5f2a5b0f283a5b39378d945ee745c10bd7a4b4.tar.gz chromium_src-ae5f2a5b0f283a5b39378d945ee745c10bd7a4b4.tar.bz2 |
DevTools Profiler: small UI improvements.
- if profile is generated, and no profile is shown, show the new one;
- display processed ticks count during processing to show that we're alive.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/159135
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/devtools/js/profiler_processor.js')
-rw-r--r-- | webkit/glue/devtools/js/profiler_processor.js | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/webkit/glue/devtools/js/profiler_processor.js b/webkit/glue/devtools/js/profiler_processor.js index 62e45cc..f88185e 100644 --- a/webkit/glue/devtools/js/profiler_processor.js +++ b/webkit/glue/devtools/js/profiler_processor.js @@ -179,6 +179,12 @@ devtools.profiler.Processor = function() { this.startedProfileProcessing_ = null; /** + * Callback that is called periodically to display processing status. + * @type {function()} + */ + this.profileProcessingStatus_ = null; + + /** * Callback that is called when a profile has been processed and is ready * to be shown. * @type {function(devtools.profiler.ProfileView)} @@ -202,6 +208,12 @@ devtools.profiler.Processor = function() { * @type {number} */ this.profileId_ = 1; + + /** + * Counter for processed ticks. + * @type {number} + */ + this.ticksCount_ = 0; }; goog.inherits(devtools.profiler.Processor, devtools.profiler.LogReader); @@ -230,8 +242,9 @@ devtools.profiler.Processor.prototype.skipDispatch = function(dispatch) { * processing callback. */ devtools.profiler.Processor.prototype.setCallbacks = function( - started, finished) { + started, processing, finished) { this.startedProfileProcessing_ = started; + this.profileProcessingStatus_ = processing; this.finishedProfileProcessing_ = finished; }; @@ -265,6 +278,7 @@ devtools.profiler.Processor.prototype.setNewProfileCallback = function( devtools.profiler.Processor.prototype.processProfiler_ = function( state, params) { + var processingInterval = null; switch (state) { case 'resume': if (this.currentProfile_ == null) { @@ -276,10 +290,18 @@ devtools.profiler.Processor.prototype.processProfiler_ = function( if (this.startedProfileProcessing_) { this.startedProfileProcessing_(); } + this.ticksCount_ = 0; + var self = this; + if (this.profileProcessingStatus_) { + processingInterval = window.setInterval( + function() { self.profileProcessingStatus_(self.ticksCount_); }, + 1000); + } } break; case 'pause': if (this.currentProfile_ != null) { + window.clearInterval(processingInterval); if (this.finishedProfileProcessing_) { this.finishedProfileProcessing_(this.createProfileForView()); } @@ -326,6 +348,7 @@ devtools.profiler.Processor.prototype.processTick_ = function( // see the comment for devtools.profiler.Processor.PROGRAM_ENTRY stack.push(devtools.profiler.Processor.PROGRAM_ENTRY_STR); this.currentProfile_.recordTick(this.processStack(pc, stack)); + this.ticksCount_++; }; |