profiling: Adds initial UProf support across clutter
UProf is a small library that aims to help applications/libraries provide domain specific reports about performance. It currently provides high precision timer primitives (rdtsc on x86) and simple counters, the ability to link statistics between optional components at runtime and makes report generation easy. This adds initial accounting for: - Total mainloop time - Painting - Picking - Layouting - Idle time The timing done by uprof is of wall clock time. It's not based on stochastic samples we simply sample a counter at the start and end. When dealing with the complexities of GPU drivers and with various kinds of IO this form of profiling can be quite enlightening as it will be able to represent where your application is blocking unlike tools such as sysprof. To enable uprof accounting you must configure Clutter with --enable-profile and have uprof-0.2 installed from git://git.moblin.org/uprof If you want to see a report of statistics when Clutter applications exit you should export CLUTTER_PROFILE_OUTPUT_REPORT=1 before running them. Just a final word of caution; this stuff is new and the manual nature of adding uprof instrumentation means it is prone to some errors when modifying code. This just means that when you question strange results don't rule out a mistake in the instrumentation. Obviously though we hope the benfits out weigh e.g. by focusing on very key stats and by having automatic reporting.
This commit is contained in:
@ -46,6 +46,7 @@
|
||||
#include "clutter-fixed.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-profile.h"
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
@ -302,10 +303,24 @@ _clutter_backend_redraw (ClutterBackend *backend,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
CLUTTER_STATIC_COUNTER (redraw_counter,
|
||||
"_clutter_backend_redraw counter",
|
||||
"Increments for each _clutter_backend_redraw call",
|
||||
0 /* no application private data */);
|
||||
CLUTTER_STATIC_TIMER (redraw_timer,
|
||||
"Mainloop", /* parent */
|
||||
"Redrawing",
|
||||
"The time spent redrawing everything",
|
||||
0 /* no application private data */);
|
||||
|
||||
CLUTTER_COUNTER_INC (_clutter_uprof_context, redraw_counter);
|
||||
CLUTTER_TIMER_START (_clutter_uprof_context, redraw_timer);
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (G_LIKELY (klass->redraw))
|
||||
klass->redraw (backend, stage);
|
||||
|
||||
CLUTTER_TIMER_STOP (_clutter_uprof_context, redraw_timer);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
Reference in New Issue
Block a user