Skip to content

Commit

Permalink
Fix Python manual timing example
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alxbilger committed Jan 8, 2024
1 parent 96d820f commit ecf560f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions bindings/python/google_benchmark/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ecf560f

Please sign in to comment.