Commit Graph

8 Commits

Author SHA1 Message Date
Emmanuele Bassi
2bf5e89140 Fix fallback profile counter macro 2012-03-22 12:00:55 +00:00
Emmanuele Bassi
e3aea910b1 Try to avoid duplicate declarations for profile macros
We can use the __COUNTER__ macro or, failing that, the __LINE__ macro to
ensure that we don't declare dummy variables more than once with the
same name.
2012-03-07 12:36:42 +00:00
Emmanuele Bassi
8a4dc3c011 debug: Clean up profile/debug symbols
Since we have a _clutter_debug_message() function compiled in
unconditionally we have no further need for the equivalent conditional
version defined in clutter-profile.[ch]: we can simply do the work in
one function.
2011-11-18 17:44:42 +00:00
Emmanuele Bassi
59f395d856 Rework debug output
Make it consistent across the various build options (with or without
profiling enabled), and add a timestamp using the monotonic clock to
every debug message.
2011-11-15 17:39:49 +00:00
Robert Bragg
fb7bf9ce02 profile: Update to uprof-0.3 dep for --enable-profile
When building with --enable-profile we now depend on the uprof-0.3
developer release which brings a few improvements:

» It lets us "fix" how we initialize uprof so that instead of using a shared
object constructor/destructor (which was a hack used when first adding
uprof support to Clutter) we can now initialize as part of clutter's
normal initialization code. As a side note though, I found that the way
Clutter initializes has some quite serious problems whenever it
involves GOptionGroups. It is not able to guarantee the initialization
of dependencies like uprof and Cogl. For this reason we still use the
contructor/destructor approach to initialize uprof in Cogl.

» uprof-0.3 provides a better API for adding custom columns when reporting
timer and counter statistics which lets us remove quite a lot of manual
report generation code in clutter-profile.c.

» uprof-0.3 provides a shared context for tracking mainloop timer
statistics. This means any mainloop based library following the same
"Mainloop" timer naming convention can use the shared context and no
matter who ends up owning the final mainloop the statistics will always
be in the same place. This allows profiling of Clutter with an
external mainloop such as with the Mutter compositor.

» uprof-0.3 can export statistics over dbus and comes with an ncurses
based ui to vizualize timer and counter stats live.

The latest version of uprof can be cloned from:
git://github.com/rib/UProf.git
2010-09-14 12:43:16 +01:00
Robert Bragg
0b6515a1d5 profiling: Allow limiting statisics just to picking
This suspends and resumes all uprof timers and counters except while dealing
with picking, so as to give more focused statistics.

Be aware that there are still some issues with this profile option since
there are a few special case counters and timers that shouldn't be
suspended; noteably the frame counters are incorrect so the per frame stats
can't be trusted.
2010-01-08 20:19:50 +00:00
Robert Bragg
9cb530d42e profiling: Parse --clutter-profile and CLUTTER_PROFILE= options
As we have for debugging, this adds the ability to control profiling flags
either via the command line or an environment variable.

The first option added is CLUTTER_PROFILE=disable-report

This also changes the reporting to be opt-out so you don't need to export
CLUTTER_PROFILE_OUTPUT_REPORT=1 to see a report but you can use
CLUTTER_PROFILE=disable-report to disable it if desired.
2010-01-08 20:19:50 +00:00
Robert Bragg
0057755854 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.
2010-01-08 20:19:49 +00:00