Esempio n. 1
0
    /// <summary>
    /// Add an action to benchmark with instance count
    /// </summary>
    /// <param name="oAction">The action to benchmark</param>
    /// <param name="oSetupAction">The action to execute before beginning to benchmark</param>
    /// <param name="oCleanupAction">The action to execute after benchmark has been recorded</param>
    /// <param name="sLabel">The label of the action to benchmark</param>
    /// <returns></returns>
    public BenchmarkLite Add(
        BenchmarkLiteAction <int> oAction,
        BenchmarkLiteAction oSetupAction   = null,
        BenchmarkLiteAction oCleanupAction = null,
        string sLabel = null)
    {
        if (null == oSetupAction)
        {
            oSetupAction = () => { }
        }
        ;
        if (null == oCleanupAction)
        {
            oCleanupAction = () => { }
        }
        ;

        var oRecord = new Record
        {
            Action         = oAction,
            Label          = sLabel,
            SetupAction    = oSetupAction,
            CleanupAction  = oCleanupAction,
            ElapsedSeconds = 0,
        };

        _oActionList.Add(oRecord);

        return(this);
    }
Esempio n. 2
0
 /// <summary>
 /// Add an action to benchmark
 /// </summary>
 /// <param name="oAction">The action to benchmark</param>
 /// <param name="oSetupAction">The action to execute before beginning to benchmark</param>
 /// <param name="oCleanupAction">The action to execute after benchmark has been recorded</param>
 /// <param name="sLabel">The label of the action to benchmark</param>
 /// <returns></returns>
 public BenchmarkLite Add(
     BenchmarkLiteAction oAction,
     BenchmarkLiteAction oSetupAction   = null,
     BenchmarkLiteAction oCleanupAction = null,
     string sLabel = null)
 {
     return(Add(x => oAction(), oSetupAction, oCleanupAction, sLabel));
 }