annotate blobstat/output.c @ 343:917e05f03ad2

fluid-mnf/serial.c: <assert.h> no longer needed
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 13 Mar 2020 05:40:23 +0000
parents 99f72069d867
children
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)
295
99f72069d867 blobstat: actually works now
Mychaela Falconia <falcon@freecalypso.org>
parents: 294
diff changeset
17 printf("%s: 0x%lX (%lu) bytes, %lu%% of total\n", p->name,
99f72069d867 blobstat: actually works now
Mychaela Falconia <falcon@freecalypso.org>
parents: 294
diff changeset
18 p->accum, p->accum, p->accum * 100 / total);
294
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 }