diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-11-01 17:25:49 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-11-01 17:25:49 +0000 |
commit | 72ae3e51758986775949a7ba2002a526d359389f (patch) | |
tree | 2ae4a525b010424140586780ecaa103a3317be0d /src | |
parent | d0cff86648eeb1facdd458eb774714121f052049 (diff) | |
download | xine-lib-72ae3e51758986775949a7ba2002a526d359389f.tar.gz xine-lib-72ae3e51758986775949a7ba2002a526d359389f.tar.bz2 |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/xine-utils/xineutils.h | 35 |
1 files changed, 34 insertions, 1 deletions
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 { |