Hello.
So I have a class that is pretty demanding so I took some time to do detailed profiling. I am confused by the results. This is my setup.
In the .cpp
...
void MyClass::TickComponent(...)
{
float a; float b; float c;
FVector AA; FVector BB; FVector CC;
// Define vectors
...
{
SCOPE_CYCLE_COUNTER(STAT_TickSection);
a = MyFun(AA);
b = MyFun(BB);
c = MyFun(CC);
}
}
float MyClass::MyFun(FVector MyVector)
{
SCOPE_CYCLE_COUNTER(STAT_MyFun);
// Do stuff with a vector
...
return TheAnswer;
}
MyFun is a UFunction as well.
The results from the profiler show that TickSection has an inclusive time of 5.5 ms from the sample time. The children are Self and MyFun which show 2.8 and 2.7 ms respectively. The Self event has 1 call and the MyFun has 81060 calls.
What is the self section referring to here? The only thing happening in the STAT_TickSection is the function returning the value to a variable. If I increase the number of calls to MyFun the self time also goes up. I’ve tried making the function FORCEINLINE and const without any improvement.
What am I missing?