Skip to content

[BUG] power scripts can report an inaccurate number for test time #227

@jihoonson

Description

@jihoonson

Describe the bug

The nds and nds-h power scripts can report an inaccurate number for the "Power Test Time" especially when the test finishes too quickly. Sometimes a negative number is reported as the test time. This is because we use int(time.time()) to measure the timing. The use of int(time.time()) has a couple of issues. See https://docs.python.org/3/library/time.html#time.time for more details.

  • time.time() returns the unix time in seconds as a float, which can cause precision loss.
  • The int casting will drop the fractional seconds.

We should use time.time_ns() instead to improve the accuracy.

Steps/Code to reproduce bug

Run some query that finishes very quickly, such as SELECT 1.

Expected behavior
The test time should be as accurate as possible. The test time should never be negative numbers.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions