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_SPARC
|
||||
|
||||
#undef HAVE_RDTSC
|
||||
|
||||
#undef HAVE_GDK_PIXBUF
|
||||
#undef HAVE_LIBGHTTP
|
||||
#undef HAVE_LIBMMX
|
||||
|
|
22
configure.in
22
configure.in
|
@ -117,15 +117,21 @@ dnl ==============================================
|
|||
|
||||
dnl Determine CPU
|
||||
case "x${target_cpu}" in
|
||||
xi?86) HAVE_CPU_I386=yes ;
|
||||
AC_DEFINE(HAVE_CPU_I386) ;;
|
||||
xpowerpc) HAVE_CPU_PPC=yes ;
|
||||
xi?86 | k?) HAVE_CPU_I386=yes
|
||||
AC_DEFINE(HAVE_CPU_I386)
|
||||
dnl FIXME could use some better detection
|
||||
dnl (ie CPUID)
|
||||
case "x${target_cpu}" in
|
||||
xi386 | xi486) ;;
|
||||
*) AC_DEFINE(HAVE_RDTSC) ;;
|
||||
esac ;;
|
||||
xpowerpc) HAVE_CPU_PPC=yes
|
||||
AC_DEFINE(HAVE_CPU_PPC) ;;
|
||||
xalpha) HAVE_CPU_ALPHA=yes ;
|
||||
xalpha) HAVE_CPU_ALPHA=yes
|
||||
AC_DEFINE(HAVE_CPU_ALPHA) ;;
|
||||
xarm*) HAVE_CPU_ARM=yes ;
|
||||
xarm*) HAVE_CPU_ARM=yes
|
||||
AC_DEFINE(HAVE_CPU_ARM) ;;
|
||||
xsparc*) HAVE_CPU_SPARC=yes ;
|
||||
xsparc*) HAVE_CPU_SPARC=yes
|
||||
AC_DEFINE(HAVE_CPU_SPARC) ;;
|
||||
esac
|
||||
|
||||
|
@ -720,6 +726,10 @@ if test "x$HAVE_LINUX_VIDEODEV" = xyes; then
|
|||
AC_DEFINE(HAVE_LINUX_VIDEODEV)
|
||||
fi
|
||||
|
||||
if test "x$HAVE_MPEG2DEC" = xyes; then
|
||||
AC_DEFINE(HAVE_MPEG2DEC)
|
||||
fi
|
||||
|
||||
dnl #############################
|
||||
dnl # Set automake conditionals #
|
||||
dnl #############################
|
||||
|
|
|
@ -33,18 +33,15 @@
|
|||
#include "gsttrace.h"
|
||||
|
||||
|
||||
#ifdef HAVE_RDTS
|
||||
__inline__ void read_tsc(guint64 *dst) {
|
||||
__asm__ __volatile__
|
||||
("rdtsc"
|
||||
: "=a" (*(guint32 *)dst), "=d" (*(((guint32 *)dst) + 1))
|
||||
:
|
||||
: "eax", "edx");
|
||||
}
|
||||
#ifdef HAVE_RDTSC
|
||||
guint64 tsc;
|
||||
__asm__ __volatile__ ("rdtsc" : "=A" (tsc));
|
||||
*dst = tsc;
|
||||
#else
|
||||
__inline__ void read_tsc(guint64 *dst) {
|
||||
}
|
||||
*dst = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void gst_trace_read_tsc(guint64 *dst) {
|
||||
read_tsc(dst);
|
||||
|
@ -91,6 +88,27 @@ void gst_trace_flush(GstTrace *trace) {
|
|||
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) {
|
||||
g_return_if_fail(trace != NULL);
|
||||
_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_flush (GstTrace *trace);
|
||||
void gst_trace_text_flush (GstTrace *trace);
|
||||
#define gst_trace_get_size(trace) ((trace)->bufsize)
|
||||
#define gst_trace_get_offset(trace) ((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");
|
||||
}
|
||||
|
||||
#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
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
@ -128,9 +114,9 @@ main(int argc, char **argv)
|
|||
memcpy(testout, refcoefs, sizeof(DCTELEM)*DCTSIZE2);
|
||||
}
|
||||
|
||||
read_tsc(&tscstart);
|
||||
gst_trace_read_tsc(&tscstart);
|
||||
gst_idct_convert(idct, testout);
|
||||
read_tsc(&tscstop);
|
||||
gst_trace_read_tsc(&tscstop);
|
||||
//printf("time %llu, %llu %lld\n", tscstart, tscstop, tscstop-tscstart);
|
||||
if (tscstop - tscstart < tscmin) tscmin = tscstop-tscstart;
|
||||
if (tscstop - tscstart > tscmax) tscmax = tscstop-tscstart;
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#include <gst/gst.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#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;
|
||||
|
@ -11,16 +8,14 @@ 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;
|
||||
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;
|
||||
|
||||
rdtscll(end);
|
||||
gst_trace_read_tsc(&end);
|
||||
d = end - GST_BUFFER_TIMESTAMP(buf);
|
||||
if (d > max) max = d;
|
||||
if (d < min) min = d;
|
||||
|
|
Loading…
Reference in a new issue