[perf] add tweener.framePrepareStart/Done events

Add events when we start preparing a frame and finish preparing
a frame. (In addition to measuring property-updating overhead, this allows
us to see the interval between finishing preparing a frame and starting
painting the frame, which is the relayout time.)

https://bugzilla.gnome.org/show_bug.cgi?id=619515
This commit is contained in:
Owen W. Taylor 2010-05-24 09:48:41 -04:00
parent 3e2a9a57a1
commit 07cfb8d524

View File

@ -4,6 +4,7 @@ const Clutter = imports.gi.Clutter;
const GLib = imports.gi.GLib; const GLib = imports.gi.GLib;
const Lang = imports.lang; const Lang = imports.lang;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
const Shell = imports.gi.Shell;
const Signals = imports.signals; const Signals = imports.signals;
const Tweener = imports.tweener.tweener; const Tweener = imports.tweener.tweener;
@ -221,6 +222,14 @@ ClutterFrameTicker.prototype = {
function(timeline, frame) { function(timeline, frame) {
this._onNewFrame(frame); this._onNewFrame(frame);
})); }));
let perf_log = Shell.PerfLog.get_default();
perf_log.define_event("tweener.framePrepareStart",
"Start of a new animation frame",
"");
perf_log.define_event("tweener.framePrepareDone",
"Finished preparing frame",
"");
}, },
_onNewFrame : function(frame) { _onNewFrame : function(frame) {
@ -233,8 +242,11 @@ ClutterFrameTicker.prototype = {
this._startTime = this._timeline.get_elapsed_time(); this._startTime = this._timeline.get_elapsed_time();
// currentTime is in milliseconds // currentTime is in milliseconds
let perf_log = Shell.PerfLog.get_default();
this._currentTime = (this._timeline.get_elapsed_time() - this._startTime) / slowDownFactor; this._currentTime = (this._timeline.get_elapsed_time() - this._startTime) / slowDownFactor;
perf_log.event("tweener.framePrepareStart");
this.emit('prepare-frame'); this.emit('prepare-frame');
perf_log.event("tweener.framePrepareDone");
}, },
getTime : function() { getTime : function() {