Debugging: move debug function definitions in misc.cpp

Also activate writing on log file.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2008-12-14 17:26:05 +01:00
parent 5f8f83bc05
commit 5b853c9be6
3 changed files with 48 additions and 8 deletions

View File

@@ -37,6 +37,7 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp);
#endif
#include <cassert>
#include <cstdio>
#include <iomanip>
#include <iostream>
@@ -63,6 +64,42 @@ bool dbg_show_hit_rate = false;
//// Functions
////
void dbg_hit_on(bool b) {
assert(!dbg_show_mean);
dbg_show_hit_rate = true;
dbg_cnt0++;
if (b)
dbg_cnt1++;
}
void dbg_hit_on_c(bool c, bool b) {
if (c)
dbg_hit_on(b);
}
void dbg_before() {
assert(!dbg_show_mean);
dbg_show_hit_rate = true;
dbg_cnt0++;
}
void dbg_after() {
assert(!dbg_show_mean);
dbg_show_hit_rate = true;
dbg_cnt1++;
}
void dbg_mean_of(int v) {
assert(!dbg_show_hit_rate);
dbg_cnt0++;
dbg_cnt1 += v;
}
void dbg_print_hit_rate() {
std::cout << "Total " << dbg_cnt0 << " Hit " << dbg_cnt1