mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Add dbg_before() and dbg_after()
Other two debug utilities to compute filter rate. Usage is: dbg_before(); // counts passages from this point if(..) // complex code stuff you want to audit return/continue if(...) ..... dbg_after(); // counts passages from this point Then somewhere in the code, normally in poll() add dbg_print_hit_rate() and you will see the filter rate of your code under auditing. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
849809e97e
commit
54071312f3
1 changed files with 5 additions and 2 deletions
|
@ -63,7 +63,10 @@ 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++; }
|
||||
#define dbg_hit_on_c(c, x) { if (c) dbg_hit_on(x) }
|
||||
inline void dbg_hit_on(bool b) { dbg_cnt0++; if (b) dbg_cnt1++; }
|
||||
inline void dbg_hit_on_c(bool c, bool b) { if (c) dbg_hit_on(b); }
|
||||
|
||||
inline void dbg_before() { dbg_cnt0++; }
|
||||
inline void dbg_after() { dbg_cnt1++; }
|
||||
|
||||
#endif // !defined(MISC_H_INCLUDED)
|
||||
|
|
Loading…
Add table
Reference in a new issue