From bc3ea27c3bb80986fb31679e67e0bbd1376e6db3 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 5 Jan 2002 02:04:28 +0000 Subject: [PATCH] added lat.c, thanks to MattyBoy Original commit message from CVS: added lat.c, thanks to MattyBoy --- tests/lat.c | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 tests/lat.c diff --git a/tests/lat.c b/tests/lat.c new file mode 100644 index 0000000000..b246ffafd9 --- /dev/null +++ b/tests/lat.c @@ -0,0 +1,216 @@ +#include +#include + +/* FIXME: WTF does this do? */ + +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) { + gst_trace_read_tsc(&GST_BUFFER_TIMESTAMP(buf)); +} + +void handoff_sink(GstElement *sink, GstBuffer *buf, gpointer user_data) { + guint64 end, d, avg; + guint avg_ns; + + gst_trace_read_tsc(&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; + char buf[20]; + + last = first; + + for (i=0; i