Checkpoint on a utility helper class. Basically, if you have a class that you want to count the numbers of instances, you do this:
class Foo
#ifdef TRACK_OBJECT_USAGE
: public InstanceCounter<Foo>
#endif
Then, use this macro somewhere in the class body:
SUPPORT_OBJECT_ANALYTICS(Foo)
Lastly, add whatever information you want to trace out to the function ObjectAnalytics::DumpStatistics().
Here's a sample of the output of what I've instrumented so far:
-----------------------------------------------------------
Object Usage Stats
CardPrimitive current count: 7899
CardPrimitive current byte usage: 2053740
CardPrimitive max count: 7908
CardPrimitive max byte usage: 2056080
MTGCard current count: 13973
MTGCard current byte usage: 670704
MTGCard max count: 13982
MTGCard max byte usage: 671136
MTGCardInstance current count: 180
MTGCardInstance current byte usage: 172080
MTGCardInstance max count: 189
MTGCardInstance max byte usage: 180684
-----------------------------------------------------------
This commit is contained in:
@@ -301,6 +301,9 @@
|
||||
<ClCompile Include="src\PlayRestrictions.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\ObjectAnalytics.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\ActionElement.h">
|
||||
@@ -624,6 +627,9 @@
|
||||
<ClInclude Include="include\WResourceManagerImpl.h">
|
||||
<Filter>inc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\ObjectAnalytics.h">
|
||||
<Filter>inc</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Makefile" />
|
||||
|
||||
Reference in New Issue
Block a user