Skip to content

Commit afea827

Browse files
committed
python: add bindings for AddCustomContext
1 parent eddb024 commit afea827

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

bindings/python/google_benchmark/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,5 @@ def main(argv=None):
142142
# Methods for use with custom main function.
143143
initialize = _benchmark.Initialize
144144
run_benchmarks = _benchmark.RunSpecifiedBenchmarks
145+
add_custom_context = _benchmark.AddCustomContext
145146
atexit.register(_benchmark.ClearRegisteredBenchmarks)

bindings/python/google_benchmark/benchmark.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,9 @@ NB_MODULE(_benchmark, m) {
180180
m.def("RunSpecifiedBenchmarks",
181181
[]() { benchmark::RunSpecifiedBenchmarks(); });
182182
m.def("ClearRegisteredBenchmarks", benchmark::ClearRegisteredBenchmarks);
183+
m.def("AddCustomContext", benchmark::AddCustomContext, nb::arg("key"),
184+
nb::arg("value"),
185+
"Add a key-value pair to output as part of the context stanza in the "
186+
"report.");
183187
};
184188
} // namespace

0 commit comments

Comments
 (0)