DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
EnProfilerTests.c
См. документацию.
2{
5
6 //---------------------------------------------------------------------------
7 // Ctor - Decides the tests to run
8 //---------------------------------------------------------------------------
10 {
12
13 AddInitTest("TestToggling");
14 AddInitTest("TestTogglingImmediate");
15 AddInitTest("TestSetFlags");
16 AddInitTest("TestClearFlags");
17 AddInitTest("TestAddFlags");
18 AddInitTest("TestModule");
19 AddInitTest("TestClassTimeData");
20 AddInitTest("TestClassCountData");
21 AddInitTest("TestFuncTimeData");
22 AddInitTest("TestFuncCountData");
23 }
24
25 //---------------------------------------------------------------------------
26 // Dtor
27 //---------------------------------------------------------------------------
32
33 //---------------------------------------------------------------------------
34 // Tests
35 //---------------------------------------------------------------------------
36 // Test toggling state
38 {
39 bool currentlyEnabled = EnProfiler.IsEnabledP();
40 EnProfiler.Enable(!currentlyEnabled);
41 if (Assert(currentlyEnabled != EnProfiler.IsEnabledP()))
42 {
43 EnProfiler.Enable(currentlyEnabled);
44 return BTFR(Assert(currentlyEnabled == EnProfiler.IsEnabledP()));
45 }
46
47 return NTFR(TFR.FAIL);
48 }
49
50 //---------------------------------------------------------------------------
51 // Test toggling immediate state
53 {
54 bool currentlyEnabled = EnProfiler.IsEnabledC();
55 EnProfiler.Enable(!currentlyEnabled, true);
56 if (Assert(currentlyEnabled != EnProfiler.IsEnabledC()))
57 {
58 EnProfiler.Enable(currentlyEnabled, true);
59 return BTFR(Assert(currentlyEnabled == EnProfiler.IsEnabledC()));
60 }
61
62 return NTFR(TFR.FAIL);
63 }
64
65 //---------------------------------------------------------------------------
66 // Test SetFlags/GetFlags
68 {
69 int currentFlags = EnProfiler.GetFlags();
70
71 for (int i = 0; i < EnumTools.GetEnumSize(EnProfilerFlags); ++i)
72 {
74 EnProfiler.SetFlags(flags);
75
76 if (!Assert(EnProfiler.GetFlags() == flags))
77 {
78 EnProfiler.SetFlags(currentFlags);
79 return NTFR(TFR.FAIL);
80 }
81
82 for (int j = 0; j < EnumTools.GetEnumSize(EnProfilerFlags); ++j)
83 {
85 EnProfiler.SetFlags(flags);
86
87 if (!Assert(EnProfiler.GetFlags() == flags))
88 {
89 EnProfiler.SetFlags(currentFlags);
90 return NTFR(TFR.FAIL);
91 }
92 }
93 }
94
95 // Let's test some bogus
96 EnProfiler.SetFlags(-333);
97 int bogusFlags = EnProfiler.GetFlags();
98 bogusFlags &= ~EnProfilerFlags.ALL;
99 if (!Assert(bogusFlags == 0))
100 {
101 EnProfiler.SetFlags(currentFlags);
102 return NTFR(TFR.FAIL);
103 }
104
105 bogusFlags = EnProfiler.SetFlags(6003);
106 bogusFlags &= ~EnProfilerFlags.ALL;
107 if (!Assert(bogusFlags == 0))
108 {
109 EnProfiler.SetFlags(currentFlags);
110 return NTFR(TFR.FAIL);
111 }
112
113 // Reset
114 EnProfiler.SetFlags(currentFlags);
115 return NTFR(TFR.SUCCESS);
116 }
117
118 //---------------------------------------------------------------------------
119 // Test removing of flags
121 {
122 int currentFlags = EnProfiler.GetFlags();
123
125
127 {
128 EnProfiler.SetFlags(currentFlags);
129 return NTFR(TFR.FAIL);
130 }
131
134
136 {
137 EnProfiler.SetFlags(currentFlags);
138 return NTFR(TFR.FAIL);
139 }
140
143
145 {
146 EnProfiler.SetFlags(currentFlags);
147 return NTFR(TFR.FAIL);
148 }
149
150 // Reset
151 EnProfiler.SetFlags(currentFlags);
152 return NTFR(TFR.SUCCESS);
153 }
154
155 //---------------------------------------------------------------------------
156 // Test adding of flags
158 {
159 int currentFlags = EnProfiler.GetFlags();
160
162
163 // Return should match resulting flags
165 {
166 EnProfiler.SetFlags(currentFlags);
167 return NTFR(TFR.FAIL);
168 }
169
170 if (!Assert(EnProfiler.GetFlags() == EnProfilerFlags.RESET))
171 {
172 EnProfiler.SetFlags(currentFlags);
173 return NTFR(TFR.FAIL);
174 }
175
176 if (!Assert(EnProfiler.AddFlags(EnProfilerFlags.RECURSIVE) == (EnProfilerFlags.RESET | EnProfilerFlags.RECURSIVE)))
177 {
178 EnProfiler.SetFlags(currentFlags);
179 return NTFR(TFR.FAIL);
180 }
181
182 // Reset
183 EnProfiler.SetFlags(currentFlags);
184 return NTFR(TFR.SUCCESS);
185 }
186
187 //---------------------------------------------------------------------------
188 // Test module
190 {
191 // File lives in Game, use it while testing
192 const EnProfilerModule eptModule = EnProfilerModule.GAME;
193
194 // This was added at the same time as this API, so check if it works as well
195 string nameOfCurrentModule = Type().GetModule();
196 if (!Assert(nameOfCurrentModule != ""))
197 {
198 return NTFR(TFR.FAIL);
199 }
200
201 // We know we are in Game, so use it as a test
202 EnProfilerModule currentModule;
203 if (!Assert(EnProfiler.NameToModule(nameOfCurrentModule, currentModule)))
204 {
205 return NTFR(TFR.FAIL);
206 }
207
208 if (!Assert(currentModule == eptModule))
209 {
210 return NTFR(TFR.FAIL);
211 }
212
213 // Test if setting and getting works
214 EnProfilerModule currentlyProfiledModule = EnProfiler.GetModule();
215 EnProfiler.SetModule(eptModule);
216
217 if (!Assert(EnProfiler.GetModule() == eptModule))
218 {
219 EnProfiler.SetModule(currentlyProfiledModule);
220 return NTFR(TFR.FAIL);
221 }
222
223 // Data to restore
224 int currentFlags = EnProfiler.GetFlags();
225 bool wasEnabled = EnProfiler.RequestImmediateData();
226
227 // Make sure we are only profiling Game and that the data is clean
228 // Only valid for the Get...Per... methods, as they need to be sorted
230
231 // GetTickTime() returns in seconds, so gather the results in seconds too
232 int resolution = EnProfiler.GetTimeResolution();
234
235 // Time to sleeb
236 float previousTime = EnProfiler.GetTimeOfFunc("Sleep", Type(), true);
237 float timeSlept = Sleep(0.3);
238 float postTime = EnProfiler.GetTimeOfFunc("Sleep", Type(), true);
239 float diff = postTime - previousTime - timeSlept;
240
241 // Restore
242 EnProfiler.SetTimeResolution(resolution);
243
244 // We called the function, so it must have some time
245 if (!Assert(postTime > 0))
246 {
247 EnProfiler.SetFlags(currentFlags);
248
249 if (!wasEnabled)
250 EnProfiler.Enable(false, true);
251
252 EnProfiler.SetModule(currentlyProfiledModule);
253
254 return NTFR(TFR.FAIL);
255 }
256
257 if (!Assert(diff < 0.00001))
258 {
259 EnProfiler.SetFlags(currentFlags);
260
261 if (!wasEnabled)
262 EnProfiler.Enable(false, true);
263
264 EnProfiler.SetModule(currentlyProfiledModule);
265
266 return NTFR(TFR.FAIL);
267 }
268
269 // Clean the session
271
272 // Something from a different module should not get sorted, so just fire something from a different module
273 for (int i = 0; i < 1000; ++i)
274 {
275 EnumTools.StringToEnum(EnProfilerModule, "MISSION_CUSTOM");
276 }
277
278 // Sort and gather the data and validate if it is correct
280 array<ref EnProfilerTimeFuncPair> timePerFunc = {};
281 EnProfiler.GetTimePerFunc(timePerFunc);
282
283 Debug.TFLog("Game fncs:", this, "TestModule");
284
285 int funcCount = timePerFunc.Count();
286 for (int j = 0; j < funcCount; ++j)
287 {
288 EnProfilerTimeFuncPair tfp = timePerFunc[j];
289 Debug.TFLog(string.Format(" time: %1 | fnc: %2", tfp.param1, tfp.param2), this, "TestModule");
290 // We are currently profiling Game, so this Core function shouldn't be present
291 if (!Assert(tfp.param2 != "EnumTools::StringToEnum"))
292 {
293 EnProfiler.SetFlags(currentFlags);
294
295 if (!wasEnabled)
296 EnProfiler.Enable(false, true);
297
298 EnProfiler.SetModule(currentlyProfiledModule);
299
300 return NTFR(TFR.FAIL);
301 }
302 }
303
304 array<ref EnProfilerTimeClassPair> timePerClass = {};
305 EnProfiler.GetTimePerClass(timePerClass);
306
307 int classCount = timePerClass.Count();
308 for (int k = 0; k < classCount; ++k)
309 {
310 typename type = timePerClass[k].param2;
311 EnProfilerModule classModule;
312 if (!Assert(EnProfiler.NameToModule(type.GetModule(), classModule)))
313 {
314 EnProfiler.SetFlags(currentFlags);
315
316 if (!wasEnabled)
317 EnProfiler.Enable(false, true);
318
319 EnProfiler.SetModule(currentlyProfiledModule);
320
321 return NTFR(TFR.FAIL);
322 }
323
324 // Only classes from Game should be present
325 if (!Assert(classModule == eptModule))
326 {
327 EnProfiler.SetFlags(currentFlags);
328
329 if (!wasEnabled)
330 EnProfiler.Enable(false, true);
331
332 EnProfiler.SetModule(currentlyProfiledModule);
333
334 return NTFR(TFR.FAIL);
335 }
336 }
337
338 // Now let's check if we can gather the data of what we called earlier by switching the profiled module without resetting the session
341 timePerFunc.Clear(); // Let's reuse the array, but the Get...Per... methods only appends to the array, clearing is our responsibility
342 EnProfiler.GetTimePerFunc(timePerFunc);
343
344 bool found = false;
345
346 Debug.TFLog("Core fncs:", this, "TestModule");
347
348 funcCount = timePerFunc.Count();
349 for (int l = 0; l < funcCount; ++l)
350 {
351 EnProfilerTimeFuncPair tfpc = timePerFunc[l];
352 Debug.TFLog(string.Format(" time: %1 | fnc: %2", tfpc.param1, tfpc.param2), this, "TestModule");
353 // We are currently profiling Core, so this Core function should be present
354 if (tfpc.param2 == "EnumTools::StringToEnum")
355 {
356 found = true;
357 break;
358 }
359 }
360
361 Assert(found);
362
363 // Test some bogus
365 EnProfiler.SetModule(-333);
366 bool success = Assert(EnProfiler.GetModule() == mod);
367 EnProfiler.SetModule(6003);
368 success &= Assert(EnProfiler.GetModule() == mod);
369
370 EnProfiler.SetFlags(currentFlags);
371 EnProfiler.SetModule(currentlyProfiledModule);
372
373 if (!wasEnabled)
374 EnProfiler.Enable(false, true);
375
376 return BTFR(success && found);
377 }
378
379 //---------------------------------------------------------------------------
380 // Test to see if class time data is correct
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
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 }
426
427 //---------------------------------------------------------------------------
428 // Test to see if class count data is correct
430 {
431 const int allocAmount = 9;
432 const int releaseAmount = 6;
433 int remainingAmount = allocAmount - releaseAmount;
434
435 // We should restore this when done
436 bool wasEnabled = EnProfiler.RequestImmediateData();
437
438 // Time to test
439 int previousAlloc = EnProfiler.GetAllocationsOfClass(StaticGetType(EPTHelperClass), true);
440 int previousInstances = EnProfiler.GetInstancesOfClass(StaticGetType(EPTHelperClass), true);
441
442 array<ref EPTHelperClass> instanceArr = {};
443 for (int i = 0; i < allocAmount; ++i)
444 {
445 instanceArr.Insert(new EPTHelperClass());
446 }
447
448 for (int j = 0; j < releaseAmount; ++j)
449 {
450 delete instanceArr[j];
451 }
452
453 int postAlloc = EnProfiler.GetAllocationsOfClass(StaticGetType(EPTHelperClass), true);
454 int postInstances = EnProfiler.GetInstancesOfClass(StaticGetType(EPTHelperClass), true);
455
456 int alloced = postAlloc - previousAlloc;
457 int instances = postInstances - previousInstances;
458
459 Debug.TFLog(string.Format("Profiling result: alloc: %1 | instances: %2", alloced, instances), this, "TestClassCountData");
460
461 // Restore
462 if (!wasEnabled)
463 EnProfiler.Enable(false, true);
464
465 // Time to check
466 if (!Assert(alloced == allocAmount))
467 {
468 return NTFR(TFR.FAIL);
469 }
470
471 if (!Assert(instances == remainingAmount))
472 {
473 return NTFR(TFR.FAIL);
474 }
475
476 return NTFR(TFR.SUCCESS);
477 }
478
479 //---------------------------------------------------------------------------
480 // Test to see if func time data is correct
482 {
483 // We should restore this when done
484 int resolution = EnProfiler.GetTimeResolution();
485 bool wasEnabled = EnProfiler.RequestImmediateData();
486
487 // GetTickTime() returns in seconds, so gather the results in seconds too
489
490 // Time to stress
491 float previousTime = EnProfiler.GetTimeOfFunc("StringFormat", Type(), true);
492 float timeStressed = StringFormat();
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);
498 float timeStressed2 = StringConcat();
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 // Restore
506 EnProfiler.SetTimeResolution(resolution);
507 if (!wasEnabled)
508 {
509 EnProfiler.Enable(false, true);
510 }
511
512 // We called the function, so it must have some time
513 if (!Assert(postTime > 0))
514 {
515 return NTFR(TFR.FAIL);
516 }
517
518 if (!Assert(diff < 0.001))
519 {
520 return NTFR(TFR.FAIL);
521 }
522
523 if (!Assert(postTime2 > 0))
524 {
525 return NTFR(TFR.FAIL);
526 }
527
528 if (!Assert(diff2 < 0.001))
529 {
530 return NTFR(TFR.FAIL);
531 }
532
533 // I know that string.Format is faster than additive concatenation
534 if (!Assert(timeProfiled < timeProfiled2))
535 {
536 return NTFR(TFR.FAIL);
537 }
538
539 return NTFR(TFR.SUCCESS);
540 }
541
542 //---------------------------------------------------------------------------
543 // Test to see if func count data is correct
545 {
546 // We should restore this when done
547 bool wasEnabled = EnProfiler.RequestImmediateData();
548
549 // Time to count
550
551 // - CallFunction
552 int previousCountCF = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
553 GetGame().GameScript.CallFunction(this, "TestFuncCountDataHelper", null, 0);
554 int postCountCF = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
555
556 int callCountCF = postCountCF - previousCountCF;
557
558 // - CallFunctionParams
559 int previousCountCFP = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
560 GetGame().GameScript.CallFunctionParams(this, "TestFuncCountDataHelper", null, null);
561 int postCountCFP = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
562
563 int callCountCFP = postCountCFP - previousCountCFP;
564
565 // - Regular call
566 int previousCountRG = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
568 int postCountRG = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
569
570 int callCountRG = postCountRG - previousCountRG;
571
572 // - Call
573 int previousCountC = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
574 GetGame().GameScript.Call(this, "TestFuncCountDataHelper", 0);
575 int postCountC = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
576
577 int callCountC = postCountC - previousCountC;
578
579 // - Garbage
580 int callCountNon = EnProfiler.GetCountOfFunc("Non Existing Method", Type(), true);
581
582 // - Static
583 int previousCountS = EnProfiler.GetCountOfFunc("TestFuncCountDataHelperStatic", Type(), true);
585 int postCountS = EnProfiler.GetCountOfFunc("TestFuncCountDataHelperStatic", Type(), true);
586
587 int callCountS = postCountS - previousCountS;
588
589 // - Global
590 int previousCountG = EnProfiler.GetCountOfFuncG("GetDayZGame", true);
591 GetDayZGame();
592 int postCountG = EnProfiler.GetCountOfFuncG("GetDayZGame", true);
593
594 int callCountG = postCountG - previousCountG;
595
596 // - Global proto
597 // Not tracked, so don't need to compare before and after, should always be 0
598 ErrorEx("Testing global proto call", ErrorExSeverity.INFO);
599 int callCountGP = EnProfiler.GetCountOfFuncG("ErrorEx", true);
600
601 // - Static proto
602 // Not tracked, so don't need to compare before and after, should always be 0
603 int callCountSP = EnProfiler.GetCountOfFunc("GetCountOfFunc", StaticGetType(EnProfiler), true);
604
605 // - proto
606 // Not tracked, so don't need to compare before and after, should always be 0
608 int callCountP = EnProfiler.GetCountOfFunc("GetHostName", GetGame().Type(), true);
609
610 // - proto native
611 // Not tracked, so don't need to compare before and after, should always be 0
612 GetGame().IsServer();
613 int callCountPN = EnProfiler.GetCountOfFunc("IsServer", GetGame().Type(), true);
614
615 // - static proto native
616 // Not tracked, so don't need to compare before and after, should always be 0
618 int callCountSPN = EnProfiler.GetCountOfFunc("GetInstance", StaticGetType(ErrorModuleHandler), true);
619
620 // Restore
621 if (!wasEnabled)
622 {
623 EnProfiler.Enable(false, true);
624 }
625
626 // Do the checks
627
628 // - CallFunction
629 if (!Assert(callCountCF == 1))
630 {
631 return NTFR(TFR.FAIL);
632 }
633
634 // - CallFunctionParams
635 if (!Assert(callCountCFP == 1))
636 {
637 return NTFR(TFR.FAIL);
638 }
639
640 // - Regular call
641 if (!Assert(callCountRG == 1))
642 {
643 return NTFR(TFR.FAIL);
644 }
645
646 // - Call
647 if (!Assert(callCountC == 1))
648 {
649 return NTFR(TFR.FAIL);
650 }
651
652 // - Garbage
653 if (!Assert(callCountNon == -1))
654 {
655 return NTFR(TFR.FAIL);
656 }
657
658 // - Static
659 if (!Assert(callCountS == 1))
660 {
661 return NTFR(TFR.FAIL);
662 }
663
664 // - Global
665 if (!Assert(callCountG == 1))
666 {
667 return NTFR(TFR.FAIL);
668 }
669
670 // - Global proto
671 if (!Assert(callCountGP == 0))
672 {
673 return NTFR(TFR.FAIL);
674 }
675
676 // - Static proto
677 if (!Assert(callCountSP == 0))
678 {
679 return NTFR(TFR.FAIL);
680 }
681
682 // - proto
683 if (!Assert(callCountP == 0))
684 {
685 return NTFR(TFR.FAIL);
686 }
687
688 // - proto native
689 if (!Assert(callCountPN == 0))
690 {
691 return NTFR(TFR.FAIL);
692 }
693
694 // - static proto native
695 if (!Assert(callCountSPN == 0))
696 {
697 return NTFR(TFR.FAIL);
698 }
699
700 return NTFR(TFR.SUCCESS);
701 }
702
703 //---------------------------------------------------------------------------
704 // Helpers
705 //---------------------------------------------------------------------------
706 // Snore
707 float Sleep(float timeS)
708 {
709 float startTime = GetGame().GetTickTime();
710 while (GetGame().GetTickTime() - startTime < timeS)
711 {
712 // Zzz
713 }
714
715 return GetGame().GetTickTime() - startTime;
716 }
717
718 //---------------------------------------------------------------------------
719 // Example stress method
721 {
722 float startTime = GetGame().GetTickTime();
723
724 for (int i = 0; i < 1000; ++i)
725 {
726 string example = string.Format("This %1 is %2 just %3 an %4 example %5", i, Type(), this, startTime, "lorem ipsum 1 2 3");
727 }
728
729 return GetGame().GetTickTime() - startTime;
730 }
731
732 //---------------------------------------------------------------------------
733 // Example stress method 2
735 {
736 float startTime = GetGame().GetTickTime();
737
738 for (int i = 0; i < 1000; ++i)
739 {
740 string example = "This " + i + " is " + Type() + " just " + this + " an " + startTime + " example " + "lorem ipsum 1 2 3";
741 }
742
743 return GetGame().GetTickTime() - startTime;
744 }
745
746 //---------------------------------------------------------------------------
747 // To make sure it is only ever called in that test
749 {
750 int dummy = 3;
751 }
752
753 //---------------------------------------------------------------------------
754 // To make sure it is only ever called in that test
756 {
757 int dummy = 3;
758 }
759}
760
761class EPTHelperClass
762{
763 float Sleep2(float timeS)
764 {
765 float startTime = GetGame().GetTickTime();
766 while (GetGame().GetTickTime() - startTime < timeS)
767 {
768 // Zzz
769 }
771 return GetGame().GetTickTime() - startTime;
772 }
773 float SleepAgain(float timeS)
774 {
775 float startTime = GetGame().GetTickTime();
776 while (GetGame().GetTickTime() - startTime < timeS)
777 {
778 // Zzz
779 }
780
781 return GetGame().GetTickTime() - startTime;
782 }
783
785 {
786 float startTime = GetGame().GetTickTime();
787
788 Sleep2(3);
790
791 return GetGame().GetTickTime() - startTime;
792 }
793}
DayZGame GetDayZGame()
Определения DayZGame.c:3870
float SleepAgain(float timeS)
Определения EnProfilerTests.c:773
float DoEverything()
Определения EnProfilerTests.c:784
EnProfilerTests TestFramework Sleep2(float timeS)
Определения EnProfilerTests.c:763
string Type
Определения JsonDataContaminatedArea.c:11
void TestFramework()
Определения TestFramework.c:217
TFResult NTFR(TFR result)
Определения TestFramework.c:273
bool Assert(bool condition)
Определения TestFramework.c:262
void TFResult(TFR result)
Определения TestFramework.c:12
TFR
Определения TestFramework.c:2
void AddInitTest(string test)
Определения TestFramework.c:249
TFResult BTFR(bool result)
Определения TestFramework.c:278
proto native float GetTickTime()
Returns current time from start of the game.
proto owned string GetHostName()
Gets the server name. (from client)
proto native bool IsServer()
ScriptModule GameScript
Определения Game.c:12
static void TFLog(string message=LOG_DEFAULT, TestFramework caller=null, string function="")
Определения Debug.c:177
Определения Debug.c:2
Set of methods for accessing script profiling data.
Определения EnProfiler.c:73
TFResult TestFuncCountData()
Определения EnProfilerTests.c:544
TFResult TestClearFlags()
Определения EnProfilerTests.c:120
TFResult TestModule()
Определения EnProfilerTests.c:189
void TestFuncCountDataHelper()
Определения EnProfilerTests.c:748
void EnProfilerTests()
Определения EnProfilerTests.c:9
bool m_bWasProfilerEnabled
Remember this, so we can restore the previous state before the test!
Определения EnProfilerTests.c:4
float StringFormat()
Определения EnProfilerTests.c:720
TFResult TestAddFlags()
Определения EnProfilerTests.c:157
void ~EnProfilerTests()
Определения EnProfilerTests.c:28
TFResult TestSetFlags()
Определения EnProfilerTests.c:67
TFResult TestTogglingImmediate()
Определения EnProfilerTests.c:52
TFResult TestToggling()
Определения EnProfilerTests.c:37
TFResult TestClassTimeData()
Определения EnProfilerTests.c:381
static void TestFuncCountDataHelperStatic()
Определения EnProfilerTests.c:755
float StringConcat()
Определения EnProfilerTests.c:734
TFResult TestClassCountData()
Определения EnProfilerTests.c:429
float Sleep(float timeS)
Определения EnProfilerTests.c:707
TFResult TestFuncTimeData()
Определения EnProfilerTests.c:481
static int GetEnumSize(typename e)
Return amount of values in enum.
Определения EnConvert.c:623
static int GetEnumValue(typename e, int idx)
Return the nth value in the enum.
Определения EnConvert.c:634
static int StringToEnum(typename e, string enumName)
Return enum value from string name.
Определения EnConvert.c:612
Определения EnConvert.c:590
static proto native ErrorModuleHandler GetInstance()
Gets the EMH Instance.
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
Определения ErrorModuleHandler.c:29
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx
proto volatile int CallFunctionParams(Class inst, string function, out void returnVal, Class parms)
proto volatile int Call(Class inst, string function, void parm)
proto volatile int CallFunction(Class inst, string function, out void returnVal, void parm)
static proto float AbsFloat(float f)
Returns absolute value.
static proto int GetTimeResolution()
Get the currently set time resolution.
static proto EnProfilerModule GetModule()
Get the currently profiled module.
static proto void GetTimePerFunc(notnull out array< ref EnProfilerTimeFuncPair > outArr, int count=int.MAX)
Obtain [SD] for Time Per Function.
Param2< float, string > EnProfilerTimeFuncPair
Определения EnProfiler.c:58
static proto int GetAllocationsOfClass(typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the allocations of a specific class.
static proto float GetTimeOfClass(typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the time a specific class consumed.
static proto int GetCountOfFunc(string funct, typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the amount of times a specific function was called.
static proto int GetFlags()
Get the currently used flags across the API.
static proto int ClearFlags(bool sessionReset=true)
Remove all flags from the currently used set of EnProfilerFlags across the API.
static proto float GetTimeOfFunc(string funct, typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the time consumed by a specific function.
static proto void SetTimeResolution(int resolution)
Set the resolution of the fetched Time data.
static proto void SortData()
The internal sorting that happens at the end of the frame (so it is NOT necessary to call this manual...
static proto void SetModule(EnProfilerModule module, bool sessionReset=true)
Set the module to be profiled.
static proto void ResetSession(bool fullReset=false)
Perform [SR], clearing SessionFrame, ProfiledSessionFrames, [SD] and [PD] (except for [CI])
static bool IsEnabledP()
Return if script profiling is enabled through EnProfiler.
Определения EnProfiler.c:138
static bool IsEnabledC()
Return if script profiling is actually turned on inside of the script context.
Определения EnProfiler.c:152
static proto int GetInstancesOfClass(typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the [CI] of a specific class.
EnProfilerFlags
Flags that influences the behaviour of the EnProfiler API, applied through ...Flags functions.
Определения EnProfiler.c:9
static proto void GetTimePerClass(notnull out array< ref EnProfilerTimeClassPair > outArr, int count=int.MAX)
Obtain [SD] for Time Per Class.
static proto int SetFlags(int flags, bool sessionReset=true)
Override the currently used set of EnProfilerFlags across the API.
static proto void Enable(bool enable, bool immediate=false, bool sessionReset=true)
Enable the gathering of script profiling data.
EnProfilerModule
Current base scripted modules.
Определения EnProfiler.c:22
static proto bool NameToModule(string moduleName, out EnProfilerModule module)
Convert string to EnProfilerModule.
static bool RequestImmediateData()
Helper method to ascertain the profiler will record [PD] right after this call.
Определения EnProfiler.c:745
static proto int RemoveFlags(int flags, bool sessionReset=true)
Remove flags from the currently used set of EnProfilerFlags across the API.
static proto int GetCountOfFuncG(string funct, bool immediate=false)
Obtain [SD] or [PD] regarding the amount of times a specific function was called.
static proto int AddFlags(int flags, bool sessionReset=true)
Add flags to the currently used set of EnProfilerFlags across the API.