Add simple debug hit rate counter

Add a very simple debug framework to
measure the hit rate of a given condition.

Simply insert macro

dbg_hit_on(x);

Anywhere you want to compute hit rate of condition x
and then call, as example in poll(), function
dbg_print_hit_rate() to print current results.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2008-09-06 12:22:10 +02:00
parent d786822b92
commit 61f41a057d
2 changed files with 24 additions and 0 deletions

View File

@@ -56,5 +56,13 @@ extern int get_system_time();
extern int cpu_count();
extern int Bioskey();
////
//// Debug
////
extern long dbg_cnt0;
extern long dbg_cnt1;
extern void dbg_print_hit_rate();
#define dbg_hit_on(x) { dbg_cnt0++; if (x) dbg_cnt1++; }
#endif // !defined(MISC_H_INCLUDED)