mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
Apply the posix-timer check from #361155. Conditionally use the posix timer for logging. This gives better timestamp ...
Original commit message from CVS: * configure.ac: * gst/gstdebugutils.c: * gst/gstinfo.c: Apply the posix-timer check from #361155. Conditionally use the posix timer for logging. This gives better timestamp precission, less overhead and no ntp jitter.
This commit is contained in:
parent
d8f8df9c49
commit
ec080cd61b
4 changed files with 106 additions and 10 deletions
|
@ -1,3 +1,12 @@
|
|||
2007-11-28 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* configure.ac:
|
||||
* gst/gstdebugutils.c:
|
||||
* gst/gstinfo.c:
|
||||
Apply the posix-timer check from #361155. Conditionally use the posix
|
||||
timer for logging. This gives better timestamp precission, less
|
||||
overhead and no ntp jitter.
|
||||
|
||||
2007-11-28 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
* gst/gstminiobject.c: (gst_mini_object_get_type),
|
||||
|
|
52
configure.ac
52
configure.ac
|
@ -358,6 +358,58 @@ dnl check for mmap()
|
|||
AC_FUNC_MMAP
|
||||
AM_CONDITIONAL(HAVE_MMAP, test "x$ac_cv_func_mmap_fixed_mapped" = "xyes")
|
||||
|
||||
dnl Check for POSIX timers
|
||||
AC_CHECK_FUNCS(clock_gettime, [], [
|
||||
AC_CHECK_LIB(rt, clock_gettime, [
|
||||
AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
|
||||
LIBS="$LIBS -lrt"
|
||||
])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(for posix timers, gst_cv_posix_timers,AC_TRY_RUN([
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
int main() {
|
||||
#if defined(_POSIX_TIMERS) && _POSIX_TIMERS >= 0 && defined(CLOCK_REALTIME)
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}],gst_cv_posix_timers=yes,gst_cv_posix_timers=no))
|
||||
|
||||
if test "$gst_cv_posix_timers" = "yes"; then
|
||||
AC_DEFINE(HAVE_POSIX_TIMERS,1,[Have posix timers])
|
||||
GST_HAVE_POSIX_TIMERS_DEFINE="#define GST_HAVE_POSIX_TIMERS 1"
|
||||
else
|
||||
GST_HAVE_POSIX_TIMERS_DEFINE="#define GST_HAVE_POSIX_TIMERS 0"
|
||||
fi
|
||||
AC_SUBST(GST_HAVE_POSIX_TIMERS_DEFINE)
|
||||
AM_CONDITIONAL(GST_HAVE_POSIX_TIMERS, test "$gst_cv_posix_timers" = "yes")
|
||||
|
||||
AC_CACHE_CHECK(for monotonic clock, gst_cv_monotonic_clock,AC_TRY_RUN([
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
int main() {
|
||||
#if defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 && defined(CLOCK_MONOTONIC)
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}],gst_cv_monotonic_clock=yes,gst_cv_monotonic_clock=no))
|
||||
|
||||
if test "$gst_cv_monotonic_clock" = "yes"; then
|
||||
AC_DEFINE(HAVE_MONOTONIC_CLOCK,1,[Have a monotonic clock])
|
||||
GST_HAVE_MONOTONIC_CLOCK_DEFINE="#define GST_HAVE_MONOTONIC_CLOCK 1"
|
||||
else
|
||||
GST_HAVE_MONOTONIC_CLOCK_DEFINE="#define GST_HAVE_MONOTONIC_CLOCK 0"
|
||||
fi
|
||||
AC_SUBST(GST_HAVE_MONOTONIC_CLOCK_DEFINE)
|
||||
AM_CONDITIONAL(GST_HAVE_MONOTONIC_CLOCK, test "$gst_cv_monotonic_clock" = "yes")
|
||||
|
||||
dnl Check for a way to display the function name in debug output
|
||||
AG_GST_CHECK_FUNCTION
|
||||
|
||||
|
|
|
@ -496,7 +496,6 @@ _gst_debug_bin_to_dot_file_with_ts (GstBin * bin, GstDebugGraphDetails details,
|
|||
const gchar * file_name)
|
||||
{
|
||||
gchar *ts_file_name = NULL;
|
||||
GTimeVal now;
|
||||
GstClockTime elapsed;
|
||||
|
||||
g_return_if_fail (GST_IS_BIN (bin));
|
||||
|
@ -508,8 +507,21 @@ _gst_debug_bin_to_dot_file_with_ts (GstBin * bin, GstDebugGraphDetails details,
|
|||
}
|
||||
|
||||
/* add timestamp */
|
||||
g_get_current_time (&now);
|
||||
elapsed = GST_TIMEVAL_TO_TIME (now) - _priv_gst_info_start_time;
|
||||
#ifdef HAVE_POSIX_TIMERS
|
||||
{
|
||||
struct timespec now;
|
||||
|
||||
clock_gettime (CLOCK_MONOTONIC, &now);
|
||||
elapsed = GST_TIMESPEC_TO_TIME (now) - _priv_gst_info_start_time;
|
||||
}
|
||||
#else
|
||||
{
|
||||
GTimeVal now;
|
||||
|
||||
g_get_current_time (&now);
|
||||
elapsed = GST_TIMEVAL_TO_TIME (now) - _priv_gst_info_start_time;
|
||||
}
|
||||
#endif
|
||||
ts_file_name =
|
||||
g_strdup_printf ("%" GST_TIME_FORMAT "-%s", GST_TIME_ARGS (elapsed),
|
||||
file_name);
|
||||
|
|
|
@ -277,14 +277,25 @@ __gst_in_valgrind (void)
|
|||
void
|
||||
_gst_debug_init (void)
|
||||
{
|
||||
GTimeVal current;
|
||||
|
||||
gst_atomic_int_set (&__default_level, GST_LEVEL_DEFAULT);
|
||||
gst_atomic_int_set (&__use_color, 1);
|
||||
|
||||
/* get time we started for debugging messages */
|
||||
g_get_current_time (¤t);
|
||||
_priv_gst_info_start_time = GST_TIMEVAL_TO_TIME (current);
|
||||
#ifdef HAVE_POSIX_TIMERS
|
||||
{
|
||||
struct timespec current;
|
||||
|
||||
clock_gettime (CLOCK_MONOTONIC, ¤t);
|
||||
_priv_gst_info_start_time = GST_TIMESPEC_TO_TIME (current);
|
||||
}
|
||||
#else
|
||||
{
|
||||
GTimeVal current;
|
||||
|
||||
g_get_current_time (¤t);
|
||||
_priv_gst_info_start_time = GST_TIMEVAL_TO_TIME (current);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PRINTF_EXTENSION
|
||||
register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension_ptr,
|
||||
|
@ -629,7 +640,6 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
|||
gchar pidcolor[10];
|
||||
const gchar *levelcolor;
|
||||
gint pid;
|
||||
GTimeVal now;
|
||||
GstClockTime elapsed;
|
||||
gboolean free_color = TRUE;
|
||||
gboolean free_obj = TRUE;
|
||||
|
@ -669,8 +679,21 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
|||
free_obj = FALSE;
|
||||
}
|
||||
|
||||
g_get_current_time (&now);
|
||||
elapsed = GST_TIMEVAL_TO_TIME (now) - _priv_gst_info_start_time;
|
||||
#ifdef HAVE_POSIX_TIMERS
|
||||
{
|
||||
struct timespec now;
|
||||
|
||||
clock_gettime (CLOCK_MONOTONIC, &now);
|
||||
elapsed = GST_TIMESPEC_TO_TIME (now) - _priv_gst_info_start_time;
|
||||
}
|
||||
#else
|
||||
{
|
||||
GTimeVal now;
|
||||
|
||||
g_get_current_time (&now);
|
||||
elapsed = GST_TIMEVAL_TO_TIME (now) - _priv_gst_info_start_time;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
g_printerr ("%s (%p - %" GST_TIME_FORMAT ") %s%20s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n",
|
||||
|
|
Loading…
Reference in a new issue