Skip to content

Fix time reporting for the merged tests#63452

Merged
jkoritzinsky merged 1 commit intodotnet:mainfrom
trylek:Wrapper-Stopwatch-StartNew
Jan 6, 2022
Merged

Fix time reporting for the merged tests#63452
jkoritzinsky merged 1 commit intodotnet:mainfrom
trylek:Wrapper-Stopwatch-StartNew

Conversation

@trylek
Copy link
Member

@trylek trylek commented Jan 6, 2022

In XUnitWrapperGenerator we need to initialize the stopwatch
variable using Stopwatch.StartNew(), not just new Stopwatch(),
otherwise the stopwatch never starts to run, that's why all the
test case times showed as zero. (Alternatively we could use
new Stopwatch() followed by stopwatch.Start() but I believe that
Stopwatch.StartNew() is generally considered to be more
performant.)

After applying this fix, some short test times started reporting
their running time in scientific notation (e.g. 5.5e-5) so I
modified the formatting to F6 - in the Methodical suite I see
a test running for 55 microseconds.

Thanks

Tomas

In XUnitWrapperGenerator we need to initialize the stopwatch
variable using Stopwatch.StartNew(), not just new Stopwatch(),
otherwise the stopwatch never starts to run, that's why all the
test case times showed as zero. (Alternatively we could use
new Stopwatch() followed by stopwatch.Start() but I believe that
Stopwatch.StartNew() is generally considered to be more
performant.)

After applying this fix, some short test times started reporting
their running time in scientific notation (e.g. 5.5e-5) so I
modified the formatting to F6 - in the Methodical suite I see
a test running for 55 microseconds.

Thanks

Tomas
@ghost
Copy link

ghost commented Jan 6, 2022

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

In XUnitWrapperGenerator we need to initialize the stopwatch
variable using Stopwatch.StartNew(), not just new Stopwatch(),
otherwise the stopwatch never starts to run, that's why all the
test case times showed as zero. (Alternatively we could use
new Stopwatch() followed by stopwatch.Start() but I believe that
Stopwatch.StartNew() is generally considered to be more
performant.)

After applying this fix, some short test times started reporting
their running time in scientific notation (e.g. 5.5e-5) so I
modified the formatting to F6 - in the Methodical suite I see
a test running for 55 microseconds.

Thanks

Tomas

Author: trylek
Assignees: -
Labels:

area-Infrastructure-coreclr

Milestone: -

@jkoritzinsky jkoritzinsky merged commit 599ab0e into dotnet:main Jan 6, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Feb 6, 2022
@trylek trylek deleted the Wrapper-Stopwatch-StartNew branch February 7, 2022 18:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants