| 1 |
#ifndef WRAPPER_H |
| 2 |
#define WRAPPER_H |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
|
| 6 |
#if defined(_WIN32) || defined(__APPLE__) |
| 7 |
// Windows and other platforms - provide no-op implementations |
| 8 |
uint8_t running_on_valgrind() { return 0; } |
| 9 |
|
| 10 |
void callgrind_dump_stats() {} |
| 11 |
|
| 12 |
void callgrind_dump_stats_at(uint8_t const *pos_str) { (void)pos_str; } |
| 13 |
|
| 14 |
void callgrind_zero_stats() {} |
| 15 |
|
| 16 |
void callgrind_start_instrumentation() {} |
| 17 |
|
| 18 |
void callgrind_stop_instrumentation() {} |
| 19 |
#else |
| 20 |
#include "callgrind.h" |
| 21 |
#include "valgrind.h" |
| 22 |
|
| 23 |
uint8_t running_on_valgrind() { return RUNNING_ON_VALGRIND > 0; } |
| 24 |
|
| 25 |
void callgrind_dump_stats() { CALLGRIND_DUMP_STATS; } |
| 26 |
|
| 27 |
void callgrind_dump_stats_at(uint8_t const *pos_str) { |
| 28 |
CALLGRIND_DUMP_STATS_AT(pos_str); |
| 29 |
} |
| 30 |
|
| 31 |
void callgrind_zero_stats() { CALLGRIND_ZERO_STATS; } |
| 32 |
|
| 33 |
void callgrind_start_instrumentation() { CALLGRIND_START_INSTRUMENTATION; } |
| 34 |
|
| 35 |
void callgrind_stop_instrumentation() { CALLGRIND_STOP_INSTRUMENTATION; } |
| 36 |
|
| 37 |
#endif |
| 38 |
|
| 39 |
#endif |