This example shows how to use Yeppp! library to do cross-platform measurements of execution time using high-frequency system timer:
using System;
class SystemTimer
{
public static void Main(string[] args)
{
const int arraySize = 1024*1024*16;
int[] array = new int[arraySize];
Random rng = new Random();
for (int i = 0; i < arraySize; i++)
{
array[i] = rng.Next();
}
ulong frequency = Yeppp.Library.GetTimerFrequency();
ulong startTime = Yeppp.Library.GetTimerTicks();
Array.Sort(array);
ulong endTime = Yeppp.Library.GetTimerTicks();
ulong time = endTime - startTime;
double timeSecs = ((double)time) / ((double)frequency);
Console.WriteLine("Executed in {0:F2} secs", timeSecs);
}
}