我在一个while循环中运行这个代码大约10000次,我注意到timeSpent大约是4,除了第一次,大约是500,为什么?
Stopwatch s;
long price;
count = 10000;
while (count!=0)
{
s = Stopwatch.StartNew();
price = classA.Method(..some inputs...); //this method do some iterations to return back a long given some inputs
s.Stop();
timeSpent = s.ElapsedTicks / (Stopwatch.Frequency / (1000L * 1000L));
s.Reset();
/*write the price, timeSpent and inputs into a .txt file*/
count--;
}