1#include "mupdf/fitz.h"
2
3#ifdef TRACK_USAGE
4
5static track_usage_data_t *usage_head = NULL;
6
7static void dump_usage(void)
8{
9 track_usage_data_t *u = usage_head;
10
11 while (u)
12 {
13 fprintf(stderr, "USAGE: %s (%s:%d) %d calls\n",
14 u->desc, u->function, u->line, u->count);
15 u = u->next;
16 }
17}
18
19void track_usage(track_usage_data_t *data, const char *function, int line, const char *desc)
20{
21 int c = data->count++;
22 if (c == 0)
23 {
24 data->function = function;
25 data->line = line;
26 data->desc = desc;
27 if (usage_head == NULL)
28 atexit(dump_usage);
29 data->next = usage_head;
30 usage_head = data;
31 }
32}
33
34#endif
35