Subversion Repositories shark

Rev

Rev 1355 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1295 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
 
1606 tullio 18
/*
19
 * This program is free software; you can redistribute it and/or modify
20
 * it under the terms of the GNU General Public License as published by
21
 * the Free Software Foundation; either version 2 of the License, or
22
 * (at your option) any later version.
23
 *
24
 * This program is distributed in the hope that it will be useful,
25
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
 * GNU General Public License for more details.
28
 *
29
 * You should have received a copy of the GNU General Public License
30
 * along with this program; if not, write to the Free Software
31
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
32
 *
33
 */
34
 
1295 giacomo 35
#include <kernel/kern.h>
36
#include <tracer.h>
37
 
38
int main(int argc, char **argv)
39
{
40
 
41
  long long i;
42
 
1353 giacomo 43
  int a,b,c;
1295 giacomo 44
  struct timespec start,end,diff;
45
 
1353 giacomo 46
  a = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
47
  b = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN);
48
  c = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
49
 
50
  FTrace_chunk_link(a,b);
51
  FTrace_chunk_link(b,c);
52
 
53
  FTrace_actual_chunk_select(a);
54
 
1295 giacomo 55
  kern_gettime(&start);
1341 giacomo 56
  FTrace_enable();
1295 giacomo 57
 
58
  for (i=0;i<1000000000;i++);
1341 giacomo 59
 
60
  TRACER_LOGEVENT(FTrace_EVT_next_chunk,0,0);
1295 giacomo 61
 
1341 giacomo 62
  for (i=0;i<1000000000;i++);
63
 
64
  FTrace_disable();
1295 giacomo 65
  kern_gettime(&end);
66
 
67
  SUBTIMESPEC(&end,&start,&diff);
68
 
69
  cprintf("Logged Time %d s %d us\n",(int)diff.tv_sec,(int)diff.tv_nsec/1000);
70
 
1353 giacomo 71
  FTrace_chunk_dump(a);
1295 giacomo 72
 
73
  return 0;
74
 
75
}