+#define TICK_ENT_STATIC_THK() ENT_STATIC_THK_ctr++
+#define TICK_ENT_DYN_THK() ENT_DYN_THK_ctr++
+
+typedef struct _StgEntCounter {
+ unsigned registeredp:16, /* 0 == no, 1 == yes */
+ arity:16, /* arity (static info) */
+ stk_args:16; /* # of args off stack */
+ /* (rest of args are in registers) */
+ char *str; /* name of the thing */
+ char *arg_kinds; /* info about the args types */
+ I_ entry_count; /* Trips to fast entry code */
+ I_ allocs; /* number of allocations by this fun */
+ struct _StgEntCounter *link;/* link to chain them all together */
+} StgEntCounter;
+
+#define TICK_CTR(f_ct, str, arity, args, arg_kinds) \
+ static StgEntCounter f_ct \
+ = { 0, arity, args, \
+ str, arg_kinds, \
+ 0, 0, NULL };
+
+#define TICK_ENT_FUN_DIRECT_BODY(f_ct) \
+ { \
+ if ( ! f_ct.registeredp ) { \
+ /* hook this one onto the front of the list */ \
+ f_ct.link = ticky_entry_ctrs; \
+ ticky_entry_ctrs = & (f_ct); \
+ /* mark it as "registered" */ \
+ f_ct.registeredp = 1; \
+ } \
+ f_ct.entry_count += 1; \
+ }
+
+#define TICK_ENT_STATIC_FUN_DIRECT(f_ct) \
+ TICK_ENT_FUN_DIRECT_BODY(f_ct) \
+ ENT_STATIC_FUN_DIRECT_ctr++ /* The static total one */
+
+#define TICK_ENT_DYN_FUN_DIRECT(f_ct) \
+ TICK_ENT_FUN_DIRECT_BODY(f_ct) \
+ ENT_DYN_FUN_DIRECT_ctr++ /* The dynamic total one */
+
+extern StgEntCounter top_ct;
+extern StgEntCounter *ticky_entry_ctrs;
+
+#define TICK_ENT_STATIC_CON(n) ENT_STATIC_CON_ctr++ /* enter static constructor */
+#define TICK_ENT_DYN_CON(n) ENT_DYN_CON_ctr++ /* enter dynamic constructor */
+#define TICK_ENT_STATIC_IND(n) ENT_STATIC_IND_ctr++ /* enter static indirection */
+#define TICK_ENT_DYN_IND(n) ENT_DYN_IND_ctr++ /* enter dynamic indirection */
+#define TICK_ENT_PERM_IND(n) ENT_PERM_IND_ctr++ /* enter permanent indirection */