static guint num_elements = 0, num_bins = 0, num_pads = 0, num_ghostpads = 0;
static GstClockTime last_ts = G_GUINT64_CONSTANT (0);
static guint total_cpuload = 0;
+static gboolean have_cpuload = FALSE;
typedef struct
{
if (G_UNLIKELY (!stats)) {
stats = g_slice_new0 (GstThreadStats);
+ stats->tthread = GST_CLOCK_TIME_NONE;
g_hash_table_insert (threads, GUINT_TO_POINTER (id), stats);
}
return stats;
gst_structure_get (s, "ts", G_TYPE_UINT64, &ts,
"average-cpuload", G_TYPE_UINT, &total_cpuload, NULL);
last_ts = MAX (last_ts, ts);
+ have_cpuload = TRUE;
}
/* reporting */
return;
printf ("Thread %p Statistics:\n", key);
- printf (" Time: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (stats->tthread));
- printf (" Avg CPU load: %u %%\n", stats->cpuload);
+ if (GST_CLOCK_TIME_IS_VALID (stats->tthread)) {
+ printf (" Time: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (stats->tthread));
+ printf (" Avg CPU load: %4.1f %%\n", (gfloat) stats->cpuload / 10.0);
+ }
puts (" Pad Statistics:");
g_slist_foreach (node, print_pad_stats, key);
printf ("Number of Message sent: %" G_GUINT64_FORMAT "\n", num_messages);
printf ("Number of Queries sent: %" G_GUINT64_FORMAT "\n", num_queries);
printf ("Time: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (last_ts));
- printf ("Avg CPU load: %u %%\n", (guint) total_cpuload);
+ if (have_cpuload) {
+ printf ("Avg CPU load: %4.1f %%\n", (gfloat) total_cpuload / 10.0);
+ }
puts ("");
/* thread stats */