Rev 1515 | Rev 1568 | 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 | |
1518 | giacomo | 46 | TRACER_LOGEVENT(FTrace_EVT_trace_start,proc_table[exec_shadow].context,clk_per_msec); |
1510 | giacomo | 47 | |
1508 | giacomo | 48 | for (i=0;i<10;i++) |
49 | if (proc_table[i].context != 0) TRACER_LOGEVENT(FTrace_EVT_id, |
||
50 | (unsigned short int)proc_table[i].context,i); |
||
51 | |||
1293 | giacomo | 52 | for (i=0;i<1000000000;i++); |
1353 | giacomo | 53 | |
54 | TRACER_LOGEVENT(FTrace_EVT_next_chunk,0,0); |
||
1371 | giacomo | 55 | |
56 | f = kern_fsave(); |
||
57 | __asm__("cpuid":::"eax","ebx","ecx","edx"); |
||
1510 | giacomo | 58 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,1000,0); |
59 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,2000,0); |
||
60 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,3000,0); |
||
61 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,4000,0); |
||
62 | FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,5000,0); |
||
1371 | giacomo | 63 | __asm__("cpuid":::"eax","ebx","ecx","edx"); |
64 | kern_frestore(f); |
||
65 | |||
1510 | giacomo | 66 | TRACER_LOGEVENT(FTrace_EVT_ipoint,6000,0); |
1371 | giacomo | 67 | |
1353 | giacomo | 68 | for (i=0;i<1000000000;i++); |
69 | |||
1510 | giacomo | 70 | TRACER_LOGEVENT(FTrace_EVT_trace_stop,0,0); |
71 | |||
1353 | giacomo | 72 | FTrace_disable(); |
1293 | giacomo | 73 | kern_gettime(&end); |
74 | |||
75 | SUBTIMESPEC(&end,&start,&diff); |
||
76 | |||
77 | cprintf("Logged Time %d s %d us\n",(int)diff.tv_sec,(int)diff.tv_nsec/1000); |
||
78 | |||
1411 | giacomo | 79 | FTrace_OSD_init_udp(1, "192.168.1.10", "192.168.1.1"); |
1293 | giacomo | 80 | |
1372 | giacomo | 81 | FTrace_send_chunk(a, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC); |
82 | FTrace_send_chunk(b, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN); |
||
1364 | giacomo | 83 | |
1293 | giacomo | 84 | return 0; |
85 | |||
86 | } |