Commit 44abaa7c authored by Sam Hocevar's avatar Sam Hocevar

  * Added gprof profiling support with --enable-profiling.

    It works at last! configure with --enable-profiling, build, run
 vlc (you may want to add --noaudio, it currently segfaults with sound
 here) and launch "gprof vlc" when finished.

    To make gprof work with multithreaded programs, one needs to set the
 internal ITIMER_PROF timer for each new thread launched. I did this
 through a wrapper in vlc_thread_create (see include/threads.h).
parent cff6378d
......@@ -4,6 +4,7 @@
HEAD
* Added gprof profiling support with --enable-profiling.
* Fully working Windows DVD ioctl support by Jon Lech Johansen.
* DirectX enhancements by Gildas Bazin, such as software rendering.
* Merged dvdcss_init and dvdcss_open into dvdcss_open, and dvdcss_close
......
......@@ -35,6 +35,7 @@ ARCH = @ARCH@
DEBUG = @DEBUG@
STATS = @STATS@
TRACE = @TRACE@
PROFILING = @PROFILING@
OPTIMS = @OPTIMS@
GETOPT = @GETOPT@
......@@ -107,6 +108,10 @@ ifeq ($(TRACE),1)
PROGRAM_OPTIONS += TRACE
DEFINE += -DTRACE
endif
ifeq ($(PROFILING),1)
PROGRAM_OPTIONS += PROFILING
DEFINE += -DPROFILING
endif
ifeq ($(STATS),1)
PROGRAM_OPTIONS += STATS
DEFINE += -DSTATS
......@@ -196,8 +201,10 @@ ifeq ($(OPTIMS),1)
CFLAGS += -O3
CFLAGS += -ffast-math -funroll-loops
ifneq ($(DEBUG),1)
ifneq ($(PROFILING),1)
CFLAGS += -fomit-frame-pointer
endif
endif
# Optimizations for x86 familiy
ifneq (,$(findstring 86,$(ARCH)))
......@@ -259,3 +266,7 @@ ifeq ($(DEBUG),1)
CFLAGS += -g
endif
ifeq ($(PROFILING),1)
CFLAGS += -pg
endif
This diff is collapsed.
......@@ -217,22 +217,6 @@ AC_CHECK_HEADERS(sys/ioctl.h,[
])
])
dnl
dnl GNU portable threads
dnl
AC_ARG_ENABLE(pth,
[ --enable-pth Enable GNU Pth support (default disabled)],
[ if test x$enableval = xyes; then
AC_CHECK_LIB(pth,pth_init)
AC_EGREP_HEADER(pth_init,pth.h,[
AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
Define if <pth.h> defines pth_init)
THREAD_LIB="-lpth"
fi])
])
LIB="${LIB} ${THREAD_LIB}"
dnl
dnl PentiumPro acceleration
dnl
......@@ -262,14 +246,6 @@ AC_ARG_ENABLE(altivec,
fi ])
#[ if test -d /System/Library/Frameworks/vecLib.framework; then ARCH="${ARCH} altivec"; PLUGINS="${PLUGINS} idctaltivec"; fi ])
dnl
dnl CSS DVD decryption
dnl
AC_ARG_ENABLE(css,
[ --disable-css Disable DVD CSS decryption (default enabled)],
[ if test x$enableval = xyes; then CSS=1; else CSS=0; fi ], [ CSS=1; ])
if test x${CSS} = x1; then AC_DEFINE(HAVE_CSS, 1, Define if you want DVD CSS decryption.) fi
dnl
dnl Debugging mode
dnl
......@@ -291,6 +267,13 @@ AC_ARG_ENABLE(trace,
[ --enable-trace Enable trace mode (default disabled)],
[ if test x$enableval = xyes; then TRACE=1; fi ])
dnl
dnl Trace mode
dnl
AC_ARG_ENABLE(profiling,
[ --enable-profiling Enable gprof profiling (default disabled)],
[ if test x$enableval = xyes; then PROFILING=1; fi ])
dnl
dnl Enable/disable optimizations
dnl
......@@ -299,6 +282,30 @@ AC_ARG_ENABLE(optimizations,
[ if test x$enableval = xno; then OPTIMS=0; fi ],
[ OPTIMS=1 ])
dnl
dnl GNU portable threads
dnl
AC_ARG_ENABLE(pth,
[ --enable-pth Enable GNU Pth support (default disabled)],
[ if test x$enableval = xyes; then
AC_CHECK_LIB(pth,pth_init)
AC_EGREP_HEADER(pth_init,pth.h,[
AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
Define if <pth.h> defines pth_init)
THREAD_LIB="-lpth"
fi])
])
LIB="${LIB} ${THREAD_LIB}"
dnl
dnl CSS DVD decryption
dnl
AC_ARG_ENABLE(css,
[ --disable-css Disable DVD CSS decryption (default enabled)],
[ if test x$enableval = xyes; then CSS=1; else CSS=0; fi ], [ CSS=1; ])
if test x${CSS} = x1; then AC_DEFINE(HAVE_CSS, 1, Define if you want DVD CSS decryption.) fi
dnl
dnl DVD module: check for installed libdvdcss or local libdvdcss
dnl TODO: use user-provided --with-dvdcss flag
......@@ -619,6 +626,7 @@ AC_SUBST(DEBUG)
AC_SUBST(STATS)
AC_SUBST(ASM)
AC_SUBST(TRACE)
AC_SUBST(PROFILING)
AC_SUBST(OPTIMS)
AC_SUBST(CSS)
AC_SUBST(MOC)
......@@ -671,6 +679,7 @@ vlc version : ${VLC_VERSION}
debug mode : ${DEBUG}
statistics : ${STATS}
trace mode : ${TRACE}
profiling : ${PROFILING}
need builtin getopt : ${GETOPT}
built-in modules :${BUILTINS}
plugin modules :${PLUGINS}
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.103 2001/06/14 01:49:44 sam Exp $
* $Id: main.c,v 1.104 2001/06/14 20:21:04 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -252,11 +252,9 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
p_vout_bank = &vout_bank;
/*
* Initialize threads
* Initialize threads system
*/
#if defined( PTH_INIT_IN_PTH_H )
pth_init( );
#endif
vlc_threads_init( );
/*
* Test if our code is likely to run on this CPU
......@@ -399,9 +397,10 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
intf_Msg( "intf: program terminated" );
intf_MsgDestroy();
#if defined( PTH_INIT_IN_PTH_H )
pth_kill( );
#endif
/*
* Stop threads system
*/
vlc_threads_end( );
return 0;
}
......
......@@ -3,7 +3,7 @@
* Functions are prototyped in mtime.h.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: mtime.c,v 1.22 2001/06/14 01:49:44 sam Exp $
* $Id: mtime.c,v 1.23 2001/06/14 20:21:04 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -229,15 +229,15 @@ void msleep( mtime_t delay )
#if defined( HAVE_KERNEL_OS_H )
snooze( delay );
#elif defined( HAVE_USLEEP ) || defined( WIN32 )
usleep( delay );
#elif defined( PTH_INIT_IN_PTH_H )
struct timeval tv_delay;
tv_delay.tv_sec = delay / 1000000;
tv_delay.tv_usec = delay % 1000000;
pth_select( 0, NULL, NULL, NULL, &tv_delay );
#elif defined( HAVE_USLEEP ) || defined( WIN32 )
usleep( delay );
#else
struct timeval tv_delay;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment