Rev 1510 | Rev 1518 | 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 | |||
1515 | giacomo | 23 | extern unsigned int clk_per_msec; |
24 | |||
1293 | giacomo | 25 | int main(int argc, char **argv) |
26 | { |
||
27 | |||
28 | long long i; |
||
29 | |||
1353 | giacomo | 30 | int a,b,c; |
1293 | giacomo | 31 | struct timespec start,end,diff; |
1371 | giacomo | 32 | SYS_FLAGS f; |
1293 | giacomo | 33 | |
1353 | giacomo | 34 | a = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
35 | b = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN); |
||
36 | c = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
||
1293 | giacomo | 37 | |
1353 | giacomo | 38 | FTrace_chunk_link(a,b); |
39 | FTrace_chunk_link(b,c); |
||
40 | |||
41 | FTrace_actual_chunk_select(a); |
||
42 | |||
1293 | giacomo | 43 | kern_gettime(&start); |
1353 | giacomo | 44 | FTrace_enable(); |
1293 | giacomo | 45 | |
1510 | giacomo | 46 | TRACER_LOGEVENT(FTrace_EVT_trace_start,0,0); |
47 | |||
1515 | giacomo | 48 | TRACER_LOGEVENT(FTrace_EVT_cycles_per_msec,0,clk_per_msec); |
49 | |||
1508 | giacomo | 50 | for (i=0;i<10;i++) |
51 | if (proc_table[i].context != 0) TRACER_LOGEVENT(FTrace_EVT_id, |
||
52 | (unsigned short int)proc_table[i].context,i); |
||
53 | |||
1293 | giacomo | 54 | for (i=0;i<1000000000;i++); |
1353 | giacomo | 55 | |
56 | TRACER_LOGEVENT(FTrace_EVT_next_chunk,0,0); |
||
1371 | giacomo | 57 | |
58 | f = kern_fsave(); |
||
59 | __asm__("cpuid":::"eax","ebx","ecx","edx"); |
||
1510 | giacomo | 60 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,1000,0); |
61 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,2000,0); |
||
62 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,3000,0); |
||
63 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,4000,0); |
||
64 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,5000,0); |
||
1371 | giacomo | 65 | __asm__("cpuid":::"eax","ebx","ecx","edx"); |
66 | kern_frestore(f); |
||
67 | |||
1510 | giacomo | 68 | TRACER_LOGEVENT(FTrace_EVT_ipoint,6000,0); |
1371 | giacomo | 69 | |
1353 | giacomo | 70 | for (i=0;i<1000000000;i++); |
71 | |||
1510 | giacomo | 72 | TRACER_LOGEVENT(FTrace_EVT_trace_stop,0,0); |
73 | |||
1353 | giacomo | 74 | FTrace_disable(); |
1293 | giacomo | 75 | kern_gettime(&end); |
76 | |||
77 | SUBTIMESPEC(&end,&start,&diff); |
||
78 | |||
79 | cprintf("Logged Time %d s %d us\n",(int)diff.tv_sec,(int)diff.tv_nsec/1000); |
||
80 | |||
1411 | giacomo | 81 | FTrace_OSD_init_udp(1, "192.168.1.10", "192.168.1.1"); |
1293 | giacomo | 82 | |
1372 | giacomo | 83 | FTrace_send_chunk(a, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
84 | FTrace_send_chunk(b, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN); |
||
1364 | giacomo | 85 | |
1293 | giacomo | 86 | return 0; |
87 | |||
88 | } |