Debian Codegraph @

src/footprint/main.c

raw symbols SCIP
1 /*
2 * Copyright (c) 2005-2010 William Pitcock <[email protected]>.
3 * Rights to this code are as documented in doc/LICENSE.
4 *
5 * Initialization stub for libathemecore.
6 */
7
8 #include "atheme.h"
9 #include "serno.h"
10
11 int main(int argc, char *argv[])
12 {
13 unsigned int usercount = 0, channelcount = 0, membercount = 0,
14 klinecount = 0, qlinecount = 0, xlinecount = 0, regchannelcount = 0,
15 servercount = 0, regusercount = 0;
16 unsigned int i;
17
18 /* make up some statistics */
19 srand(time(NULL));
20
21 servercount = (rand() % 30) + 1;
22
23 for (i = 0; i < servercount; i++)
24 usercount += ((rand() % 6000) + 1);
25
26 channelcount = usercount / servercount;
27 membercount = (usercount + channelcount) * ((rand() % 3) + 1);
28 regchannelcount = channelcount * 0.65;
29 regusercount = usercount * 0.65;
30
31 /* 5% of users are probably misbehaving in some way... */
32 klinecount = xlinecount = qlinecount = (usercount * 0.05);
33
34 printf("footprint for atheme %s (%s)\n", PACKAGE_VERSION, SERNO);
35
36 printf("\n* * *\n\n");
37
38 printf("%u servers\n", servercount);
39 printf("%u users\n", usercount);
40 printf("%u registered users\n", regusercount);
41 printf("%u channels\n", channelcount);
42 printf("%u registered channels\n", regchannelcount);
43 printf("%u memberships\n", membercount);
44 printf("%u klines / xlines / qlines\n", klinecount);
45
46 printf("\n* * *\n\n");
47
48 printf("sizeof object_t: %zu B\n", sizeof(object_t));
49
50 printf("\n* * *\n\n");
51
52 printf("sizeof myentity_t: %zu B --> %zu KB\n", sizeof(myentity_t), (regusercount * sizeof(myentity_t)) / 1024);
53 printf("sizeof myuser_t: %zu B --> %zu KB\n", sizeof(myuser_t), (regusercount * sizeof(myuser_t)) / 1024);
54 printf("sizeof mychan_t: %zu B --> %zu KB\n", sizeof(mychan_t), (regchannelcount * sizeof(mychan_t)) / 1024);
55 printf("sizeof mynick_t: %zu B --> %zu KB\n", sizeof(mynick_t), (regusercount * sizeof(mynick_t)) / 1024);
56
57 printf("\n* * *\n\n");
58
59 printf("sizeof user_t: %zu B --> %zu KB\n", sizeof(user_t), (usercount * sizeof(user_t)) / 1024);
60 printf("sizeof channel_t: %zu B --> %zu KB\n", sizeof(channel_t), (channelcount * sizeof(channel_t)) / 1024);
61 printf("sizeof chanuser_t: %zu B --> %zu KB\n", sizeof(chanuser_t), (membercount * sizeof(chanuser_t)) / 1024);
62
63 printf("\n* * *\n\n");
64
65 printf("sizeof kline_t: %zu B --> %zu KB\n", sizeof(kline_t), (klinecount * sizeof(kline_t)) / 1024);
66 printf("sizeof xline_t: %zu B --> %zu KB\n", sizeof(xline_t), (xlinecount * sizeof(xline_t)) / 1024);
67 printf("sizeof qline_t: %zu B --> %zu KB\n", sizeof(qline_t), (qlinecount * sizeof(qline_t)) / 1024);
68
69 printf("\n* * *\n\n");
70
71 printf("sizeof server_t: %zu B --> %zu KB\n", sizeof(server_t), (servercount * sizeof(server_t)) / 1024);
72
73 return EXIT_SUCCESS;
74 }