#include #include #define rdtscll(result) \ __asm__ __volatile__("rdtsc" : "=A" (result) : /* No inputs */ ) static guint64 max = 0, min = -1, total = 0; static guint count = 0; static guint print_del = 1; static guint iterations = 0; static guint mhz = 0; void handoff_src(GstElement *src, GstBuffer *buf, gpointer user_data) { guint64 start; rdtscll(start); GST_BUFFER_TIMESTAMP(buf) = start; } void handoff_sink(GstElement *sink, GstBuffer *buf, gpointer user_data) { guint64 end, d, avg; guint avg_ns; rdtscll(end); d = end - GST_BUFFER_TIMESTAMP(buf); if (d > max) max = d; if (d < min) min = d; total += d; count++; avg = total/count; avg_ns = (guint)(1000.0*(double)avg/(double)mhz); if ((count % print_del) == 0) { g_print("%07d:%08lld min:%08lld max:%08lld avg:%08lld avg-s:0.%09d\r", count, d, min, max, avg, avg_ns); } } GstElement *identity_add(GstPipeline *pipeline, GstElement *first, int count) { GstElement *last, *ident; int i; last = first; for (i=0; i