Custom Profiler Stats

Is it possible to create custom stats that can be tracked by the Profiler? I’ve tried the following at the top of a cpp file.

DECLARE_STATS_GROUP(TEXT("Homebrew"), STATGROUP_Homebrew, STATCAT_Advanced);
DECLARE_CYCLE_STAT(TEXT("Detect Position"), STAT_DetectPosition, STATGROUP_Homebrew);

It builds fine but the Profiler doesn’t show my stat group. Even if I use a group that already exists it still doesn’t show my stat.

I’m also using SCOPE_CYCLE_COUNTER(STAT_DetectPosition) in a function.

I have the following in my .h file

DECLARE_STATS_GROUP(TEXT("BulletPool"), STATGROUP_BulletPool, STATCAT_Advanced);
DECLARE_CYCLE_STAT_EXTERN(TEXT("RequestBulletTypeFromPool"), STAT_RequestBulletTypeFromPool, STATGROUP_BulletPool, SHOTGUNHADES_API);
DECLARE_CYCLE_STAT_EXTERN(TEXT("ReturnBulletTypeToPool"), STAT_ReturnBulletTypeToPool, STATGROUP_BulletPool, SHOTGUNHADES_API);

I have the following in my .cpp file

DEFINE_STAT(STAT_RequestBulletTypeFromPool);
DEFINE_STAT(STAT_ReturnBulletTypeToPool);

And the following inside the function

SCOPE_CYCLE_COUNTER(STAT_RequestBulletTypeFromPool);

It seems to work for me and I can see my stats and the group in Session Frontend window. Hope this helps in resolving your problem!

1 Like

^^^^

Should be promoted to Answer. Solved my Linkage problem with stats.

At your service

is it possible to view this in the editor with a stat command, or is this just part of the profiler?