Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1085 | pj | 1 | |
2 | #include <netinet/in.h> |
||
3 | |||
4 | #include <stdio.h> |
||
5 | #include "types.h" |
||
6 | #include <trace.h> |
||
7 | #include "util.h" |
||
8 | |||
9 | int dumpsys(trc_system_event_t *sys) |
||
10 | { |
||
11 | /* |
||
12 | if (sys->event==TRC_SCHEDULE) { |
||
13 | //if (sys->prev!=65535) |
||
14 | // printf("%02i->%02i\n",sys->prev,sys->task); |
||
15 | //else |
||
16 | printf("??->%02i\n",sys->task); |
||
17 | return 0; |
||
18 | } |
||
19 | */ |
||
20 | printf("%02i\n",sys->task); |
||
21 | return 0; |
||
22 | } |
||
23 | |||
24 | int dumpusr(trc_user_event_t *usr) |
||
25 | { |
||
26 | printf("%8li ",usr->n); |
||
27 | printf("\n"); |
||
28 | return 0; |
||
29 | } |
||
30 | |||
31 | int dumpsem(trc_sem_event_t *sem) |
||
32 | { |
||
33 | printf("on [%i]\n",sem->id); |
||
34 | return 0; |
||
35 | } |
||
36 | |||
37 | int dumpfunc(trc_event_t *ev) |
||
38 | { |
||
39 | static int counter=0; |
||
40 | |||
41 | printf("%4i ",counter); |
||
42 | counter++; |
||
43 | printf("%12s ",format_time(ev->time)); |
||
44 | printf("%-10s ",event_name(ev->event)); |
||
45 | |||
46 | //printf("%08x\n",(unsigned)ev->sys.event); |
||
47 | //return 0; |
||
48 | |||
49 | switch(event_class(ev->event)) { |
||
50 | case TRC_CLASS_SYSTEM: return dumpsys(&ev->x.sys); |
||
51 | case TRC_CLASS_USER: return dumpusr(&ev->x.usr); |
||
52 | case TRC_CLASS_SEM: return dumpsem(&ev->x.sem); |
||
53 | } |
||
54 | printf("\nEVENT %i... CLASS %i UNKNOWN!\n",ev->event,event_class(ev->event)); |
||
55 | return -1; |
||
56 | } |
||
57 | |||
58 | int main(int argc, char *argv[]) |
||
59 | { |
||
60 | int res; |
||
61 | |||
62 | if (argc!=2) { |
||
63 | fprintf(stderr,"missing filename!\n"); |
||
64 | return -1; |
||
65 | } |
||
66 | |||
67 | res=read_trace(argv[1],dumpfunc); |
||
68 | |||
69 | //fprintf(stderr,"result=%i\n",res); |
||
70 | //fprintf(stderr,"size=%li\n",sizeof(trc_event_t)); |
||
71 | |||
72 | return 0; |
||
73 | } |