Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : update tesh
[simgrid.git] / tools / fix-paje-trace.sh
1 #!/bin/bash
2
3 # Copyright (c) 2010, 2014. The SimGrid Team.
4 # All rights reserved.
5
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
8
9 if [ -z $1 ]
10 then
11   echo "Usage: $0 {X.trace}"
12   exit
13 fi
14
15 TRACE=$1
16 echo "input: $TRACE"
17 OUTPUT=`echo $TRACE | cut -d\. -f1`.fix.trace
18
19 cat $TRACE | grep ^% > header
20 DEFEVENTS=`cat header | grep Define | awk '{ print $3 }'`
21
22 GREP=""
23 GREP2=""
24 for i in $DEFEVENTS
25 do
26   GREP="/^$i /d; $GREP"
27   GREP2="-e '^$i ' $GREP2"
28 done
29 GREP="/^%\ /d; /^%E/d; $GREP"
30
31 cat $TRACE | eval grep $GREP2 > types
32 /bin/sed -e "$GREP" $TRACE > events
33 cat events |  sort -n -k 2 -s > events.sorted
34 cat header types events.sorted > $OUTPUT
35 rm types events events.sorted header
36
37 echo "output: $OUTPUT"