import timeit
t = timeit.Timer("def test(): print("def test()", "print('setup')")
print(t.timeit(10000))
print(t.repeat(3,10000))
In my code I use the following no requirement for setup so empty, just call the API method that I want to time.
import timeit
t = timeit.Timer("def example(): x10i.CachedReadAndResetSecuritySwitchFlags()", "")
print(t.timeit(10000))
print(t.repeat(3,10000))
And that's it simple!
No comments:
Post a Comment