Mercurial > mplayer.hg
annotate my_profile.h @ 8394:cf1ac6d3d4f2
sync
author | zdar |
---|---|
date | Sat, 07 Dec 2002 20:08:51 +0000 |
parents | e9bd97d5c5cc |
children |
rev | line source |
---|---|
2832 | 1 /* |
2 * my_profile.h | |
3 * | |
4 * Copyright (C) Nick Kurshev <nickols_k@mail.ru> - Oct 2001 | |
5 * | |
6 * You can redistribute this file under terms and conditions | |
7 * of GNU General Public licence v2. | |
8 */ | |
9 #ifndef MY_PROFILE_INC | |
10 #define MY_PROFILE_INC | |
11 | |
2834 | 12 extern volatile unsigned long long int my_profile_start,my_profile_end,my_profile_total; |
2832 | 13 |
14 #if defined ( ENABLE_PROFILE ) && defined ( ARCH_X86 ) | |
15 static inline unsigned long long int read_tsc( void ) | |
16 { | |
17 unsigned long long int retval; | |
18 __asm __volatile ("rdtsc":"=A"(retval)::"memory"); | |
19 return retval; | |
20 } | |
21 | |
2834 | 22 #define PROFILE_RESET() (my_profile_total=0ULL) |
23 #define PROFILE_START() { static int inited=0; if(!inited) { inited=1; my_profile_total=0ULL; } my_profile_start=read_tsc(); } | |
24 #define PROFILE_END(your_message) { my_profile_end=read_tsc(); my_profile_total+=(my_profile_end-my_profile_start); printf(your_message" current=%llu total=%llu\n\t",(my_profile_end-my_profile_start),my_profile_total); } | |
2832 | 25 #else |
2834 | 26 #define PROFILE_RESET() |
2832 | 27 #define PROFILE_START() |
28 #define PROFILE_END(your_message) | |
29 #endif | |
30 | |
31 | |
32 | |
6335
e9bd97d5c5cc
warning & newline fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents:
2834
diff
changeset
|
33 #endif |