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 :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
/*
* Copyright (C) 2000 Massimiliano Giorgi
* Copyright (C) 2002 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* CVS : $Id: tdump.c,v 1.1.1.1 2004-05-24 18:03:44 giacomo Exp $
*/
/* this example simply prints a Shark trace file */
#include <netinet/in.h>
#include <stdio.h>
#include "types.h"
#include <trace.h>
#include "util.h"
int dumpsys
(trc_system_event_t
*sys
)
{
/*
if (sys->event==TRC_SCHEDULE) {
//if (sys->prev!=65535)
// printf("%02i->%02i\n",sys->prev,sys->task);
//else
printf("??->%02i\n",sys->task);
return 0;
}
*/
printf("%02i\n",sys
->task
);
return 0;
}
int dumpusr
(trc_user_event_t
*usr
)
{
printf("%8li ",usr
->n
);
printf("\n");
return 0;
}
int dumpsem
(trc_sem_event_t
*sem
)
{
printf("on [%i]\n",sem
->id
);
return 0;
}
int dumpfunc
(trc_event_t
*ev
)
{
static int counter
=0;
printf("%4i ",counter
);
counter
++;
printf("%12s ",format_time
(ev
->time));
printf("%-10s ",event_name
(ev
->event
));
//printf("%08x\n",(unsigned)ev->sys.event);
//return 0;
switch(event_class
(ev
->event
)) {
case TRC_CLASS_SYSTEM
: return dumpsys
(&ev
->x.
sys);
case TRC_CLASS_USER
: return dumpusr
(&ev
->x.
usr);
case TRC_CLASS_SEM
: return dumpsem
(&ev
->x.
sem);
}
printf("\nEVENT %i... CLASS %i UNKNOWN!\n",ev
->event
,event_class
(ev
->event
));
return -1;
}
int main
(int argc
, char *argv
[])
{
int res
;
if (argc
!=2) {
fprintf(stderr
,"missing filename!\n");
return -1;
}
res
=read_trace
(argv
[1],dumpfunc
);
//fprintf(stderr,"result=%i\n",res);
//fprintf(stderr,"size=%li\n",sizeof(trc_event_t));
return 0;
}