asynchronous - C# Stopwatch to time an async/await method inaccurate -


i'm writing performance tests, , want able time method asynchronous. code looks this, action func<task<httpresponsemessage>>:

var sw = new stopwatch(); httpresponsemessage response = null;  sw.start(); response = await action().configureawait(continueoncapturedcontext: false); sw.stop(); 

the code compiles , runs ok, measured milliseconds 100 times higher request timings see in fiddler - fiddler reports 200-300ms, stop watch reports ~30,000ms. there catch timing asynchronous methods? solution timing in action (which annoying?)

this should work fine measuring true amount of time takes asynchronous task finish. need keep in mind that:

  1. the time measuring fiddler measuring request only, , non of time takes code process response.
  2. there significant difference in time here , should able time code see how long takes progress break point before request after request. if closer 30 seconds stop watch accurate.
  3. there isn't obvious me make time inaccurate.

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -