09/07/27 20:17:27
>>375
よくわかんないけどこういうこと?
Stopwatch sw = new Stopwatch();
long nextTiming = sw.ElapsedMilliseconds + 10;
sw.Start();
while (true)
{
while (sw.ElapsedMilliseconds < nextTiming) { Thread.Sleep(0); }
nextTiming += 10;
Console.WriteLine("Now is {0} ms", sw.ElapsedMilliseconds);
}
Thread.Sleep(1)にしてやればCPU使用率は無駄に上がらない。
その場合、処理のインターバルの精度は落ちるけど、時間あたりの処理回数の精度は
保てるといってよいんじゃないか。