{NULL,}
};
+static gboolean
+parse_time_values (const gchar * line, GstClockTime * local_1,
+ GstClockTime * remote_1, GstClockTime * remote_2, GstClockTime * local_2)
+{
+ gchar **split;
+ gboolean ret = FALSE;
+
+ if (!line)
+ return FALSE;
+
+ split = g_strsplit (line, " ", -1);
+
+ if (g_strv_length (split) != 4)
+ goto out;
+
+ if (!g_ascii_string_to_unsigned (split[0], 10, 0, G_MAXUINT64, local_1, NULL))
+ goto out;
+
+ if (!g_ascii_string_to_unsigned (split[1], 10, 0, G_MAXUINT64, remote_1,
+ NULL))
+ goto out;
+
+ if (!g_ascii_string_to_unsigned (split[2], 10, 0, G_MAXUINT64, remote_2,
+ NULL))
+ goto out;
+
+ if (!g_ascii_string_to_unsigned (split[3], 10, 0, G_MAXUINT64, local_2, NULL))
+ goto out;
+
+ ret = TRUE;
+out:
+ g_strfreev (split);
+ return ret;
+}
+
int
main (int argc, char *argv[])
{
while ((status = g_io_channel_read_line (channel, &line, NULL, NULL,
&error)) == G_IO_STATUS_NORMAL) {
- GstClockTime local_1, local_2, remote_1, remote_2;
+ GstClockTime local_1, remote_1, remote_2, local_2;
GstMessage *message;
- if (sscanf (line, "%" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %"
- G_GUINT64_FORMAT " %" G_GUINT64_FORMAT, &local_1, &remote_1,
- &remote_2, &local_2) != 4) {
+ if (!parse_time_values (line, &local_1, &remote_1, &remote_2, &local_2)) {
g_print ("Failed to get local/remote time values from: %s\n", line);
goto done;
}
printf (" %-45s:", fullname);
if (stats->recv_buffers)
- printf (" buffers in/out %7u", stats->recv_buffers);
+ g_print (" buffers in/out %7u", stats->recv_buffers);
else
- printf (" buffers in/out %7s", "-");
+ g_print (" buffers in/out %7s", "-");
if (stats->sent_buffers)
- printf ("/%7u", stats->sent_buffers);
+ g_print ("/%7u", stats->sent_buffers);
else
- printf ("/%7s", "-");
+ g_print ("/%7s", "-");
if (stats->recv_bytes)
- printf (" bytes in/out %12" G_GUINT64_FORMAT, stats->recv_bytes);
+ g_print (" bytes in/out %12" G_GUINT64_FORMAT, stats->recv_bytes);
else
- printf (" bytes in/out %12s", "-");
+ g_print (" bytes in/out %12s", "-");
if (stats->sent_bytes)
- printf ("/%12" G_GUINT64_FORMAT, stats->sent_bytes);
+ g_print ("/%12" G_GUINT64_FORMAT, stats->sent_bytes);
else
printf ("/%12s", "-");
- printf (" first activity %" GST_TIME_FORMAT ", "
+ g_print (" first activity %" GST_TIME_FORMAT ", "
" ev/msg/qry sent %5u/%5u/%5u\n", GST_TIME_ARGS (stats->first_ts),
stats->num_events, stats->num_messages, stats->num_queries);
}
guint num_threads = g_hash_table_size (threads);
/* print overall stats */
- puts ("\nOverall Statistics:");
- printf ("Number of Threads: %u\n", num_threads);
- printf ("Number of Elements: %u\n", num_elements - num_bins);
- printf ("Number of Bins: %u\n", num_bins);
- printf ("Number of Pads: %u\n", num_pads - num_ghostpads);
- printf ("Number of GhostPads: %u\n", num_ghostpads);
- printf ("Number of Buffers passed: %" G_GUINT64_FORMAT "\n", num_buffers);
- printf ("Number of Events sent: %" G_GUINT64_FORMAT "\n", num_events);
- 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));
+ g_print ("\nOverall Statistics:\n");
+ g_print ("Number of Threads: %u\n", num_threads);
+ g_print ("Number of Elements: %u\n", num_elements - num_bins);
+ g_print ("Number of Bins: %u\n", num_bins);
+ g_print ("Number of Pads: %u\n", num_pads - num_ghostpads);
+ g_print ("Number of GhostPads: %u\n", num_ghostpads);
+ g_print ("Number of Buffers passed: %" G_GUINT64_FORMAT "\n", num_buffers);
+ g_print ("Number of Events sent: %" G_GUINT64_FORMAT "\n", num_events);
+ g_print ("Number of Message sent: %" G_GUINT64_FORMAT "\n", num_messages);
+ g_print ("Number of Queries sent: %" G_GUINT64_FORMAT "\n", num_queries);
+ g_print ("Time: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (last_ts));
if (have_cpuload) {
- printf ("Avg CPU load: %4.1f %%\n", (gfloat) total_cpuload / 10.0);
+ g_print ("Avg CPU load: %4.1f %%\n", (gfloat) total_cpuload / 10.0);
}
- puts ("");
+ g_print ("\n");
/* thread stats */
if (num_threads) {