Hi All,
I need to measure a process time in c# for a algorithm and did a test as follow.
1. Setting the ProcessorAffinity mask of the process.
Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(2); // make the process use the second core or processor which is usually less loaded than the first
2. Setting the process and thread priority.
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; // Set process priority to high
Thread.CurrentThread.Priority = ThreadPriority.Highest; // Set thread priority as Highest
3. A period of 1000-1500 ms Warm Up for CPU cache and pipelines stabilization .
while (StopWatch.ElapsedMilliseconds() <= 1500) //CPU warm-up process for for CPU cache and pipelines stabilization. it runs around 1000ms-1500ms period
{
MyAlgorithm();
}
4. Restart the StopWatch.
5. Start MyAlgorithm();
6. After completed the process, Stop the stopwatch and get the elapsed time in Milliseconds.
My question is "should I use the same MyAlgorithm() to warm up process in above 3rd step, or we can use any process like a long for loop?"
that mean should I use the exactly same process which I'm going to measure process time for CPU warm Up process? or just can we use any process inside warm up while loop?
Thank you..