mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
stats: print thread key for stats and filter empty pad-sections
This commit is contained in:
parent
f8390caf2c
commit
81e617fa70
1 changed files with 16 additions and 7 deletions
|
@ -363,6 +363,14 @@ do_query_stats (GstStructure * s)
|
|||
|
||||
/* reporting */
|
||||
|
||||
static gint
|
||||
find_pad_stats_for_thread (gconstpointer value, gconstpointer user_data)
|
||||
{
|
||||
const GstPadStats *stats = (const GstPadStats *) value;
|
||||
|
||||
return (stats->thread_id == GPOINTER_TO_UINT (user_data)) ? 0 : 1;
|
||||
}
|
||||
|
||||
static void
|
||||
print_pad_stats (gpointer value, gpointer user_data)
|
||||
{
|
||||
|
@ -404,7 +412,7 @@ print_pad_stats (gpointer value, gpointer user_data)
|
|||
static void
|
||||
print_thread_stats (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
GSList *list = user_data;
|
||||
GSList *list = user_data, *node;
|
||||
#if 0
|
||||
GstThreadStats *stats = (GstThreadStats *) value;
|
||||
guint cpuload = 0;
|
||||
|
@ -422,18 +430,19 @@ print_thread_stats (gpointer key, gpointer value, gpointer user_data)
|
|||
total = gst_util_uint64_scale (tusersys, G_GINT64_CONSTANT (100), last_ts);
|
||||
cpuload = gst_util_uint64_scale (total, stats->treal, last_ts);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf ("Thread %p Statistics:\n", key);
|
||||
#if 0
|
||||
printf (" Time: %" GST_TIME_FORMAT ", %u %%\n", GST_TIME_ARGS (stats->treal),
|
||||
(guint) time_percent);
|
||||
printf (" Avg/Max CPU load: %u %%, %u %%\n", cpuload, stats->max_cpuload);
|
||||
#endif
|
||||
/* FIXME: would be nice to skip, if there are no pads for that thread
|
||||
* (e.g. a pipeline), we would need to pass as struct to
|
||||
* g_hash_table_foreach::user_data
|
||||
*/
|
||||
puts (" Pad Statistics:");
|
||||
g_slist_foreach (list, print_pad_stats, key);
|
||||
/* skip stats if there are no pads for that thread (e.g. a pipeline) */
|
||||
if ((node = g_slist_find_custom (list, key, find_pad_stats_for_thread))) {
|
||||
puts (" Pad Statistics:");
|
||||
g_slist_foreach (node, print_pad_stats, key);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue