python-zhmcclient icon indicating copy to clipboard operation
python-zhmcclient copied to clipboard

Bad precision of TimeStats on Windows

Open andy-maier opened this issue 9 years ago • 1 comments

Actual behavior

The TimeStats timer uses time.time() which has a high precision on UNIX/Linux, but a pretty bad precision of only 1/60 sec on Windows.

Expected behavior

The precision on Windows should be improved.

Possible solutions

time.clock() provides high precision on Windows, but no good precision on UNIX/Linux. besides that, it is deprecated since Python 3.3.

timeit.default_timer() seems to be a solution but requires to fit the code to be measured into a statement string that is interpreted inside of a timeit() method. That might be a solution but requires more investigation.

Execution environment

  • zhmcclient version: 0.9.0
  • Operating system (type+version): Windows 7

andy-maier avatar Jan 12 '17 13:01 andy-maier

I don't think timeit is the solution we're looking for. It would likely require a complete rewrite of TimeStats if it even could provide the same functionality, which I don't think it can.

abrezovsky avatar Jan 19 '17 14:01 abrezovsky