PerfUtils
Assembly: ServiceStack.Common.dll
View Source
Declaration
public static class PerfUtils
Methods
ToTimeSpan(Int64)
View Source
Declaration
public static TimeSpan ToTimeSpan(this long fromTicks)
Returns
System.TimeSpan
Parameters
Type | Name |
---|---|
System.Int64 | fromTicks |
MeasureFor(Action, Int32)
Runs an action for a minimum of runForMs
View Source
Declaration
public static double MeasureFor(Action fn, int runForMs)
Returns
System.Double
: time elapsed in micro seconds
Parameters
Type | Name | Description |
---|---|---|
System.Action | fn | What to run |
|
| System.Int32
| runForMs | Minimum ms to run for
|
Measure(Action, Int32, Int32, Action, Action, Action)
Returns average microseconds an action takes when run for the specified runForMs
View Source
Declaration
public static double Measure(Action fn, int times = 1, int runForMs = 2000, Action setup = null, Action warmup = null, Action teardown = null)
Returns
System.Double
Parameters
Type | Name | Description |
---|---|---|
System.Action | fn | What to run |
|
| System.Int32
| times | How many times to run for each iteration
|
| System.Int32
| runForMs | Minimum ms to run for
|
| System.Action
| setup |
|
| System.Action
| warmup |
|
| System.Action
| teardown |
|