wrenczes@gmail.com
bd56723bc0
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
-----------------------------------------------------------
2011-04-23 05:16:53 +00:00
..
2010-11-16 00:55:16 +00:00
2011-04-10 15:29:00 +00:00
2011-04-20 07:50:00 +00:00
2011-03-13 21:19:02 +00:00
2011-04-22 16:04:41 +00:00
2011-02-06 11:35:40 +00:00
2011-04-22 11:17:20 +00:00
2011-02-02 18:22:08 +00:00
2010-12-02 20:35:42 +00:00
2010-11-16 00:55:16 +00:00
2011-04-22 16:04:41 +00:00
2011-04-23 05:16:53 +00:00
2011-04-03 06:07:23 +00:00
2010-11-16 00:55:16 +00:00
2010-11-16 00:55:16 +00:00
2011-02-27 15:19:02 +00:00
2011-04-20 07:50:00 +00:00
2011-04-20 20:14:25 +00:00
2010-12-01 08:22:17 +00:00
2010-11-16 00:55:16 +00:00
2011-01-31 14:21:46 +00:00
2011-04-21 06:35:44 +00:00
2011-04-21 08:32:32 +00:00
2011-04-20 20:24:53 +00:00
2011-04-21 08:32:32 +00:00
2011-02-10 17:19:11 +00:00
2011-04-22 11:17:20 +00:00
2009-06-15 01:01:57 +00:00
2011-04-18 17:21:06 +00:00
2011-04-23 05:16:53 +00:00
2010-11-16 00:55:16 +00:00
2011-04-21 15:16:22 +00:00
2011-04-22 11:17:20 +00:00
2011-01-31 10:04:18 +00:00
2011-04-20 07:50:00 +00:00
2011-04-21 22:48:22 +00:00
2011-04-23 05:16:53 +00:00
2011-04-21 15:16:22 +00:00
2011-04-22 11:17:20 +00:00
2011-04-20 07:50:00 +00:00
2011-01-11 10:11:15 +00:00
2011-04-20 07:50:00 +00:00
2011-04-22 11:17:20 +00:00
2011-04-21 22:48:22 +00:00
2010-10-24 05:55:24 +00:00
2011-04-21 15:16:22 +00:00
Resuming on my threading support work with the card caching mechanism. This change unfortunately touches quite a few files, but I needed to get it out of the way before things got out of hand: one significant hurdle is the assumed lifetime of a JQuad pointer. In a single threaded model, the life time of the pointer is clear: you fetch it into the cache, the cache makes room, you use the pointer immediately. In a multithreaded context however, it's unsafe, as the drawing thread can request a few JQuads, and the cache operating on a separate thread can potentially bounce a JQuad out of the cache before the draw routine is done using it, which ends up in an access violation when you attempt to draw using an invalidated quad pointer. To prevent this, the bulk of this change swaps out the use of naked JQuad* pointers in the code with a JQuadPtr, which is basically a typedef to a boost shared_ptr<JQuad>.
2011-02-01 10:37:21 +00:00
2011-04-21 22:48:22 +00:00
2010-12-16 21:17:18 +00:00
Resuming on my threading support work with the card caching mechanism. This change unfortunately touches quite a few files, but I needed to get it out of the way before things got out of hand: one significant hurdle is the assumed lifetime of a JQuad pointer. In a single threaded model, the life time of the pointer is clear: you fetch it into the cache, the cache makes room, you use the pointer immediately. In a multithreaded context however, it's unsafe, as the drawing thread can request a few JQuads, and the cache operating on a separate thread can potentially bounce a JQuad out of the cache before the draw routine is done using it, which ends up in an access violation when you attempt to draw using an invalidated quad pointer. To prevent this, the bulk of this change swaps out the use of naked JQuad* pointers in the code with a JQuadPtr, which is basically a typedef to a boost shared_ptr<JQuad>.
2011-02-01 10:37:21 +00:00
2010-11-16 00:55:16 +00:00
Resuming on my threading support work with the card caching mechanism. This change unfortunately touches quite a few files, but I needed to get it out of the way before things got out of hand: one significant hurdle is the assumed lifetime of a JQuad pointer. In a single threaded model, the life time of the pointer is clear: you fetch it into the cache, the cache makes room, you use the pointer immediately. In a multithreaded context however, it's unsafe, as the drawing thread can request a few JQuads, and the cache operating on a separate thread can potentially bounce a JQuad out of the cache before the draw routine is done using it, which ends up in an access violation when you attempt to draw using an invalidated quad pointer. To prevent this, the bulk of this change swaps out the use of naked JQuad* pointers in the code with a JQuadPtr, which is basically a typedef to a boost shared_ptr<JQuad>.
2011-02-01 10:37:21 +00:00
2011-04-21 15:16:22 +00:00
2011-04-21 22:48:22 +00:00
2011-04-22 11:17:20 +00:00
2011-02-09 20:42:19 +00:00
2011-04-21 02:35:51 +00:00
2011-04-21 15:16:22 +00:00
2010-11-16 00:55:16 +00:00
2011-04-23 05:16:53 +00:00
2011-04-23 05:16:53 +00:00
2011-04-22 00:09:10 +00:00
2011-03-31 16:39:28 +00:00
2011-01-28 06:00:51 +00:00
2011-04-20 21:07:24 +00:00
2011-02-23 18:30:45 +00:00
2011-04-22 11:17:20 +00:00
2010-11-16 00:55:16 +00:00
2010-11-16 00:55:16 +00:00
2011-03-13 21:19:02 +00:00
2011-04-23 05:16:53 +00:00
2011-02-06 11:35:40 +00:00
2011-03-02 21:35:31 +00:00
2011-03-13 21:19:02 +00:00
2011-04-20 07:50:00 +00:00
2011-04-17 06:26:52 +00:00
2010-11-16 00:55:16 +00:00
2011-03-02 13:41:24 +00:00
2010-11-16 00:55:16 +00:00
2011-01-08 12:24:39 +00:00
2011-04-20 07:50:00 +00:00
2010-11-16 00:55:16 +00:00
2011-03-13 21:19:02 +00:00
2011-04-22 11:17:20 +00:00
2010-12-01 08:22:17 +00:00
2010-12-01 08:22:17 +00:00
Resuming on my threading support work with the card caching mechanism. This change unfortunately touches quite a few files, but I needed to get it out of the way before things got out of hand: one significant hurdle is the assumed lifetime of a JQuad pointer. In a single threaded model, the life time of the pointer is clear: you fetch it into the cache, the cache makes room, you use the pointer immediately. In a multithreaded context however, it's unsafe, as the drawing thread can request a few JQuads, and the cache operating on a separate thread can potentially bounce a JQuad out of the cache before the draw routine is done using it, which ends up in an access violation when you attempt to draw using an invalidated quad pointer. To prevent this, the bulk of this change swaps out the use of naked JQuad* pointers in the code with a JQuadPtr, which is basically a typedef to a boost shared_ptr<JQuad>.
2011-02-01 10:37:21 +00:00
2011-04-09 08:26:43 +00:00
2011-02-06 11:35:40 +00:00
Performance improvements/cleanup: card->hasType("foo") performs a string lookup for an integer id. Now that our primitives have over 1000 types (1018, I believe is the number I saw while debugging), this is not the cheapest lookup. Over the course of time, a lot of new rules have crept in the code - support for 'aura', 'equipment', and recently 'planeswalker'. While profiling, I saw an inordinate amount of time being used doing map lookups for these strings. Since they're used so frequently, I've added them to the SubTypes enumeration, and swapped out doing the string lookup in favour of using the int ID directly. I also found a few places where we were using hasType("Creature") or hasType("land") when we already had helper functions to do the int lookup, so I swapped these in as appropriate, as well as a couple of places where we had hasType("instant") instead of hasType(Subtypes::TYPE_INSTANT), etc.
2011-04-10 00:07:34 +00:00
2011-04-21 15:16:22 +00:00
2010-11-16 00:55:16 +00:00
2011-01-11 10:11:15 +00:00
2010-11-16 00:55:16 +00:00
2011-03-13 21:19:02 +00:00
2011-01-08 12:24:39 +00:00
2011-04-14 17:06:44 +00:00
2011-01-21 20:18:56 +00:00
2011-04-21 02:35:51 +00:00
2011-04-21 13:16:11 +00:00
2010-11-16 00:55:16 +00:00
2011-04-22 13:12:36 +00:00
2011-04-21 13:16:11 +00:00
2011-04-19 07:12:05 +00:00
2011-04-12 20:54:34 +00:00
2011-02-14 06:54:28 +00:00
2011-04-21 13:16:11 +00:00
2011-04-21 22:48:22 +00:00
2011-04-22 13:33:42 +00:00