Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Iker Martín Álvarez
Proteo
Commits
2b3f5e66
Commit
2b3f5e66
authored
Nov 02, 2022
by
iker_martin
Browse files
Rama Analysis - Refactor a nuevo sistema de ficheros
parent
b5d18427
Changes
1
Show whitespace changes
Inline
Side-by-side
Analysis/MallTimes.py
View file @
2b3f5e66
...
...
@@ -45,33 +45,26 @@ def record(f, observation, line):
#else:
# getData(lineS, observation, 13)
#-----------------------------------------------
def
read_file
(
f
,
dataA
,
dataB
,
it
):
recording
=
False
resizes
=
0
timer
=
0
previousNP
=
0
for
line
in
f
:
lineS
=
line
.
split
()
if
len
(
lineS
)
>
0
:
if
lineS
[
0
]
==
"Config"
:
# CONFIG LINE
recording
=
True
it
+=
1
# Obtains the value of a given index in a splited line
# and returns it as a float values
def
get_value
(
line
,
index
):
return
float
(
line
[
index
].
split
(
'='
)[
1
].
split
(
','
)[
0
])
# Obtains the general parameters of an execution and
# stores them for creating a dataframe
def
record_config_line
(
lineS
,
dataA
,
dataB
):
dataA
.
append
([
None
]
*
13
)
dataB
.
append
([
None
]
*
15
)
#
resizes = int(
lineS[2].split('=')[1].split(',')[0]
)
resizes
=
2
compute_tam
=
int
(
lineS
[
3
].
split
(
'='
)[
1
].
split
(
','
)[
0
]
)
comm_tam
=
int
(
lineS
[
4
].
split
(
'='
)[
1
].
split
(
','
)[
0
]
)
s
dr
=
int
(
lineS
[
5
].
split
(
'='
)[
1
].
split
(
','
)[
0
])
adr
=
int
(
lineS
[
6
].
split
(
'='
)[
1
].
split
(
','
)[
0
])
#TODO Que lo tome como porcentaje
css
=
int
(
lineS
[
8
].
split
(
'='
)[
1
].
split
(
','
)[
0
]
)
cst
=
int
(
lineS
[
9
].
split
(
'='
)[
1
].
split
(
','
)[
0
]
)
# TODO Que obtenga Aib
time
=
float
(
lineS
[
10
].
split
(
'='
)[
1
]
)
resizes
=
int
(
get_value
(
lineS
,
2
)
)
stages
=
int
(
get_value
(
lineS
,
3
))
compute_tam
=
int
(
get_value
(
lineS
,
4
)
)
sdr
=
int
(
get_value
(
lineS
,
5
)
)
a
dr
=
int
(
get_value
(
lineS
,
6
))
#TODO Que lo tome como porcentaje
at
=
int
(
get_value
(
lineS
,
7
))
sm
=
int
(
get_value
(
lineS
,
8
)
)
ss
=
int
(
get_value
(
lineS
,
9
)
)
latency
=
get_value
(
lineS
,
10
)
bw
=
get_value
(
lineS
,
11
)
dataB
[
it
][
0
]
=
sdr
dataB
[
it
][
1
]
=
adr
...
...
@@ -93,6 +86,64 @@ def read_file(f, dataA, dataB, it):
dataA
[
it
][
10
]
=
time
dataA
[
it
][
11
]
=
""
def
record_stage_line
(
lineS
,
dataG_it
,
dataM_it
):
pt
=
int
(
get_value
(
lineS
,
2
))
t_stage
=
get_value
(
lineS
,
3
)
u_bytes
=
int
(
get_value
(
lineS
,
4
))
dataG_it
[].
append
(
pt
)
dataG_it
[].
append
(
t_stage
)
dataG_it
[].
append
(
u_bytes
)
dataM_it
[].
append
(
pt
)
dataM_it
[].
append
(
t_stage
)
dataM_it
[].
append
(
u_bytes
)
def
record_resize_line
(
lineS
,
dataG_it
,
dataM_it
):
iters
=
int
(
lineS
[
2
].
split
(
'='
)[
1
].
split
(
','
)[
0
])
npr
=
int
(
lineS
[
3
].
split
(
'='
)[
1
].
split
(
','
)[
0
])
dist
=
lineS
[
5
].
split
(
'='
)[
1
]
resizes
=
resizes
-
1
if
resizes
==
0
:
dataB
[
it
][
3
]
=
npr
dataB
[
it
][
4
]
+=
dist
dataB
[
it
][
10
]
+=
str
(
iters
)
dataA
[
it
][
4
]
=
npr
#FIXME No sera correcta si hay mas de una reconfig
dataA
[
it
][
2
]
=
str
(
previousNP
)
+
","
+
str
(
npr
)
dataA
[
it
][
5
]
+=
dist
dataA
[
it
][
11
]
+=
str
(
iters
)
timer
=
4
else
:
dataB
[
it
][
2
]
=
npr
dataB
[
it
][
4
]
+=
dist
+
","
dataB
[
it
][
10
]
+=
str
(
iters
)
+
","
dataA
[
it
][
3
]
=
npr
dataA
[
it
][
5
]
+=
dist
+
","
dataA
[
it
][
11
]
+=
str
(
iters
)
+
","
previousNP
=
npr
#-----------------------------------------------
def
read_file
(
f
,
dataA
,
dataB
,
it
):
recording
=
False
resizes
=
0
timer
=
0
previousNP
=
0
for
line
in
f
:
lineS
=
line
.
split
()
if
len
(
lineS
)
>
0
:
if
lineS
[
0
]
==
"Config"
:
# CONFIG LINE
recording
=
True
it
+=
1
record_config
(
lineS
,
dataG
,
dataM
)
elif
lineS
[
0
]
==
"Stage"
:
record_stage_line
(
lineS
,
dataG
,
dataM
)
elif
lineS
[
0
]
==
"Resize"
:
elif
recording
and
resizes
!=
0
:
# RESIZE LINE
iters
=
int
(
lineS
[
2
].
split
(
'='
)[
1
].
split
(
','
)[
0
])
npr
=
int
(
lineS
[
3
].
split
(
'='
)[
1
].
split
(
','
)[
0
])
...
...
@@ -165,26 +216,27 @@ else:
insideDir
=
"Run"
lista
=
glob
.
glob
(
"./"
+
BaseDir
+
insideDir
+
"*/"
+
sys
.
argv
[
1
]
+
"*Global.o*"
)
lista
+=
(
glob
.
glob
(
"./"
+
BaseDir
+
sys
.
argv
[
1
]
+
"*Global.o*"
))
# Se utiliza cuando solo hay un nivel de directorios
print
(
"Number of files found: "
+
str
(
len
(
lista
)));
it
=
-
1
data
A
=
[]
data
B
=
[]
columns
A
=
[
"N"
,
"%Async"
,
"Groups"
,
"NP"
,
"NS"
,
"Dist"
,
"Matrix"
,
"CommTam"
,
"Cst"
,
"Css"
,
"Time"
,
"Iters"
,
"TE"
]
#13
columns
B
=
[
"N"
,
"%Async"
,
"NP"
,
"NS"
,
"Dist"
,
"Matrix"
,
"CommTam"
,
"Cst"
,
"Css"
,
"Time"
,
"Iters"
,
"TC"
,
"TH"
,
"TS"
,
"TA"
]
#15
data
G
=
[]
data
M
=
[]
columns
G
=
[
"N"
,
"%Async"
,
"Groups"
,
"NP"
,
"NS"
,
"Dist"
,
"Matrix"
,
"CommTam"
,
"Cst"
,
"Css"
,
"Time"
,
"Iters"
,
"TE"
]
#13
columns
M
=
[
"N"
,
"%Async"
,
"NP"
,
"NS"
,
"Dist"
,
"Matrix"
,
"CommTam"
,
"Cst"
,
"Css"
,
"Time"
,
"Iters"
,
"TC"
,
"TH"
,
"TS"
,
"TA"
]
#15
for
elem
in
lista
:
f
=
open
(
elem
,
"r"
)
it
=
read_file
(
f
,
data
A
,
data
B
,
it
)
it
=
read_file
(
f
,
data
G
,
data
M
,
it
)
f
.
close
()
#print(data)
df
A
=
pd
.
DataFrame
(
data
A
,
columns
=
columns
A
)
df
A
.
to_csv
(
name
+
'G.csv'
)
df
G
=
pd
.
DataFrame
(
data
G
,
columns
=
columns
G
)
df
G
.
to_csv
(
name
+
'G.csv'
)
df
B
=
pd
.
DataFrame
(
data
B
,
columns
=
columns
B
)
df
M
=
pd
.
DataFrame
(
data
M
,
columns
=
columns
M
)
#Poner en TC el valor real y en TH el necesario para la app
cond
=
df
B
.
TH
!=
0
df
B
.
loc
[
cond
,
[
'TC'
,
'TH'
]]
=
dfB
.
loc
[
cond
,
[
'TH'
,
'TC'
]].
values
df
B
.
to_csv
(
name
+
'M.csv'
)
cond
=
df
M
.
TH
!=
0
df
M
.
loc
[
cond
,
[
'TC'
,
'TH'
]]
=
dfB
.
loc
[
cond
,
[
'TH'
,
'TC'
]].
values
df
M
.
to_csv
(
name
+
'M.csv'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment