Rev 1411 | Rev 1510 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1293 | giacomo | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Giacomo Guidi <giacomo@gandalf.sssup.it> |
||
10 | * |
||
11 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
12 | * |
||
13 | * http://www.sssup.it |
||
14 | * http://retis.sssup.it |
||
15 | * http://shark.sssup.it |
||
16 | */ |
||
17 | |||
18 | #include <kernel/kern.h> |
||
1364 | giacomo | 19 | #include <FTrace_chunk.h> |
20 | #include <FTrace_udp.h> |
||
1293 | giacomo | 21 | #include <tracer.h> |
22 | |||
23 | int main(int argc, char **argv) |
||
24 | { |
||
25 | |||
26 | long long i; |
||
27 | |||
1353 | giacomo | 28 | int a,b,c; |
1293 | giacomo | 29 | struct timespec start,end,diff; |
1371 | giacomo | 30 | SYS_FLAGS f; |
1293 | giacomo | 31 | |
1353 | giacomo | 32 | a = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
33 | b = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN); |
||
34 | c = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
||
1293 | giacomo | 35 | |
1353 | giacomo | 36 | FTrace_chunk_link(a,b); |
37 | FTrace_chunk_link(b,c); |
||
38 | |||
39 | FTrace_actual_chunk_select(a); |
||
40 | |||
1293 | giacomo | 41 | kern_gettime(&start); |
1353 | giacomo | 42 | FTrace_enable(); |
1293 | giacomo | 43 | |
1508 | giacomo | 44 | for (i=0;i<10;i++) |
45 | if (proc_table[i].context != 0) TRACER_LOGEVENT(FTrace_EVT_id, |
||
46 | (unsigned short int)proc_table[i].context,i); |
||
47 | |||
1293 | giacomo | 48 | for (i=0;i<1000000000;i++); |
1353 | giacomo | 49 | |
50 | TRACER_LOGEVENT(FTrace_EVT_next_chunk,0,0); |
||
1371 | giacomo | 51 | |
52 | f = kern_fsave(); |
||
53 | __asm__("cpuid":::"eax","ebx","ecx","edx"); |
||
54 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,1,0); |
||
55 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,2,0); |
||
56 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,3,0); |
||
57 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,4,0); |
||
58 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,5,0); |
||
59 | __asm__("cpuid":::"eax","ebx","ecx","edx"); |
||
60 | kern_frestore(f); |
||
61 | |||
62 | TRACER_LOGEVENT(FTrace_EVT_ipoint,6,0); |
||
63 | |||
1353 | giacomo | 64 | for (i=0;i<1000000000;i++); |
65 | |||
66 | FTrace_disable(); |
||
1293 | giacomo | 67 | kern_gettime(&end); |
68 | |||
69 | SUBTIMESPEC(&end,&start,&diff); |
||
70 | |||
71 | cprintf("Logged Time %d s %d us\n",(int)diff.tv_sec,(int)diff.tv_nsec/1000); |
||
72 | |||
1411 | giacomo | 73 | FTrace_OSD_init_udp(1, "192.168.1.10", "192.168.1.1"); |
1293 | giacomo | 74 | |
1372 | giacomo | 75 | FTrace_send_chunk(a, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
76 | FTrace_send_chunk(b, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN); |
||
1364 | giacomo | 77 | |
1293 | giacomo | 78 | return 0; |
79 | |||
80 | } |