# Accessing profiling data / performance stats in C++ code?

**URL:** <https://forums.unrealengine.com/t/accessing-profiling-data-performance-stats-in-c-code/304021>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** stats, profiling, profiler, profile, unreal-engine, question, CPP\
**Created:** [January 15, 2015, 7:54am UTC](https://forums.unrealengine.com/t/accessing-profiling-data-performance-stats-in-c-code/304021 "2015-01-15T07:54:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimoLu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TimoLu](https://forums.unrealengine.com/u/TimoLu)\
**Post date:** [January 15, 2015, 7:54am UTC](https://forums.unrealengine.com/t/accessing-profiling-data-performance-stats-in-c-code/304021/1 "2015-01-15T07:54:43Z")

</div>

Hello everyone,

I’m trying to create a small benchmark-like application and would like to access the profiler and it’s data or the debug data shown by the stat-commands at runtime preferably through some variables or outputted data files.

Is this possible for C++ code, and if yes, how?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b6878a2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b6878a2](https://forums.unrealengine.com/u/anonymous_user_2b6878a2)\
**Post date:** [October 11, 2016, 8:30pm UTC](https://forums.unrealengine.com/t/accessing-profiling-data-performance-stats-in-c-code/304021/2 "2016-10-11T20:30:17Z")

</div>

Dont know if you found this out, but check out the Engine\Source\Runtime\Core\Public\Stats\Stats.h file. As of 4.12 it has a nice tutorial in there. Not sure about other versions.

---

<div class="post-metadata">

**Author:** ![zompi2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zompi2/32/937524_2.png) [@zompi2](https://forums.unrealengine.com/u/zompi2)\
**Post date:** [January 18, 2017, 12:25pm UTC](https://forums.unrealengine.com/t/accessing-profiling-data-performance-stats-in-c-code/304021/3 "2017-01-18T12:25:20Z")

</div>

Hi!

I was trying to do the same thing and come with the function that can collect some stats in runtime and save them to string/file: [Saving stats to file - Programming & Scripting - Unreal Engine Forums](https://answers.unrealengine.com/questions/550271/saving-stats-to-file.html)
