summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2014-07-15 10:20:22 +0200
committerStefan Sauer <ensonic@users.sf.net>2015-10-05 20:59:39 +0200
commitff7ba1eb8dbc596a9f4988cb78cded527c7f97b3 (patch)
tree4e5ceb041e887fa3249d172f22b0e34f4912fdad /tools
parent0c26387e625697fb7a7efd3404463f59982fb89a (diff)
gst-stats: filter complete thread section if we have no pads
Diffstat (limited to 'tools')
-rw-r--r--tools/gst-stats.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/tools/gst-stats.c b/tools/gst-stats.c
index ba3c803ca..9ed50a043 100644
--- a/tools/gst-stats.c
+++ b/tools/gst-stats.c
@@ -372,7 +372,11 @@ 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;
+ if ((stats->thread_id == GPOINTER_TO_UINT (user_data)) &&
+ (stats->num_buffers)) {
+ return 0;
+ }
+ return 1;
}
static void
@@ -416,7 +420,13 @@ print_pad_stats (gpointer value, gpointer user_data)
static void
print_thread_stats (gpointer key, gpointer value, gpointer user_data)
{
- GSList *list = user_data, *node;
+ GSList *list = user_data;
+ GSList *node = g_slist_find_custom (list, key, find_pad_stats_for_thread);
+
+ /* skip stats if there are no pads for that thread (e.g. a pipeline) */
+ if (!node)
+ return;
+
#if 0
GstThreadStats *stats = (GstThreadStats *) value;
guint cpuload = 0;
@@ -442,11 +452,9 @@ print_thread_stats (gpointer key, gpointer value, gpointer user_data)
(guint) time_percent);
printf (" Avg/Max CPU load: %u %%, %u %%\n", cpuload, stats->max_cpuload);
#endif
- /* 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);
- }
+
+ puts (" Pad Statistics:");
+ g_slist_foreach (node, print_pad_stats, key);
}
static void