From 72ae3e51758986775949a7ba2002a526d359389f Mon Sep 17 00:00:00 2001 From: Michael Roitzsch Date: Sat, 1 Nov 2003 17:25:49 +0000 Subject: assuming Miguel's consent I commit his profiling macros (they are not used anywhere, but are very helpful, if you quickly want to measure, how much time a function takes) CVS patchset: 5666 CVS date: 2003/11/01 17:25:49 --- src/xine-utils/xineutils.h | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index bf8b59350..6e4900b30 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xineutils.h,v 1.61 2003/11/01 01:25:44 tmmm Exp $ + * $Id: xineutils.h,v 1.62 2003/11/01 17:25:49 mroi Exp $ * */ #ifndef XINEUTILS_H @@ -964,6 +964,39 @@ void xine_print_trace(void); } while(0) #endif /* __GNUC__ */ +/* time measuring macros for profiling tasks */ + +#ifdef DEBUG +# define XINE_PROFILE(function) \ + do { \ + struct timeval current_time; \ + double dtime; \ + gettimeofday(¤t_time, NULL); \ + dtime = -(current_time.tv_sec + (current_time.tv_usec / 1000000.0)); \ + function; \ + gettimeofday(¤t_time, NULL); \ + dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \ + printf("%s: (%s:%d) took %lf seconds\n", \ + LOG_MODULE, __XINE_FUNCTION__, __LINE__, dtime); \ + } while(0) +# define XINE_PROFILE_ACCUMULATE(function) \ + do { \ + struct timeval current_time; \ + static double dtime = 0; \ + gettimeofday(¤t_time, NULL); \ + dtime -= current_time.tv_sec + (current_time.tv_usec / 1000000.0); \ + function; \ + gettimeofday(¤t_time, NULL); \ + dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \ + printf("%s: (%s:%d) took %lf seconds\n", \ + LOG_MODULE, __XINE_FUNCTION__, __LINE__, dtime); \ + } while(0) +#else +# define XINE_PROFILE(function) function +# define XINE_PROFILE_ACCUMULATE(function) function +#endif /* LOG */ + + /******** double chained lists with builtin iterator *******/ typedef struct xine_node_s { -- cgit v1.2.3