tracers: add metadata for the logged values
authorStefan Sauer <ensonic@users.sf.net>
Fri, 12 Sep 2014 06:40:01 +0000 (08:40 +0200)
committerStefan Sauer <ensonic@users.sf.net>
Mon, 5 Oct 2015 18:59:39 +0000 (20:59 +0200)
plugins/tracers/gstlatency.c
plugins/tracers/gstrusage.c
plugins/tracers/gststats.c

index 6e2ac3bfac405effe9a1d97236b3aa38d0d0d64b..4467a19322b1af6afaa5bec2a3088de0747b83ea 100644 (file)
@@ -102,6 +102,26 @@ gst_latency_tracer_class_init (GstLatencyTracerClass * klass)
   latency_probe_id = g_quark_from_static_string ("latency_probe.id");
   latency_probe_pad = g_quark_from_static_string ("latency_probe.pad");
   latency_probe_ts = g_quark_from_static_string ("latency_probe.ts");
+
+  /* announce trace formats */
+  /* *INDENT-OFF* */
+  gst_tracer_log_trace (gst_structure_new ("latency.class",
+      "src", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "pad",  /* TODO: use genum */
+          NULL),
+      "sink", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "pad",  /* TODO: use genum */
+          NULL),
+      "time", GST_TYPE_STRUCTURE, gst_structure_new ("value",
+          "type", G_TYPE_GTYPE, G_TYPE_UINT64,
+          "description", G_TYPE_STRING,
+              "time it took for the buffer to go from src to sink ns",
+          "flags", G_TYPE_STRING, "aggregated",  /* TODO: use gflags */ 
+          "min", G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
+          "max", G_TYPE_UINT64, G_MAXUINT64,
+          NULL),
+      NULL));
+  /* *INDENT-ON* */
 }
 
 static void
index 42be6aafbb5e10b836a9644099398ee745a3b369..dec2d3179ad58e66305cb64bdaf4f314cb950298 100644 (file)
@@ -195,52 +195,52 @@ gst_rusage_tracer_init (GstRUsageTracer * self)
   /* *INDENT-OFF* */
   gst_tracer_log_trace (gst_structure_new ("thread-rusage.class",
       "thread-id", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
-          "related-to", G_TYPE_STRING, "thread",  // use genum
+          "related-to", G_TYPE_STRING, "thread",  /* TODO: use genum */
           NULL),
       "average-cpuload", GST_TYPE_STRUCTURE, gst_structure_new ("value",
           "type", G_TYPE_GTYPE, G_TYPE_UINT,
           "description", G_TYPE_STRING, "average cpu usage per thread in ‰",
-          "flags", G_TYPE_STRING, "aggregated",  // use gflags 
+          "flags", G_TYPE_STRING, "aggregated",  /* TODO: use gflags */ 
           "min", G_TYPE_UINT, 0, 
           "max", G_TYPE_UINT, 1000,
           NULL),
       "current-cpuload", GST_TYPE_STRUCTURE, gst_structure_new ("value",
           "type", G_TYPE_GTYPE, G_TYPE_UINT,
           "description", G_TYPE_STRING, "current cpu usage per thread in ‰",
-          "flags", G_TYPE_STRING, "windowed",  // use gflags 
+          "flags", G_TYPE_STRING, "windowed",  /* TODO: use gflags */ 
           "min", G_TYPE_UINT, 0, 
           "max", G_TYPE_UINT, 1000,
           NULL),
       "time", GST_TYPE_STRUCTURE, gst_structure_new ("value",
           "type", G_TYPE_GTYPE, G_TYPE_UINT64,
-          "description", G_TYPE_STRING, "time spent in thread",
-          "flags", G_TYPE_STRING, "aggregated",  // use gflags 
+          "description", G_TYPE_STRING, "time spent in thread in ns",
+          "flags", G_TYPE_STRING, "aggregated",  /* TODO: use gflags */ 
           "min", G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
           "max", G_TYPE_UINT64, G_MAXUINT64,
           NULL),
       NULL));
   gst_tracer_log_trace (gst_structure_new ("proc-rusage.class",
       "thread-id", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
-          "related-to", G_TYPE_STRING, "process",  // use genum
+          "related-to", G_TYPE_STRING, "process",  /* TODO: use genum */
           NULL),
       "average-cpuload", GST_TYPE_STRUCTURE, gst_structure_new ("value",
           "type", G_TYPE_GTYPE, G_TYPE_UINT,
           "description", G_TYPE_STRING, "average cpu usage per process in ‰",
-          "flags", G_TYPE_STRING, "aggregated",  // use gflags 
+          "flags", G_TYPE_STRING, "aggregated",  /* TODO: use gflags */ 
           "min", G_TYPE_UINT, 0, 
           "max", G_TYPE_UINT, 1000,
           NULL),
       "current-cpuload", GST_TYPE_STRUCTURE, gst_structure_new ("value",
           "type", G_TYPE_GTYPE, G_TYPE_UINT,
           "description", G_TYPE_STRING, "current cpu usage per process in ‰",
-          "flags", G_TYPE_STRING, "windowed",  // use gflags 
+          "flags", G_TYPE_STRING, "windowed",  /* TODO: use gflags */ 
           "min", G_TYPE_UINT, 0, 
           "max", G_TYPE_UINT, 1000,
           NULL),
       "time", GST_TYPE_STRUCTURE, gst_structure_new ("value",
           "type", G_TYPE_GTYPE, G_TYPE_UINT64,
-          "description", G_TYPE_STRING, "time spent in process",
-          "flags", G_TYPE_STRING, "aggregated",  // use gflags 
+          "description", G_TYPE_STRING, "time spent in process in ns",
+          "flags", G_TYPE_STRING, "aggregated",  /* TODO: use gflags */ 
           "min", G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
           "max", G_TYPE_UINT64, G_MAXUINT64,
           NULL),
index 384a0ecd2e0f48ca9627c3822ea7658c13cec4cd..041975a251925065ecd4f14c2adfd0185e6b3f35 100644 (file)
@@ -251,6 +251,7 @@ do_buffer_stats (GstStatsTracer * self, GstPad * this_pad,
           "peer-pad-ix", G_TYPE_UINT, that_pad_stats->index,
           "peer-elem-ix", G_TYPE_UINT, that_elem_stats->index,
           "buffer-size", G_TYPE_UINT, gst_buffer_get_size (buf),
+          /* TODO(ensonic): do PTS and DTS */
           "buffer-ts", G_TYPE_UINT64, GST_BUFFER_TIMESTAMP (buf),
           "buffer-duration", G_TYPE_UINT64, GST_BUFFER_DURATION (buf),
           "buffer-flags", GST_TYPE_BUFFER_FLAGS, GST_BUFFER_FLAGS (buf),
@@ -360,6 +361,79 @@ gst_stats_tracer_init (GstStatsTracer * self)
       GST_TRACER_HOOK_MESSAGES | GST_TRACER_HOOK_QUERIES, NULL);
   self->elements = g_ptr_array_new_with_free_func (free_element_stats);
   self->pads = g_ptr_array_new_with_free_func (free_pad_stats);
+
+  /* announce trace formats */
+  /* *INDENT-OFF* */
+  gst_tracer_log_trace (gst_structure_new ("buffer.class",
+      "pad-ix", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "pad",  /* TODO: use genum */
+          NULL),
+      "element-ix", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "element",  /* TODO: use genum */
+          NULL),
+      "peer-pad-ix", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "pad",  /* TODO: use genum */
+          NULL),
+      "peer-element-ix", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "element",  /* TODO: use genum */
+          NULL),
+      "buffer-size", GST_TYPE_STRUCTURE, gst_structure_new ("value",
+          "type", G_TYPE_GTYPE, G_TYPE_UINT,
+          "description", G_TYPE_STRING, "size of buffer in bytes",
+          "flags", G_TYPE_STRING, "",  /* TODO: use gflags */ 
+          "min", G_TYPE_UINT, 0, 
+          "max", G_TYPE_UINT, G_MAXUINT,
+          NULL),
+      "buffer-ts", GST_TYPE_STRUCTURE, gst_structure_new ("value",
+          "type", G_TYPE_GTYPE, G_TYPE_UINT64,
+          "description", G_TYPE_STRING, "timestamp of the buffer in ns",
+          "flags", G_TYPE_STRING, "",  /* TODO: use gflags */ 
+          "min", G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
+          "max", G_TYPE_UINT64, G_MAXUINT64,
+          NULL),
+      "buffer-duration", GST_TYPE_STRUCTURE, gst_structure_new ("value",
+          "type", G_TYPE_GTYPE, G_TYPE_UINT64,
+          "description", G_TYPE_STRING, "duration of the buffer in ns",
+          "flags", G_TYPE_STRING, "",  /* TODO: use gflags */ 
+          "min", G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
+          "max", G_TYPE_UINT64, G_MAXUINT64,
+          NULL),
+      /* TODO(ensonic): "buffer-flags" */
+      NULL));
+  gst_tracer_log_trace (gst_structure_new ("event.class",
+      "pad-ix", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "pad",  /* TODO: use genum */
+          NULL),
+      "element-ix", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "element",  /* TODO: use genum */
+          NULL),
+      "name", GST_TYPE_STRUCTURE, gst_structure_new ("value",
+          "type", G_TYPE_GTYPE, G_TYPE_STRING,
+          "description", G_TYPE_STRING, "name of the event",
+          "flags", G_TYPE_STRING, "",  /* TODO: use gflags */ 
+          NULL),
+      NULL));
+  gst_tracer_log_trace (gst_structure_new ("message.class",
+      "element-ix", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "element",  /* TODO: use genum */
+          NULL),
+      "name", GST_TYPE_STRUCTURE, gst_structure_new ("value",
+          "type", G_TYPE_GTYPE, G_TYPE_STRING,
+          "description", G_TYPE_STRING, "name of the message",
+          "flags", G_TYPE_STRING, "",  /* TODO: use gflags */ 
+          NULL),
+      NULL));
+  gst_tracer_log_trace (gst_structure_new ("query.class",
+      "element-ix", GST_TYPE_STRUCTURE, gst_structure_new ("scope",
+          "related-to", G_TYPE_STRING, "element",  /* TODO: use genum */
+          NULL),
+      "name", GST_TYPE_STRUCTURE, gst_structure_new ("value",
+          "type", G_TYPE_GTYPE, G_TYPE_STRING,
+          "description", G_TYPE_STRING, "name of the query",
+          "flags", G_TYPE_STRING, "",  /* TODO: use gflags */ 
+          NULL),
+      NULL));
+  /* *INDENT-ON* */
 }
 
 /* hooks */