482 {
483
484 int resolution = EnProfiler.GetTimeResolution();
485 bool wasEnabled = EnProfiler.RequestImmediateData();
486
487
488 EnProfiler.SetTimeResolution(1);
489
490
491 float previousTime = EnProfiler.GetTimeOfFunc(
"StringFormat",
Type(),
true);
493 float postTime = EnProfiler.GetTimeOfFunc(
"StringFormat",
Type(),
true);
494 float timeProfiled = postTime - previousTime;
495 float diff = Math.AbsFloat(timeProfiled - timeStressed);
496
497 float previousTime2 = EnProfiler.GetTimeOfFunc(
"StringConcat",
Type(),
true);
499 float postTime2 = EnProfiler.GetTimeOfFunc(
"StringConcat",
Type(),
true);
500 float timeProfiled2 = postTime2 - previousTime2;
501 float diff2 = Math.AbsFloat(timeProfiled2 - timeStressed2);
502
503 Debug.TFLog(
string.Format(
"Profiling result: StringFormat: %1 | StringConcat: %2", timeProfiled, timeProfiled2),
this,
"TestFuncTimeData");
504
505
506 EnProfiler.SetTimeResolution(resolution);
507 if (!wasEnabled)
508 {
509 EnProfiler.Enable(false, true);
510 }
511
512
513 if (!
Assert(postTime > 0))
514 {
516 }
517
518 if (!
Assert(diff < 0.001))
519 {
521 }
522
523 if (!
Assert(postTime2 > 0))
524 {
526 }
527
528 if (!
Assert(diff2 < 0.001))
529 {
531 }
532
533
534 if (!
Assert(timeProfiled < timeProfiled2))
535 {
537 }
538
540 }
TFResult NTFR(TFR result)
bool Assert(bool condition)