Subversion Repositories shark

Rev

Rev 1372 | Rev 1510 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Project: S.Ha.R.K.
 *
 * Coordinators:
 *   Giorgio Buttazzo    <giorgio@sssup.it>
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *
 * Authors     :
 *   Giacomo Guidi       <giacomo@gandalf.sssup.it>
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://shark.sssup.it
 */


#include <kernel/kern.h>
#include <FTrace_chunk.h>
#include <FTrace_udp.h>
#include <tracer.h>

int main(int argc, char **argv)
{

  long long i;

  int a,b,c;
  struct timespec start,end,diff;
  SYS_FLAGS f;

  a = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
  b = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN);
  c = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);

  FTrace_chunk_link(a,b);
  FTrace_chunk_link(b,c);

  FTrace_actual_chunk_select(a);

  kern_gettime(&start);
  FTrace_enable();

  for (i=0;i<1000000000;i++);
 
  TRACER_LOGEVENT(FTrace_EVT_next_chunk,0,0);
 
  f = kern_fsave();
  __asm__("cpuid":::"eax","ebx","ecx","edx");
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,1,0);
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,2,0);
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,3,0);
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,4,0);
  FAST_TRACER_LOGEVENT(FTrace_EVT_ipoint,5,0);
  __asm__("cpuid":::"eax","ebx","ecx","edx");
  kern_frestore(f);
 
  TRACER_LOGEVENT(FTrace_EVT_ipoint,6,0);
 
  for (i=0;i<1000000000;i++);

  FTrace_disable();
  kern_gettime(&end);

  SUBTIMESPEC(&end,&start,&diff);

  cprintf("Logged Time %d s %d us\n",(int)diff.tv_sec,(int)diff.tv_nsec/1000);

  FTrace_OSD_init_udp(1, "192.168.1.10", "192.168.1.1");

  FTrace_send_chunk(a, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
  FTrace_send_chunk(b, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN);

  return 0;

}