Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dist/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -61296,6 +61296,8 @@ void callgrind_start_instrumentation() {}

void callgrind_stop_instrumentation() {}

void callgrind_toggle_collect() {}

void callgrind_add_obj_skip(uint8_t const *path) { (void)path; }
#else
#include "callgrind.h"
Expand All @@ -61315,6 +61317,8 @@ void callgrind_start_instrumentation() { CALLGRIND_START_INSTRUMENTATION; }

void callgrind_stop_instrumentation() { CALLGRIND_STOP_INSTRUMENTATION; }

void callgrind_toggle_collect() { CALLGRIND_TOGGLE_COLLECT; }

void callgrind_add_obj_skip(uint8_t const *path) {
CALLGRIND_ADD_OBJ_SKIP(path);
}
Expand Down
7 changes: 7 additions & 0 deletions includes/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ uint64_t instrument_hooks_current_timestamp(void);
void callgrind_start_instrumentation();
void callgrind_stop_instrumentation();

// Toggle callgrind cost collection on/off without re-instrumenting.
// Unlike start/stop instrumentation, this does not flush the simulated
// cache, so it can be used to exclude code regions from measurement
// without introducing artificial cold-cache costs.
// Safe to call outside Valgrind: expands to a no-op.
void callgrind_toggle_collect();
Comment thread
not-matthias marked this conversation as resolved.

// Register an object file path on callgrind's runtime --obj-skip list.
// Equivalent to passing --obj-skip=<path> on the valgrind command line.
// Safe to call outside Valgrind: expands to a no-op.
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/valgrind_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ void callgrind_start_instrumentation() {}

void callgrind_stop_instrumentation() {}

void callgrind_toggle_collect() {}

void callgrind_add_obj_skip(uint8_t const *path) { (void)path; }
#else
#include "callgrind.h"
Expand All @@ -36,6 +38,8 @@ void callgrind_start_instrumentation() { CALLGRIND_START_INSTRUMENTATION; }

void callgrind_stop_instrumentation() { CALLGRIND_STOP_INSTRUMENTATION; }

void callgrind_toggle_collect() { CALLGRIND_TOGGLE_COLLECT; }

void callgrind_add_obj_skip(uint8_t const *path) {
CALLGRIND_ADD_OBJ_SKIP(path);
}
Expand Down
Loading