-
Notifications
You must be signed in to change notification settings - Fork 242
/
stats.c
46 lines (39 loc) · 890 Bytes
/
stats.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <errno.h>
#include "arch.h"
#include "stats.h"
#include "syscall.h"
#include "tables.h"
static void dump_entry(const struct syscalltable *table, unsigned int i)
{
struct syscallentry *entry;
unsigned int j;
entry = table[i].entry;
if (entry == NULL)
return;
if (entry->attempted == 0)
return;
printf("%s: (attempted:%u. success:%u. failures:%u.\n", entry->name, entry->attempted, entry->successes, entry->failures);
for (j = 0; j < NR_ERRNOS; j++) {
if (entry->errnos[j] != 0) {
printf(" %s: %d\n", strerror(j), entry->errnos[j]);
}
}
}
void dump_stats(void)
{
unsigned int i;
if (biarch == TRUE) {
printf("32bit:\n");
for_each_32bit_syscall(i) {
dump_entry(syscalls_32bit, i);
}
printf("64bit:\n");
for_each_64bit_syscall(i) {
dump_entry(syscalls_64bit, i);
}
} else {
for_each_syscall(i) {
dump_entry(syscalls, i);
}
}
}