1344 : TestFramework
1345{
1348
1349
1350
1351
1353 {
1355
1366 }
1367
1368
1369
1370
1372 {
1374 }
1375
1376
1377
1378
1379
1381 {
1385 {
1388 }
1389
1391 }
1392
1393
1394
1396 {
1400 {
1403 }
1404
1406 }
1407
1408
1409
1411 {
1413
1415 {
1418
1420 {
1423 }
1424
1426 {
1429
1431 {
1434 }
1435 }
1436 }
1437
1438
1443 {
1446 }
1447
1451 {
1454 }
1455
1456
1459 }
1460
1461
1462
1464 {
1466
1468
1470 {
1473 }
1474
1477
1479 {
1482 }
1483
1486
1488 {
1491 }
1492
1493
1496 }
1497
1498
1499
1501 {
1503
1505
1506
1508 {
1511 }
1512
1514 {
1517 }
1518
1520 {
1523 }
1524
1525
1528 }
1529
1530
1531
1533 {
1534
1536
1537
1541
1542
1546
1549
1550
1553
1555 {
1558 }
1559
1560
1563
1564
1565
1567
1568
1571
1572
1577
1578
1580
1581
1583 {
1585
1588
1590
1592 }
1593
1595 {
1597
1600
1602
1604 }
1605
1606
1608
1609
1610 for (
int i = 0;
i < 1000; ++
i)
1612
1613
1617
1618 Debug.
TFLog(
"Game fncs:",
this,
"TestModule");
1619
1622 {
1624 Debug.
TFLog(
string.Format(
" time: %1 | fnc: %2",
tfp.param1,
tfp.param2),
this,
"TestModule");
1625
1626 if (!
Assert(
tfp.param2 !=
"EnumTools::StringToEnum"))
1627 {
1629
1632
1634
1636 }
1637 }
1638
1641
1644 {
1648 {
1650
1653
1655
1657 }
1658
1659
1661 {
1663
1666
1668
1670 }
1671 }
1672
1673
1678
1680
1681 Debug.
TFLog(
"Core fncs:",
this,
"TestModule");
1682
1685 {
1687 Debug.
TFLog(
string.Format(
" time: %1 | fnc: %2",
tfpc.param1,
tfpc.param2),
this,
"TestModule");
1688
1689 if (
tfpc.param2 ==
"EnumTools::StringToEnum")
1690 {
1692 break;
1693 }
1694 }
1695
1697
1698
1704
1707
1710
1712 }
1713
1714
1715
1717 {
1718
1721
1722
1724
1725
1727
1728
1735
1737
1738
1742
1743
1746
1749
1752
1754 }
1755
1756
1757
1759 {
1763
1764
1766
1767
1770
1774
1777
1780
1783
1785
1786
1789
1790
1793
1796
1798 }
1799
1800
1801
1803 {
1804
1807
1808
1810
1811
1817
1823
1825
1826
1830
1831
1834
1837
1840
1843
1844
1847
1849 }
1850
1851
1852
1854 {
1855
1857
1858
1859
1860
1862 GetGame().GameScript.CallFunction(
this,
"TestFuncCountDataHelper",
null, 0);
1864
1866
1867
1869 GetGame().GameScript.CallFunctionParams(
this,
"TestFuncCountDataHelper",
null,
null);
1871
1873
1874
1878
1880
1881
1883 GetGame().GameScript.Call(
this,
"TestFuncCountDataHelper", 0);
1885
1887
1888
1890
1891
1895
1897
1898
1902
1904
1905
1906
1909
1910
1911
1913
1914
1915
1918
1919
1920
1923
1924
1925
1928
1929
1932
1933
1934
1935
1938
1939
1942
1943
1946
1947
1950
1951
1954
1955
1958
1959
1962
1963
1966
1967
1970
1971
1974
1975
1978
1979
1982
1984 }
1985
1986
1987
1988
1989
1991 {
1994 {
1995
1996 }
1997
1999 }
2000
2001
2002
2004 {
2006
2007 for (
int i = 0;
i < 1000; ++
i)
2008 string example =
string.Format(
"This %1 is %2 just %3 an %4 example %5",
i,
Type(),
this,
startTime,
"lorem ipsum 1 2 3");
2009
2011 }
2012
2013
2014
2016 {
2018
2019 for (
int i = 0;
i < 1000; ++
i)
2020 string example =
"This " +
i +
" is " +
Type() +
" just " +
this +
" an " +
startTime +
" example " +
"lorem ipsum 1 2 3";
2021
2023 }
2024
2025
2026
2028 {
2030 }
2031
2032
2033
2035 {
2037 }
2038}
2039
2041{
2043 {
2046 {
2047
2048 }
2049
2051 }
2053 {
2056 {
2057
2058 }
2059
2061 }
2062
2064 {
2066
2069
2071 }
2072}
void TestFuncCountDataHelper()
TFResult TestClearFlags()
TFResult TestTogglingImmediate()
TFResult TestFuncCountData()
TFResult TestClassTimeData()
static void TestFuncCountDataHelperStatic()
TFResult TestClassCountData()
bool m_bWasProfilerEnabled
Remember this, so we can restore the previous state before the test!
TFResult TestFuncTimeData()
TFResult NTFR(TFR result)
bool Assert(bool condition)
void TFResult(TFR result)
void AddInitTest(string test)
TFResult BTFR(bool result)
static void TFLog(string message=LOG_DEFAULT, TestFramework caller=null, string function="")
Set of methods for accessing script profiling data.
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
static proto native ErrorModuleHandler GetInstance()
Gets the EMH Instance.
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.
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.
static bool IsEnabledC()
Return if script profiling is actually turned on inside of the script context.
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.
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.
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.
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.