Download

Does the Unreal CPU Profiler show your custom C++ code also or only Epic's code?

I’m using the CPU profiler under Window->Session Frontend with the goal of profiling my C++ code.

However the functions in the event stack seem to be very high-level/engine-specific stuff. Is there a way to filter out my own C++ UFunctions from these?

I’m hoping that I’m missing something straightforward because I’m used to profilers that offer function by function breakdown (eg: JProfiler for enterprise Java) and that kind of data is invaluable in identifying areas for optimization.

Edit: I just found that Visual Studio community edition may have a profiler built into it, I’m going through this Microsoft guide, has anyone done this kind of profiling for their UE project as opposed to using the Unreal front-end?

Somehow I vaguely remember watching a video from Epic in which they were talking about CPU Profiler and showing custom functions.

Having said that I can’t remember anything else, whether it was a Twitch stream or YT, but it should be on YT in their channel, if anything.

Another thought, perhaps you need to add a decorator or something of sort to make your functions appear in the CPU Profiler?

Sorry I can’t be any more specific, did not really look yet into CPU Profiling myself.

I think you may need to use the stats macros, these are documented in Engine\Source\Runtime\Core\Public\Stats\Stats.h, the QUICK_SCOPE_CYCLE_COUNTER macro is probably the most relevant one in this case.

Thanks a lot enlight_2014 and amigo. So far I was manually adding code in each function to count milliseconds elapsed but I’ll try that macro instead next time.

I haven’t yet investigated the ‘native’ Visual Studio profiling described in the document I linked above so there’s potentially that option as well.