Subversion Repositories shark

Rev

Rev 1372 | Rev 1508 | 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
 
44
  for (i=0;i<1000000000;i++);
1353 giacomo 45
 
46
  TRACER_LOGEVENT(FTrace_EVT_next_chunk,0,0);
1371 giacomo 47
 
48
  f = kern_fsave();
49
  __asm__("cpuid":::"eax","ebx","ecx","edx");
50
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,1,0);
51
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,2,0);
52
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,3,0);
53
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,4,0);
54
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,5,0);
55
  __asm__("cpuid":::"eax","ebx","ecx","edx");
56
  kern_frestore(f);
57
 
58
  TRACER_LOGEVENT(FTrace_EVT_ipoint,6,0);
59
 
1353 giacomo 60
  for (i=0;i<1000000000;i++);
61
 
62
  FTrace_disable();
1293 giacomo 63
  kern_gettime(&end);
64
 
65
  SUBTIMESPEC(&end,&start,&diff);
66
 
67
  cprintf("Logged Time %d s %d us\n",(int)diff.tv_sec,(int)diff.tv_nsec/1000);
68
 
1411 giacomo 69
  FTrace_OSD_init_udp(1, "192.168.1.10", "192.168.1.1");
1293 giacomo 70
 
1372 giacomo 71
  FTrace_send_chunk(a, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
72
  FTrace_send_chunk(b, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN);
1364 giacomo 73
 
1293 giacomo 74
  return 0;
75
 
76
}