annotate blobstat/output.c @ 294:ff2a6433687f

blobstat: code finished, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 21 Sep 2019 21:17:29 +0000
parents
children 99f72069d867
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
294
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <sys/types.h>
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <stdio.h>
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include <stdlib.h>
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 #include "struct.h"
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 extern struct category *category_list;
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 print_output()
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 {
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 struct category *p;
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 u_long total = 0;
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 for (p = category_list; p; p = p->next)
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 total += p->accum;
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 printf("total: 0x%lX (%lu) bytes\n", total, total);
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 for (p = category_list; p; p = p->next)
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 printf("%s: 0x%lX (%lu) bytes, %u%% of total\n", p->accum,
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 p->accum, p->accum * 100 / total);
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 return(0);
ff2a6433687f blobstat: code finished, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 }