382 {
383
384 int resolution = EnProfiler.GetTimeResolution();
385 bool wasEnabled = EnProfiler.RequestImmediateData();
386
387
388 EnProfiler.SetTimeResolution(1);
389
390
391 EPTHelperClass clss = new EPTHelperClass();
392
393
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
404 EnProfiler.SetTimeResolution(resolution);
405 if (!wasEnabled)
406 EnProfiler.Enable(false, true);
407
408
409 if (!
Assert(postTime > 0))
410 {
412 }
413
414 if (!
Assert(postTime == postTimeStatic))
415 {
417 }
418
419 if (!
Assert(diff < 0.001))
420 {
422 }
423
425 }
TFResult NTFR(TFR result)
bool Assert(bool condition)