From ecf560fb1ce3495c2aab5b281762a6af1746f054 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 22 Dec 2023 14:15:03 +0100 Subject: [PATCH] Fix Python manual timing example According to the user guide, when manual timing, it is necessary to explicit it by using the `UseManualTime` function. Its equivalent in Python is use_manual_time(). This function was not called in the example. It is possible to verify that the use of this function has an impact on the measure by adding another `time.sleep(0.01)` at the end of the iteration. There is a x2 difference depending on whether `use_manual_time()` is used or not. --- bindings/python/google_benchmark/example.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/python/google_benchmark/example.py b/bindings/python/google_benchmark/example.py index b5b2f88ff3..b92245ea67 100644 --- a/bindings/python/google_benchmark/example.py +++ b/bindings/python/google_benchmark/example.py @@ -61,6 +61,7 @@ def skipped(state): @benchmark.register +@benchmark.option.use_manual_time() def manual_timing(state): while state: # Manually count Python CPU time