AppSeconds

From Oldunreal-Wiki
Revision as of 16:42, 11 September 2011 by Hellkeeper (talk | contribs)
Jump to navigation Jump to search

function PostBeginPlay()
{
local float F;
AppSeconds(F); // pass in the float for AppSeconds to modify.
log(F);
}
This function also allows "for.." execution time testing.
There are many methods to do it, but generally you will want to average out the specific block of code to test it more accurately by doing a lot of iterations such as:
Function PostBeginPlay()
{
local int I;
local float F;
for(I=0; I<500; I++) // do 500 rounds of 500 loops of test code.
{
F+=ExecutionTime();
}
log("average execution time ="@(F/500)); // divide by 500 because I looped the code 500 times.
destroy();
}

function float ExecutionTime()
{
local float Start,End;
local int I;
local string S;
S="Test";
AppSeconds(Start); // get time before we actually execute anything.
for(i=0; i<500; I++) // 500 loops of my test code.
{
S=AppendStuff(S); // test code goes here
}
AppSeconds(End); // get time after we execute a large number of what we want to test.
return End-Start; // return the difference
}

Function String AppendStuff(string S) // Test function
{
Return S@"FFF";
}

This will not always be the same result, but around the same number consistent enough to provide a solid result.