Frederic Weisbecker | cd84c2a | 2009-08-12 10:03:49 +0200 | [diff] [blame] | 1 | /* For general debugging purposes */ |
| 2 | |
| 3 | #include "../perf.h" |
| 4 | #include <string.h> |
| 5 | #include <stdarg.h> |
| 6 | #include <stdio.h> |
| 7 | |
| 8 | int verbose = 0; |
Frederic Weisbecker | 2cec19d | 2009-08-16 19:24:21 +0200 | [diff] [blame^] | 9 | int dump_trace = 0; |
Frederic Weisbecker | cd84c2a | 2009-08-12 10:03:49 +0200 | [diff] [blame] | 10 | |
| 11 | int eprintf(const char *fmt, ...) |
| 12 | { |
| 13 | va_list args; |
| 14 | int ret = 0; |
| 15 | |
| 16 | if (verbose) { |
| 17 | va_start(args, fmt); |
| 18 | ret = vfprintf(stderr, fmt, args); |
| 19 | va_end(args); |
| 20 | } |
| 21 | |
| 22 | return ret; |
| 23 | } |
Frederic Weisbecker | 2cec19d | 2009-08-16 19:24:21 +0200 | [diff] [blame^] | 24 | |
| 25 | int dump_printf(const char *fmt, ...) |
| 26 | { |
| 27 | va_list args; |
| 28 | int ret = 0; |
| 29 | |
| 30 | if (dump_trace) { |
| 31 | va_start(args, fmt); |
| 32 | ret = vprintf(fmt, args); |
| 33 | va_end(args); |
| 34 | } |
| 35 | |
| 36 | return ret; |
| 37 | } |