-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·96 lines (94 loc) · 2.38 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
filename=$1
fileactiontrace=${filename%.*}"_action_trace.txt"
filecontent="storage_content.txt"
filedeployment=${filename%.*}"_deployment.xml"
awk -F',' '/file,open/ {gsub("/home","",$10);print $10" "$15}' $filename | sort -u -k1,1 > $filecontent
printf "<?xml version='1.0'?>\n<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid.dtd\">\n<platform version=\"3\">\n" >$filedeployment
starttime=0;
awk -F',' '/file/ && !d[$9]++ && $9!=0 {if(starttime==0)
{starttime=$1;
}
else{
gsub("Z","",$1);
gsub("T"," ",$1);
gsub("Z","",starttime);
gsub("T"," ",starttime);
cmd="echo $(date -d \""$1"\" +%s%N) - $(date -d \""starttime"\" +%s%N) | bc";
cmd | getline var
};
printf(" <process host=\"denise\" function=\"%s\" start_time=\"%.9f\"/>\n",$9,(var/1e9))}' $filename >> $filedeployment
echo "</platform>" >> $filedeployment
awk -F ',' '/file/' $filename|awk -F',' '
function compare(action,pid,filepath)
{
if(action=="open"||action=="creat")
{
fileopen[fno++]=pid;
fileopenpath[gno++]=filepath;
}
if(action=="release"&&pid=="0")
{
for(k=0;k<fno;k++)
{
if(filepath==fileopenpath[k])
{
gsub("0",fileopen[k],pid);
for(h=k;h<fno-1;h++)
{
fileopen[h]=fileopen[h+1];
fileopenpath[h]=fileopenpath[h+1];
}
fno=fno-1;
gno=gno-1;
break;
}
}
}
return pid;
}
function compute(starttime,endtime,pid,filepath)
{
gsub("home",pid,filepath);
find=0;
gsub("Z","",starttime);
gsub("T"," ",starttime);
gsub("Z","",endtime);
gsub("T"," ",endtime);
for(i=0;i<no;i++)
{
if(filepath==filestr[i])
{
find=1;
cmd="echo $(date -d \""starttime"\" +%s%N) - $(date -d \""timestr[i]"\" +%s%N) | bc";
cmd | getline var;
close(cmd);
filestr[i]=filepath;
timestr[i]=endtime;
}
}
if(find==0){
filestr[no++]=filepath;
timestr[tno++]=endtime;
var=0;
}
return var;
}
{
ppid=compare($12,$9,$10);
dur=compute($1,$2,ppid,$10);
if(dur!=0)
{printf("%s %s %s %.9f\n",ppid,"compute",$10,dur*(1e-9))}
if($12=="read")
{printf("%s %s %s %.9f %s %s %s\n",ppid,$12,$10,$3*(1e-9),$17,$14,$15)}
else if($12=="write")
{printf("%s %s %s %.9f %s %s %s\n",ppid,$12,$10,$3*(1e-9),$16,$13,$14)}
else if($12=="open")
{printf("%s %s %s %.9f %s\n",ppid,$12,$10,$3*(1e-9),$17)}
else if($12=="creat"||$12=="flush")
{printf("%s %s %s %.9f %s\n",ppid,$12,$10,$3*(1e-9),$15)}
else if($12=="release")
{printf("%s %s %s %.9f %s\n",ppid,$12,$10,$3*(1e-9),$13)}
else
{printf("%s %s %s %.9f\n",ppid,$12,$10,$3*(1e-9))}
}' >$fileactiontrace