コード例 #1
0
    public static AppMsg trace(OpTimePair timing, int?labelPad = null)
    {
        var msg = appMsg(timing.Format(labelPad), SeverityLevel.Benchmark);

        print(msg);
        return(msg);
    }
コード例 #2
0
ファイル: time.cs プロジェクト: 0xCM/arrows
    /// <summary>
    /// Measures the respective times required to execute a pair of functions, each of which
    /// iterate a computational block a specified number of times
    /// </summary>
    /// <param name="n">The number of computational block iterations</param>
    /// <param name="left">The first function</param>
    /// <param name="right">THe second function</param>
    public static OpTimePair measure(long n, string leftLabel, string rightLabel, Action <long> left, Action <long> right)
    {
        var lTimer = stopwatch();

        left(n);
        var lTime  = OpTime.Define(n, snapshot(lTimer), leftLabel);
        var rTimer = stopwatch();

        right(n);
        var        rTime  = OpTime.Define(n, snapshot(rTimer), rightLabel);
        OpTimePair result = (lTime, rTime);

        return(result);
    }