DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс EnProfilerTests
+ Граф наследования:EnProfilerTests:

Закрытые члены

void EnProfilerTests ()
 
void ~EnProfilerTests ()
 
TFResult TestToggling ()
 
TFResult TestTogglingImmediate ()
 
TFResult TestSetFlags ()
 
TFResult TestClearFlags ()
 
TFResult TestAddFlags ()
 
TFResult TestModule ()
 
TFResult TestClassTimeData ()
 
TFResult TestClassCountData ()
 
TFResult TestFuncTimeData ()
 
TFResult TestFuncCountData ()
 
float Sleep (float timeS)
 
float StringFormat ()
 
float StringConcat ()
 
void TestFuncCountDataHelper ()
 

Закрытые статические члены

static void TestFuncCountDataHelperStatic ()
 

Закрытые данные

bool m_bWasProfilerEnabled
 Remember this, so we can restore the previous state before the test!
 

Подробное описание

Конструктор(ы)

◆ EnProfilerTests()

void EnProfilerTests ( )
inlineprivate
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 }
void AddInitTest(string test)
Definition TestFramework.c:249
Set of methods for accessing script profiling data.
Definition EnProfiler.c:73
bool m_bWasProfilerEnabled
Remember this, so we can restore the previous state before the test!
Definition EnProfilerTests.c:4
static bool IsEnabledC()
Return if script profiling is actually turned on inside of the script context.
Definition EnProfiler.c:152

Перекрестные ссылки AddInitTest(), EnProfiler::IsEnabledC() и m_bWasProfilerEnabled.

◆ ~EnProfilerTests()

void ~EnProfilerTests ( )
inlineprivate
29 {
31 }
static proto void Enable(bool enable, bool immediate=false, bool sessionReset=true)
Enable the gathering of script profiling data.

Перекрестные ссылки EnProfiler::Enable() и m_bWasProfilerEnabled.

Методы

◆ Sleep()

float Sleep ( float timeS)
inlineprivate
708 {
709 float startTime = GetGame().GetTickTime();
710 while (GetGame().GetTickTime() - startTime < timeS)
711 {
712 // Zzz
713 }
714
715 return GetGame().GetTickTime() - startTime;
716 }
Definition EntityAI.c:95
proto native CGame GetGame()

Перекрестные ссылки GetGame().

Используется в TestModule().

◆ StringConcat()

float StringConcat ( )
inlineprivate
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 }
string Type
Definition JsonDataContaminatedArea.c:11

Перекрестные ссылки GetGame() и Type.

Используется в TestFuncTimeData().

◆ StringFormat()

float StringFormat ( )
inlineprivate
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 }

Перекрестные ссылки GetGame() и Type.

Используется в TestFuncTimeData().

◆ TestAddFlags()

TFResult TestAddFlags ( )
inlineprivate
158 {
160
162
163 // Return should match resulting flags
165 {
167 return NTFR(TFR.FAIL);
168 }
169
170 if (!Assert(EnProfiler.GetFlags() == EnProfilerFlags.RESET))
171 {
173 return NTFR(TFR.FAIL);
174 }
175
176 if (!Assert(EnProfiler.AddFlags(EnProfilerFlags.RECURSIVE) == (EnProfilerFlags.RESET | EnProfilerFlags.RECURSIVE)))
177 {
179 return NTFR(TFR.FAIL);
180 }
181
182 // Reset
184 return NTFR(TFR.SUCCESS);
185 }
TFResult NTFR(TFR result)
Definition TestFramework.c:273
bool Assert(bool condition)
Definition TestFramework.c:262
TFR
Definition TestFramework.c:2
static proto int SetFlags(int flags, bool sessionReset=true)
Override the currently used set of EnProfilerFlags across the API.
static proto int AddFlags(int flags, bool sessionReset=true)
Add flags to the currently used set of EnProfilerFlags across the API.
static proto int GetFlags()
Get the currently used flags across the API.
EnProfilerFlags
Flags that influences the behaviour of the EnProfiler API, applied through ...Flags functions.
Definition EnProfiler.c:9
static proto int ClearFlags(bool sessionReset=true)
Remove all flags from the currently used set of EnProfilerFlags across the API.

Перекрестные ссылки EnProfiler::AddFlags(), Assert(), EnProfiler::ClearFlags(), EnProfiler::GetFlags(), NTFR() и EnProfiler::SetFlags().

◆ TestClassCountData()

TFResult TestClassCountData ( )
inlineprivate
430 {
431 const int allocAmount = 9;
432 const int releaseAmount = 6;
434
435 // We should restore this when done
437
438 // Time to test
441
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);
455
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
472 {
473 return NTFR(TFR.FAIL);
474 }
475
476 return NTFR(TFR.SUCCESS);
477 }
Definition Debug.c:14
static void TFLog(string message=LOG_DEFAULT, TestFramework caller=null, string function="")
Definition Debug.c:191
static proto int GetAllocationsOfClass(typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the allocations of a specific class.
static bool RequestImmediateData()
Helper method to ascertain the profiler will record [PD] right after this call.
Definition EnProfiler.c:745
static proto int GetInstancesOfClass(typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the [CI] of a specific class.

Перекрестные ссылки Assert(), EnProfiler::Enable(), EnProfiler::GetAllocationsOfClass(), EnProfiler::GetInstancesOfClass(), NTFR(), EnProfiler::RequestImmediateData() и Debug::TFLog().

◆ TestClassTimeData()

TFResult TestClassTimeData ( )
inlineprivate
382 {
383 // We should restore this when done
386
387 // GetTickTime() returns in seconds, so gather the results in seconds too
389
390 // Create the classes
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);
400
401 Debug.TFLog(string.Format("Profiling result: stressed: %1 | profiled: %2 | diff: %3", timeStressed, timeProfiled, diff), this, "TestClassTimeData");
402
403 // Restore
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
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 }
Definition EnMath.c:7
static proto float AbsFloat(float f)
Returns absolute value.
static proto int GetTimeResolution()
Get the currently set time resolution.
static proto void SetTimeResolution(int resolution)
Set the resolution of the fetched Time data.
static proto float GetTimeOfClass(typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the time a specific class consumed.

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

◆ TestClearFlags()

TFResult TestClearFlags ( )
inlineprivate
121 {
123
125
127 {
129 return NTFR(TFR.FAIL);
130 }
131
134
136 {
138 return NTFR(TFR.FAIL);
139 }
140
143
145 {
147 return NTFR(TFR.FAIL);
148 }
149
150 // Reset
152 return NTFR(TFR.SUCCESS);
153 }
static proto int RemoveFlags(int flags, bool sessionReset=true)
Remove flags from the currently used set of EnProfilerFlags across the API.

Перекрестные ссылки Assert(), EnProfiler::ClearFlags(), EnProfiler::GetFlags(), NTFR(), EnProfiler::RemoveFlags() и EnProfiler::SetFlags().

◆ TestFuncCountData()

TFResult TestFuncCountData ( )
inlineprivate
545 {
546 // We should restore this when done
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
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
564
565 // - Regular call
566 int previousCountRG = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
568 int postCountRG = EnProfiler.GetCountOfFunc("TestFuncCountDataHelper", Type(), true);
569
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
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
588
589 // - Global
590 int previousCountG = EnProfiler.GetCountOfFuncG("GetDayZGame", true);
591 GetDayZGame();
592 int postCountG = EnProfiler.GetCountOfFuncG("GetDayZGame", true);
593
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
607 GetGame().GetHostName();
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 }
DayZGame GetDayZGame()
Definition DayZGame.c:3817
void TestFuncCountDataHelper()
Definition EnProfilerTests.c:748
static void TestFuncCountDataHelperStatic()
Definition EnProfilerTests.c:755
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
Definition ErrorModuleHandler.c:29
static proto native ErrorModuleHandler GetInstance()
Gets the EMH Instance.
ErrorExSeverity
Definition EnDebug.c:62
enum ShapeType ErrorEx
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 GetCountOfFuncG(string funct, bool immediate=false)
Obtain [SD] or [PD] regarding the amount of times a specific function was called.

Перекрестные ссылки Assert(), EnProfiler::Enable(), ErrorEx, EnProfiler::GetCountOfFunc(), EnProfiler::GetCountOfFuncG(), GetDayZGame(), GetGame(), ErrorModuleHandler::GetInstance(), NTFR(), EnProfiler::RequestImmediateData(), TestFuncCountDataHelper(), TestFuncCountDataHelperStatic() и Type.

◆ TestFuncCountDataHelper()

void TestFuncCountDataHelper ( )
inlineprivate
749 {
750 int dummy = 3;
751 }

Используется в TestFuncCountData().

◆ TestFuncCountDataHelperStatic()

static void TestFuncCountDataHelperStatic ( )
inlinestaticprivate
756 {
757 int dummy = 3;
758 }

Используется в TestFuncCountData().

◆ TestFuncTimeData()

TFResult TestFuncTimeData ( )
inlineprivate
482 {
483 // We should restore this when done
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);
496
497 float previousTime2 = EnProfiler.GetTimeOfFunc("StringConcat", Type(), true);
498 float timeStressed2 = StringConcat();
499 float postTime2 = EnProfiler.GetTimeOfFunc("StringConcat", Type(), true);
502
503 Debug.TFLog(string.Format("Profiling result: StringFormat: %1 | StringConcat: %2", timeProfiled, timeProfiled2), this, "TestFuncTimeData");
504
505 // Restore
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
535 {
536 return NTFR(TFR.FAIL);
537 }
538
539 return NTFR(TFR.SUCCESS);
540 }
float StringFormat()
Definition EnProfilerTests.c:720
float StringConcat()
Definition EnProfilerTests.c:734
static proto float GetTimeOfFunc(string funct, typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the time consumed by a specific function.

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

◆ TestModule()

TFResult TestModule ( )
inlineprivate
190 {
191 // File lives in Game, use it while testing
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
204 {
205 return NTFR(TFR.FAIL);
206 }
207
209 {
210 return NTFR(TFR.FAIL);
211 }
212
213 // Test if setting and getting works
216
218 {
220 return NTFR(TFR.FAIL);
221 }
222
223 // Data to restore
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
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);
240
241 // Restore
243
244 // We called the function, so it must have some time
245 if (!Assert(postTime > 0))
246 {
248
249 if (!wasEnabled)
250 EnProfiler.Enable(false, true);
251
253
254 return NTFR(TFR.FAIL);
255 }
256
257 if (!Assert(diff < 0.00001))
258 {
260
261 if (!wasEnabled)
262 EnProfiler.Enable(false, true);
263
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
282
283 Debug.TFLog("Game fncs:", this, "TestModule");
284
285 int funcCount = timePerFunc.Count();
286 for (int j = 0; j < funcCount; ++j)
287 {
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 {
294
295 if (!wasEnabled)
296 EnProfiler.Enable(false, true);
297
299
300 return NTFR(TFR.FAIL);
301 }
302 }
303
306
307 int classCount = timePerClass.Count();
308 for (int k = 0; k < classCount; ++k)
309 {
310 typename type = timePerClass[k].param2;
312 if (!Assert(EnProfiler.NameToModule(type.GetModule(), classModule)))
313 {
315
316 if (!wasEnabled)
317 EnProfiler.Enable(false, true);
318
320
321 return NTFR(TFR.FAIL);
322 }
323
324 // Only classes from Game should be present
326 {
328
329 if (!wasEnabled)
330 EnProfiler.Enable(false, true);
331
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
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 {
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);
367 EnProfiler.SetModule(6003);
369
372
373 if (!wasEnabled)
374 EnProfiler.Enable(false, true);
375
376 return BTFR(success && found);
377 }
TFResult BTFR(bool result)
Definition TestFramework.c:278
float Sleep(float timeS)
Definition EnProfilerTests.c:707
Definition EnConvert.c:590
static int StringToEnum(typename e, string enumName)
Return enum value from string name.
Definition EnConvert.c:612
static proto EnProfilerModule GetModule()
Get the currently profiled module.
static proto void ResetSession(bool fullReset=false)
Perform [SR], clearing SessionFrame, ProfiledSessionFrames, [SD] and [PD] (except for [CI])
static proto void GetTimePerFunc(notnull out array< ref EnProfilerTimeFuncPair > outArr, int count=int.MAX)
Obtain [SD] for Time Per Function.
static proto void SetModule(EnProfilerModule module, bool sessionReset=true)
Set the module to be profiled.
static proto void GetTimePerClass(notnull out array< ref EnProfilerTimeClassPair > outArr, int count=int.MAX)
Obtain [SD] for Time Per Class.
static proto bool NameToModule(string moduleName, out EnProfilerModule module)
Convert string to EnProfilerModule.
static proto void SortData()
The internal sorting that happens at the end of the frame (so it is NOT necessary to call this manual...
EnProfilerModule
Current base scripted modules.
Definition EnProfiler.c:22

Перекрестные ссылки Assert(), BTFR(), EnProfiler::Enable(), EnProfiler::GetFlags(), EnProfiler::GetModule(), EnProfiler::GetTimeOfFunc(), EnProfiler::GetTimePerClass(), EnProfiler::GetTimePerFunc(), EnProfiler::GetTimeResolution(), EnProfiler::NameToModule(), NTFR(), EnProfiler::RemoveFlags(), EnProfiler::RequestImmediateData(), EnProfiler::ResetSession(), EnProfiler::SetFlags(), EnProfiler::SetModule(), EnProfiler::SetTimeResolution(), Sleep(), EnProfiler::SortData(), EnumTools::StringToEnum(), Debug::TFLog() и Type.

◆ TestSetFlags()

TFResult TestSetFlags ( )
inlineprivate
68 {
70
71 for (int i = 0; i < EnumTools.GetEnumSize(EnProfilerFlags); ++i)
72 {
74 EnProfiler.SetFlags(flags);
75
76 if (!Assert(EnProfiler.GetFlags() == flags))
77 {
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 {
90 return NTFR(TFR.FAIL);
91 }
92 }
93 }
94
95 // Let's test some bogus
96 EnProfiler.SetFlags(-333);
99 if (!Assert(bogusFlags == 0))
100 {
102 return NTFR(TFR.FAIL);
103 }
104
107 if (!Assert(bogusFlags == 0))
108 {
110 return NTFR(TFR.FAIL);
111 }
112
113 // Reset
115 return NTFR(TFR.SUCCESS);
116 }
static int GetEnumValue(typename e, int idx)
Return the nth value in the enum.
Definition EnConvert.c:634
static int GetEnumSize(typename e)
Return amount of values in enum.
Definition EnConvert.c:623

Перекрестные ссылки Assert(), EnumTools::GetEnumSize(), EnumTools::GetEnumValue(), EnProfiler::GetFlags(), NTFR() и EnProfiler::SetFlags().

◆ TestToggling()

TFResult TestToggling ( )
inlineprivate
38 {
42 {
45 }
46
47 return NTFR(TFR.FAIL);
48 }
static bool IsEnabledP()
Return if script profiling is enabled through EnProfiler.
Definition EnProfiler.c:138

Перекрестные ссылки Assert(), BTFR(), EnProfiler::Enable(), EnProfiler::IsEnabledP() и NTFR().

◆ TestTogglingImmediate()

TFResult TestTogglingImmediate ( )
inlineprivate

Перекрестные ссылки Assert(), BTFR(), EnProfiler::Enable(), EnProfiler::IsEnabledC() и NTFR().

Поля

◆ m_bWasProfilerEnabled

bool m_bWasProfilerEnabled
private

Remember this, so we can restore the previous state before the test!

Используется в EnProfilerTests() и ~EnProfilerTests().


Объявления и описания членов класса находятся в файле: