DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ TestClassTimeData()

TFResult EnProfilerTests::TestClassTimeData ( )
inlineprivate

См. определение в файле EnProfilerTests.c строка 381

382 {
383 // We should restore this when done
384 int resolution = EnProfiler.GetTimeResolution();
385 bool wasEnabled = EnProfiler.RequestImmediateData();
386
387 // GetTickTime() returns in seconds, so gather the results in seconds too
388 EnProfiler.SetTimeResolution(1);
389
390 // Create the classes
391 EPTHelperClass clss = new EPTHelperClass();
392
393 // Time to stress
394 float previousTime = EnProfiler.GetTimeOfClass(clss.Type(), true);
395 float timeStressed = clss.DoEverything();
396 float postTime = EnProfiler.GetTimeOfClass(clss.Type(), true);
397 float postTimeStatic = EnProfiler.GetTimeOfClass(StaticGetType(EPTHelperClass), true);
398 float timeProfiled = postTime - previousTime;
399 float diff = Math.AbsFloat(timeProfiled - timeStressed);
400
401 Debug.TFLog(string.Format("Profiling result: stressed: %1 | profiled: %2 | diff: %3", timeStressed, timeProfiled, diff), this, "TestClassTimeData");
402
403 // Restore
404 EnProfiler.SetTimeResolution(resolution);
405 if (!wasEnabled)
406 EnProfiler.Enable(false, true);
407
408 // We called the function, so it must have some time
409 if (!Assert(postTime > 0))
410 {
411 return NTFR(TFR.FAIL);
412 }
413
414 if (!Assert(postTime == postTimeStatic))
415 {
416 return NTFR(TFR.FAIL);
417 }
418
419 if (!Assert(diff < 0.001))
420 {
421 return NTFR(TFR.FAIL);
422 }
423
424 return NTFR(TFR.SUCCESS);
425 }
TFResult NTFR(TFR result)
Определения TestFramework.c:273
bool Assert(bool condition)
Определения TestFramework.c:262
TFR
Определения TestFramework.c:2
void Debug()
Определения UniversalTemperatureSource.c:349

Перекрестные ссылки Math::AbsFloat(), Assert(), EnProfiler::Enable(), EnProfiler::GetTimeOfClass(), EnProfiler::GetTimeResolution(), NTFR(), EnProfiler::RequestImmediateData(), EnProfiler::SetTimeResolution(), Debug::TFLog() и TFResult().