Is there an equivalent library to <chrono> in Unreal?

Sometimes I have different functions that return the same result.

I’ve been noticing lately that sometimes the simplest code doesn’t have the best performance.

I wonder if the Unreal library has something similar to < chrono > library for performance measurement.

Something like this:

   // start time measurement
   chrono::time_point<chrono::system_clock> cpu_start = chrono::system_clock::now(); 


   MyTestFunction();


   // end time measurement
   chrono::time_point<chrono::system_clock> cpu_end = chrono::system_clock::now();



auto cpu_total_time_ns = chrono::duration_cast<chrono::nanoseconds>(cpu_end - cpu_start).count();

Or should I use the C++ standard library for this?


NOTE: I know unreal insights exists… and I know how to use it (more or less)…
But I just want is to compare performance of two different functions.


Thank you so much!!

@Matiati answered my question in this post.

FDateTime and FTimeSpan is the key.

Thak you so much!!

1 Like