/* 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)
{
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;
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