|
6 | 6 |
|
7 | 7 | includes_dir = Path(__file__).parent.joinpath("instrument-hooks/includes") |
8 | 8 | header_text = (includes_dir / "core.h").read_text() |
9 | | -filtered_header = "\n".join( |
10 | | - line for line in header_text.splitlines() if not line.strip().startswith("#") |
11 | | -) |
12 | | -ffibuilder.cdef(filtered_header) |
| 9 | + |
| 10 | + |
| 11 | +# Manually copied from `instrument-hooks/includes/core.h` to avoid parsing issues |
| 12 | +ffibuilder.cdef(""" |
| 13 | +typedef uint64_t *InstrumentHooks; |
| 14 | +
|
| 15 | +InstrumentHooks *instrument_hooks_init(void); |
| 16 | +void instrument_hooks_deinit(InstrumentHooks *); |
| 17 | +
|
| 18 | +bool instrument_hooks_is_instrumented(InstrumentHooks *); |
| 19 | +uint8_t instrument_hooks_start_benchmark(InstrumentHooks *); |
| 20 | +uint8_t instrument_hooks_stop_benchmark(InstrumentHooks *); |
| 21 | +uint8_t instrument_hooks_set_executed_benchmark(InstrumentHooks *, int32_t pid, |
| 22 | + const char *uri); |
| 23 | +uint8_t instrument_hooks_set_integration(InstrumentHooks *, const char *name, |
| 24 | + const char *version); |
| 25 | +
|
| 26 | +#define MARKER_TYPE_SAMPLE_START 0 |
| 27 | +#define MARKER_TYPE_SAMPLE_END 1 |
| 28 | +#define MARKER_TYPE_BENCHMARK_START 2 |
| 29 | +#define MARKER_TYPE_BENCHMARK_END 3 |
| 30 | +
|
| 31 | +uint8_t instrument_hooks_add_marker(InstrumentHooks *, uint32_t pid, |
| 32 | + uint8_t marker_type, uint64_t timestamp); |
| 33 | +uint64_t instrument_hooks_current_timestamp(void); |
| 34 | +
|
| 35 | +void callgrind_start_instrumentation(); |
| 36 | +void callgrind_stop_instrumentation(); |
| 37 | +""") |
13 | 38 |
|
14 | 39 | ffibuilder.set_source( |
15 | 40 | "pytest_codspeed.instruments.hooks.dist_instrument_hooks", |
|
0 commit comments