Rev 1655 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1655 | 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 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * Massimiliano Giorgi <massy@gandalf.sssup.it> |
||
11 | * Luca Abeni <luca@gandalf.sssup.it> |
||
12 | * (see the web pages for full authors list) |
||
13 | * |
||
14 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
15 | * |
||
16 | * http://www.sssup.it |
||
17 | * http://retis.sssup.it |
||
18 | * http://shark.sssup.it |
||
19 | */ |
||
20 | |||
21 | /* |
||
22 | * Copyright (C) 2000 Massimiliano Giorgi |
||
23 | * |
||
24 | * This program is free software; you can redistribute it and/or modify |
||
25 | * it under the terms of the GNU General Public License as published by |
||
26 | * the Free Software Foundation; either version 2 of the License, or |
||
27 | * (at your option) any later version. |
||
28 | * |
||
29 | * This program is distributed in the hope that it will be useful, |
||
30 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
31 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
32 | * GNU General Public License for more details. |
||
33 | * |
||
34 | * You should have received a copy of the GNU General Public License |
||
35 | * along with this program; if not, write to the Free Software |
||
36 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
37 | * |
||
38 | * CVS : $Id: road.c,v 1.1.1.1 2004-05-24 18:03:44 giacomo Exp $ |
||
39 | */ |
||
40 | |||
41 | #include <stdio.h> |
||
42 | #include <stdlib.h> |
||
43 | #include "types.h" |
||
44 | #include <trace.h> |
||
45 | #include "util.h" |
||
46 | |||
47 | |||
48 | /* this test prints the distribution of the HD seeks */ |
||
49 | |||
50 | #define MAXX 1000 |
||
51 | #define PREC 1000 |
||
52 | #define DELTA ((double)MAXX/(double)PREC) |
||
53 | |||
54 | #include "distr.c" |
||
55 | |||
56 | int dumpusr(int event, trc_user_event_t *usr) |
||
57 | { |
||
58 | static long last=-1; |
||
59 | long d; |
||
60 | if (event!=TRC_USER0) return 0; |
||
61 | if (last!=-1) { |
||
62 | d=abs(last-usr->n); |
||
63 | d_insert(d); |
||
64 | } |
||
65 | last=usr->n; |
||
66 | return 0; |
||
67 | } |
||
68 | |||
69 | int dumpfunc(trc_event_t *ev) |
||
70 | { |
||
71 | if (event_class(ev->event)==TRC_CLASS_USER) dumpusr(ev->event,&ev->x.usr); |
||
72 | return 0; |
||
73 | } |
||
74 | |||
75 | int main(int argc, char *argv[]) |
||
76 | { |
||
77 | FILE *fout; |
||
78 | int res; |
||
79 | if (argc!=3) { |
||
80 | fprintf(stderr,"missing filename!\n"); |
||
81 | return -1; |
||
82 | } |
||
83 | d_init(); |
||
84 | res=read_trace(argv[1],dumpfunc); |
||
85 | if (res==0) { |
||
86 | fout=fopen(argv[2],"wt"); |
||
87 | if (fout!=NULL) { |
||
88 | d_dump(fout); |
||
89 | fclose(fout); |
||
90 | } else |
||
91 | fprintf(stderr,"can't create output file!\n"); |
||
92 | } else |
||
93 | fprintf(stderr,"read_trace error\n"); |
||
94 | |||
95 | return 0; |
||
96 | } |