public static bool TakeMillis(double milliSecTarget) { PerformanceMetricsHelper.ExecCpuBound( context => { var currentMillis = (context.CurrentUserTime - context.InitialUserTime).TotalMilliseconds; return milliSecTarget > currentMillis; }); return true; }
public static bool TakeNanos(long nanoSecTarget) { if (nanoSecTarget < 100) { throw new EPException("CPU time wait nsec less then zero, was " + nanoSecTarget); } PerformanceMetricsHelper.ExecCpuBound( context => { var currentMillis = (context.CurrentUserTime - context.InitialUserTime).TotalMilliseconds; var currentNanos = 1000000L * currentMillis; return nanoSecTarget > currentNanos; }); return true; }