There is a performance function, but I am wondering how to accumulate results and display the average of the last 10 results in real-time.

GetPerformanceCounter(True); // reset counter to zero
for( i = 0; i < 1000; i++ )
{
k = sin( i );
}
elapsed=GetPerformanceCounter();
_TRACE("Time [ms] = "+elapsed);

Just measure time of say 10 iterations and divide by 10.

GetPerformanceCounter(True); // reset counter to zero
for( k = 0; k < 10; k++ )
for( i = 0; i < 1000; i++ )
{
k = sin( i );
}
elapsed=GetPerformanceCounter();
_TRACE("Avg Time [ms] = "+elapsed / k );

Yes, but I want to do it with a formula that refreshes every tick. Something similar to "Display chart timing", but there there is no information about "average Chart Timing" of recent x-events.