annotate my_profile.h @ 7195:a5b2566f3c2b

print only fatal/error/warning to stderr, others go to stdout (actually reversed Nick's r1.10 commit)
author arpi
date Sat, 31 Aug 2002 13:44:03 +0000
parents e9bd97d5c5cc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2832
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
1 /*
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
2 * my_profile.h
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
3 *
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
4 * Copyright (C) Nick Kurshev <nickols_k@mail.ru> - Oct 2001
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
5 *
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
6 * You can redistribute this file under terms and conditions
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
7 * of GNU General Public licence v2.
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
8 */
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
9 #ifndef MY_PROFILE_INC
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
10 #define MY_PROFILE_INC
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
11
2834
b7d3b450f8fd using volatile modifier
nick
parents: 2832
diff changeset
12 extern volatile unsigned long long int my_profile_start,my_profile_end,my_profile_total;
2832
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
13
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
14 #if defined ( ENABLE_PROFILE ) && defined ( ARCH_X86 )
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
15 static inline unsigned long long int read_tsc( void )
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
16 {
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
17 unsigned long long int retval;
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
18 __asm __volatile ("rdtsc":"=A"(retval)::"memory");
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
19 return retval;
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
20 }
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
21
2834
b7d3b450f8fd using volatile modifier
nick
parents: 2832
diff changeset
22 #define PROFILE_RESET() (my_profile_total=0ULL)
b7d3b450f8fd using volatile modifier
nick
parents: 2832
diff changeset
23 #define PROFILE_START() { static int inited=0; if(!inited) { inited=1; my_profile_total=0ULL; } my_profile_start=read_tsc(); }
b7d3b450f8fd using volatile modifier
nick
parents: 2832
diff changeset
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
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
25 #else
2834
b7d3b450f8fd using volatile modifier
nick
parents: 2832
diff changeset
26 #define PROFILE_RESET()
2832
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
27 #define PROFILE_START()
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
28 #define PROFILE_END(your_message)
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
29 #endif
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
30
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
31
99d169b25fbf Precised profile stuff
nick
parents:
diff changeset
32
6335
e9bd97d5c5cc warning & newline fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents: 2834
diff changeset
33 #endif