를 측정 할 것 : 내 DoSomething()
방법 내에서스톱워치, 모든 작업에서 첨가제가 될 나는 루프에서 실행하고 다음과 같은 방식으로 작업을 발로있어 바로 작업 간격을
var iResult = new List<Task>();
foreach(var i in myCollection)
{
var task = Task.Factory.StartNew(() =>
DoSomething(), TaskCreationOptions.LongRunning);
task.ContinueWith(m => myResponseHandler(m.Result));
iResult.Add(task);
}
, I 타이머 가지고있다 - 첫 번째에 ElaspedMilliseconds 300이 될 수도 있지만 마지막은 50000 (50초)이 될 수 나는 myMsg
's를 ElaspedMilliseconds 내 목록을 반복하면
public static myMsg DoSomething()
{
var timer = System.Diagnostics.Stopwatch.StartNew();
DoLongRunningTask(); //If it matters this hits a REST endpoint (https)
timer.Stop();
return new myMsg(timer.ElaspedMilliseconds);
}
완전히 첨가제 것 같다 - 실제로는 pproximate (전체 타이머가 다른 타이머에 의해 측정 됨) 실행에 걸리는 시간.
[내 답변] (http://stackoverflow.com/a/16259019/200449)이 업데이트되었습니다. ElapsedMilliseconds 값은 늘리는 순서대로 항상 출력되기 때문에 단지 거짓으로 보입니다. - 작업이 완료된 순서대로 (작업의 순서대로) 작업이 시작된 순서가 아닙니다. –