mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
- basic arch check for HAVE_RDTSC
Original commit message from CVS: - basic arch check for HAVE_RDTSC - use common gst_trace_read_tsc() for RDTSC call - add untested function to do ascii dump of trace data
This commit is contained in:
parent
1d9a7781d4
commit
a164187503
6 changed files with 54 additions and 42 deletions
|
@ -21,6 +21,8 @@
|
||||||
#undef HAVE_CPU_ARM
|
#undef HAVE_CPU_ARM
|
||||||
#undef HAVE_CPU_SPARC
|
#undef HAVE_CPU_SPARC
|
||||||
|
|
||||||
|
#undef HAVE_RDTSC
|
||||||
|
|
||||||
#undef HAVE_GDK_PIXBUF
|
#undef HAVE_GDK_PIXBUF
|
||||||
#undef HAVE_LIBGHTTP
|
#undef HAVE_LIBGHTTP
|
||||||
#undef HAVE_LIBMMX
|
#undef HAVE_LIBMMX
|
||||||
|
|
30
configure.in
30
configure.in
|
@ -117,16 +117,22 @@ dnl ==============================================
|
||||||
|
|
||||||
dnl Determine CPU
|
dnl Determine CPU
|
||||||
case "x${target_cpu}" in
|
case "x${target_cpu}" in
|
||||||
xi?86) HAVE_CPU_I386=yes ;
|
xi?86 | k?) HAVE_CPU_I386=yes
|
||||||
AC_DEFINE(HAVE_CPU_I386) ;;
|
AC_DEFINE(HAVE_CPU_I386)
|
||||||
xpowerpc) HAVE_CPU_PPC=yes ;
|
dnl FIXME could use some better detection
|
||||||
AC_DEFINE(HAVE_CPU_PPC) ;;
|
dnl (ie CPUID)
|
||||||
xalpha) HAVE_CPU_ALPHA=yes ;
|
case "x${target_cpu}" in
|
||||||
AC_DEFINE(HAVE_CPU_ALPHA) ;;
|
xi386 | xi486) ;;
|
||||||
xarm*) HAVE_CPU_ARM=yes ;
|
*) AC_DEFINE(HAVE_RDTSC) ;;
|
||||||
AC_DEFINE(HAVE_CPU_ARM) ;;
|
esac ;;
|
||||||
xsparc*) HAVE_CPU_SPARC=yes ;
|
xpowerpc) HAVE_CPU_PPC=yes
|
||||||
AC_DEFINE(HAVE_CPU_SPARC) ;;
|
AC_DEFINE(HAVE_CPU_PPC) ;;
|
||||||
|
xalpha) HAVE_CPU_ALPHA=yes
|
||||||
|
AC_DEFINE(HAVE_CPU_ALPHA) ;;
|
||||||
|
xarm*) HAVE_CPU_ARM=yes
|
||||||
|
AC_DEFINE(HAVE_CPU_ARM) ;;
|
||||||
|
xsparc*) HAVE_CPU_SPARC=yes
|
||||||
|
AC_DEFINE(HAVE_CPU_SPARC) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dnl Determine endianness
|
dnl Determine endianness
|
||||||
|
@ -720,6 +726,10 @@ if test "x$HAVE_LINUX_VIDEODEV" = xyes; then
|
||||||
AC_DEFINE(HAVE_LINUX_VIDEODEV)
|
AC_DEFINE(HAVE_LINUX_VIDEODEV)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "x$HAVE_MPEG2DEC" = xyes; then
|
||||||
|
AC_DEFINE(HAVE_MPEG2DEC)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl #############################
|
dnl #############################
|
||||||
dnl # Set automake conditionals #
|
dnl # Set automake conditionals #
|
||||||
dnl #############################
|
dnl #############################
|
||||||
|
|
|
@ -33,18 +33,15 @@
|
||||||
#include "gsttrace.h"
|
#include "gsttrace.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_RDTS
|
|
||||||
__inline__ void read_tsc(guint64 *dst) {
|
__inline__ void read_tsc(guint64 *dst) {
|
||||||
__asm__ __volatile__
|
#ifdef HAVE_RDTSC
|
||||||
("rdtsc"
|
guint64 tsc;
|
||||||
: "=a" (*(guint32 *)dst), "=d" (*(((guint32 *)dst) + 1))
|
__asm__ __volatile__ ("rdtsc" : "=A" (tsc));
|
||||||
:
|
*dst = tsc;
|
||||||
: "eax", "edx");
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
__inline__ void read_tsc(guint64 *dst) {
|
*dst = 0;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void gst_trace_read_tsc(guint64 *dst) {
|
void gst_trace_read_tsc(guint64 *dst) {
|
||||||
read_tsc(dst);
|
read_tsc(dst);
|
||||||
|
@ -91,6 +88,27 @@ void gst_trace_flush(GstTrace *trace) {
|
||||||
trace->bufoffset = 0;
|
trace->bufoffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gst_trace_text_flush(GstTrace *trace) {
|
||||||
|
int i;
|
||||||
|
const int strsize = 20+1 + 10+1 + 10+1 + 112+1 + 1;
|
||||||
|
char str[strsize];
|
||||||
|
|
||||||
|
if (!trace) {
|
||||||
|
trace = _gst_trace_default;
|
||||||
|
if (!trace ) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<trace->bufoffset; i++) {
|
||||||
|
snprintf(str, strsize, "%20lld %10d %10d %s\n",
|
||||||
|
trace->buf[i].timestamp,
|
||||||
|
trace->buf[i].sequence,
|
||||||
|
trace->buf[i].data,
|
||||||
|
trace->buf[i].message);
|
||||||
|
write(trace->fd,str,strlen(str));
|
||||||
|
}
|
||||||
|
trace->bufoffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void gst_trace_set_default(GstTrace *trace) {
|
void gst_trace_set_default(GstTrace *trace) {
|
||||||
g_return_if_fail(trace != NULL);
|
g_return_if_fail(trace != NULL);
|
||||||
_gst_trace_default = trace;
|
_gst_trace_default = trace;
|
||||||
|
|
|
@ -52,6 +52,7 @@ GstTrace* gst_trace_new (guchar *filename, gint size);
|
||||||
|
|
||||||
void gst_trace_destroy (GstTrace *trace);
|
void gst_trace_destroy (GstTrace *trace);
|
||||||
void gst_trace_flush (GstTrace *trace);
|
void gst_trace_flush (GstTrace *trace);
|
||||||
|
void gst_trace_text_flush (GstTrace *trace);
|
||||||
#define gst_trace_get_size(trace) ((trace)->bufsize)
|
#define gst_trace_get_size(trace) ((trace)->bufsize)
|
||||||
#define gst_trace_get_offset(trace) ((trace)->bufoffset)
|
#define gst_trace_get_offset(trace) ((trace)->bufoffset)
|
||||||
#define gst_trace_get_remaining(trace) ((trace)->bufsize - (trace)->bufoffset)
|
#define gst_trace_get_remaining(trace) ((trace)->bufsize - (trace)->bufoffset)
|
||||||
|
|
|
@ -39,20 +39,6 @@ char * meets (double val, double limit)
|
||||||
return ((fabs(val) <= limit) ? "meets" : "FAILS");
|
return ((fabs(val) <= limit) ? "meets" : "FAILS");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_RDTS
|
|
||||||
__inline__ void read_tsc(guint64 *dst) {
|
|
||||||
__asm__ __volatile__
|
|
||||||
("rdtsc"
|
|
||||||
: "=a" (*(guint32 *)dst), "=d" (*(((guint32 *)dst) + 1))
|
|
||||||
:
|
|
||||||
: "eax", "edx");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
__inline__ void read_tsc(guint64 *dst) {
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -128,9 +114,9 @@ main(int argc, char **argv)
|
||||||
memcpy(testout, refcoefs, sizeof(DCTELEM)*DCTSIZE2);
|
memcpy(testout, refcoefs, sizeof(DCTELEM)*DCTSIZE2);
|
||||||
}
|
}
|
||||||
|
|
||||||
read_tsc(&tscstart);
|
gst_trace_read_tsc(&tscstart);
|
||||||
gst_idct_convert(idct, testout);
|
gst_idct_convert(idct, testout);
|
||||||
read_tsc(&tscstop);
|
gst_trace_read_tsc(&tscstop);
|
||||||
//printf("time %llu, %llu %lld\n", tscstart, tscstop, tscstop-tscstart);
|
//printf("time %llu, %llu %lld\n", tscstart, tscstop, tscstop-tscstart);
|
||||||
if (tscstop - tscstart < tscmin) tscmin = tscstop-tscstart;
|
if (tscstop - tscstart < tscmin) tscmin = tscstop-tscstart;
|
||||||
if (tscstop - tscstart > tscmax) tscmax = tscstop-tscstart;
|
if (tscstop - tscstart > tscmax) tscmax = tscstop-tscstart;
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define rdtscll(result) \
|
|
||||||
__asm__ __volatile__("rdtsc" : "=A" (result) : /* No inputs */ )
|
|
||||||
|
|
||||||
static guint64 max = 0, min = -1, total = 0;
|
static guint64 max = 0, min = -1, total = 0;
|
||||||
static guint count = 0;
|
static guint count = 0;
|
||||||
static guint print_del = 1;
|
static guint print_del = 1;
|
||||||
|
@ -11,16 +8,14 @@ static guint iterations = 0;
|
||||||
static guint mhz = 0;
|
static guint mhz = 0;
|
||||||
|
|
||||||
void handoff_src(GstElement *src, GstBuffer *buf, gpointer user_data) {
|
void handoff_src(GstElement *src, GstBuffer *buf, gpointer user_data) {
|
||||||
guint64 start;
|
gst_trace_read_tsc(&GST_BUFFER_TIMESTAMP(buf));
|
||||||
rdtscll(start);
|
|
||||||
GST_BUFFER_TIMESTAMP(buf) = start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handoff_sink(GstElement *sink, GstBuffer *buf, gpointer user_data) {
|
void handoff_sink(GstElement *sink, GstBuffer *buf, gpointer user_data) {
|
||||||
guint64 end, d, avg;
|
guint64 end, d, avg;
|
||||||
guint avg_ns;
|
guint avg_ns;
|
||||||
|
|
||||||
rdtscll(end);
|
gst_trace_read_tsc(&end);
|
||||||
d = end - GST_BUFFER_TIMESTAMP(buf);
|
d = end - GST_BUFFER_TIMESTAMP(buf);
|
||||||
if (d > max) max = d;
|
if (d > max) max = d;
|
||||||
if (d < min) min = d;
|
if (d < min) min = d;
|
||||||
|
|
Loading…
Reference in a new issue