uprof-context

uprof-context — Group counters and timers by application/library domains

Synopsis

                    UProfContext;
UProfContext *      uprof_context_new                   (const char *name);
UProfContext *      uprof_context_ref                   (UProfContext *context);
void                uprof_context_unref                 (UProfContext *context);
const char *        uprof_context_get_name              (UProfContext *context);
void                uprof_context_add_counter           (UProfContext *context,
                                                         UProfCounter *counter);
void                uprof_context_add_timer             (UProfContext *context,
                                                         UProfTimer *timer);
void                uprof_context_add_report_message    (UProfContext *context,
                                                         const char *format,
                                                         ...);
void                uprof_context_link                  (UProfContext *context,
                                                         UProfContext *other);
void                uprof_context_unlink                (UProfContext *context,
                                                         UProfContext *other);
void                uprof_context_suspend               (UProfContext *context);
void                uprof_context_resume                (UProfContext *context);
void                (*UProfCounterResultCallback)       (UProfCounterResult *counter,
                                                         gpointer data);
void                uprof_context_foreach_counter       (UProfContext *context,
                                                         GCompareDataFunc sort_compare_func,
                                                         UProfCounterResultCallback callback,
                                                         gpointer data);
UProfCounterResult * uprof_context_get_counter_result   (UProfContext *context,
                                                         const char *name);
void                (*UProfTimerResultCallback)         (UProfTimerResult *timer,
                                                         gpointer data);
void                uprof_context_foreach_timer         (UProfContext *context,
                                                         GCompareDataFunc sort_compare_func,
                                                         UProfTimerResultCallback callback,
                                                         gpointer data);
UProfTimerResult *  uprof_context_get_timer_result      (UProfContext *context,
                                                         const char *name);
void                (*UProfMessageCallback)             (const char *message,
                                                         gpointer user_data);
void                uprof_context_foreach_message       (UProfContext *context,
                                                         UProfMessageCallback callback,
                                                         gpointer user_data);

Description

All statistics tracked by UProf are associated with a named context which usually corresponds to a single application or library.

Contexts can be linked together at runtime if you want to report relationships between the statistics between different libraries and applications and because this is linking mechanism is done at runtime it avoids the awkwardness of having to export special profiling symbols from your libraries.

A typical application would declare a single uprof context symbol that is visible accross the whole application. So in a header you could have:

1
2
3
4