本文整理汇总了C#中Timer.Check方法的典型用法代码示例。如果您正苦于以下问题:C# Timer.Check方法的具体用法?C# Timer.Check怎么用?C# Timer.Check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer.Check方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(String[] args)
{
SystemInfo();
int range = 200000;
Timer t = new Timer();
var factors200000 = countStreamParallelChunk(range);
// PrintFew(15, factors200000);
int[] histogram = FactorFrequencies(range, factors200000);
Console.WriteLine("Time = {0,8:F3} sec", t.Check());
PrintFew(15, histogram);
}
示例2: Main
public static void Main(String[] args)
{
{
Timer t = new Timer();
List<int>[] factors200000 = new List<int>[200000];
for (int n=0; n<200000; n++)
factors200000[n] = Factors(n);
PrintHistogram();
Console.WriteLine("{0:F3} sec", t.Check());
}
histogram = new int[200000];
{
Timer t = new Timer();
List<int>[] factors200000 = new List<int>[200000];
Parallel.For(0, 200000,
n => { factors200000[n] = Factors(n); });
PrintHistogram();
Console.WriteLine("{0:F3} sec", t.Check());
}
}
示例3: Mark7
public static double Mark7(String msg, Func<int,double> f)
{
int n = 10, count = 1, totalCount = 0;
double dummy = 0.0, runningTime = 0.0, st = 0.0, sst = 0.0;
do {
count *= 2;
st = sst = 0.0;
for (int j=0; j<n; j++) {
Timer t = new Timer();
for (int i=0; i<count; i++)
dummy += f(i);
runningTime = t.Check();
double time = runningTime * 1e6 / count;
st += time;
sst += time * time;
totalCount += count;
}
} while (runningTime < 0.25 && count < Int32.MaxValue/2);
double mean = st/n, sdev = Math.Sqrt(sst/n - mean*mean);
Console.WriteLine("{0,-25} {1,15:F1} us {2,10:F2} {3,10:D}", msg, mean, sdev, count);
return dummy / totalCount;
}