Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Tobias Langer
/
experiment
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f05456ea
authored
Nov 16, 2016
by
Tobias Langer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added script which produces plotable data.
parent
e46daa28
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
0 deletions
+105
-0
analysis.py
+105
-0
No files found.
analysis.py
0 → 100755
View file @
f05456ea
#!/usr/bin/env python3
import
argparse
import
math
def
calc_utilization
(
tasks
):
util
=
0
for
task
in
tasks
:
util
+=
task
[
'wcet'
]
/
task
[
'period'
]
return
util
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Generate plotable results from the experiments.'
)
parser
.
add_argument
(
'results'
,
type
=
str
,
nargs
=
'+'
,
help
=
'file containing experiment results.'
)
args
=
parser
.
parse_args
()
out
=
{}
for
result
in
args
.
results
:
with
open
(
result
,
'r'
)
as
result_file
:
tasks
=
{}
instances
=
{}
for
line
in
result_file
:
tokens
=
line
.
strip
()
.
split
(
' '
)
if
tokens
[
0
]
==
'task'
:
#task 0 wcet 5 period 39 deadline 32 executions 15480
task_id
=
int
(
tokens
[
1
])
wcet
=
int
(
tokens
[
3
])
period
=
int
(
tokens
[
5
])
deadline
=
int
(
tokens
[
7
])
executions
=
int
(
tokens
[
9
])
tasks
[
task_id
]
=
{
'id'
:
task_id
,
'wcet'
:
wcet
,
'period'
:
period
,
'deadline'
:
deadline
,
'executions'
:
executions
}
instances
[
task_id
]
=
{
's2s'
:
0
,
'e2e'
:
0
,
'misses'
:
0
,
'response'
:
0
}
elif
tokens
[
0
]
==
'instance'
:
#instance 12 start 478 end 487 core_id 0
start
=
int
(
tokens
[
3
])
end
=
int
(
tokens
[
5
])
if
start
==
0
and
end
==
0
:
# Ignore not executed tasks, not realy that clean but it
# happens hardly, so nobody should care...
tasks
[
task_id
][
'executions'
]
-=
1
continue
release
=
start
-
(
start
%
tasks
[
task_id
][
'period'
])
abs_deadline
=
release
+
tasks
[
task_id
][
'deadline'
]
instances
[
task_id
][
's2s'
]
+=
start
-
release
instances
[
task_id
][
'e2e'
]
+=
end
-
release
instances
[
task_id
][
'response'
]
+=
end
-
release
if
end
>
abs_deadline
:
instances
[
task_id
][
'misses'
]
+=
1
else
:
continue
util
=
calc_utilization
(
tasks
.
values
())
s2s
=
0
e2e
=
0
misses
=
0
response
=
0
for
task_id
,
task
in
instances
.
items
():
s2s
+=
math
.
sqrt
(
task
[
's2s'
]
/
tasks
[
task_id
][
'executions'
])
e2e
+=
math
.
sqrt
(
task
[
'e2e'
]
/
tasks
[
task_id
][
'executions'
])
misses
+=
task
[
'misses'
]
response
+=
(
task
[
'response'
]
/
tasks
[
task_id
][
'executions'
])
/
tasks
[
task_id
][
'period'
]
s2s
/=
len
(
tasks
)
e2e
/=
len
(
tasks
)
response
/=
len
(
tasks
)
outkey
=
round
(
util
,
2
)
try
:
out
[
outkey
]
.
append
((
s2s
,
e2e
,
misses
,
response
))
except
KeyError
:
out
[
outkey
]
=
[(
s2s
,
e2e
,
misses
,
response
)]
with
open
(
'analysis/s2s.dat'
,
'w'
)
as
s2sfile
:
for
key
,
value
in
out
.
items
():
for
elem
in
value
:
print
(
'{}; {}'
.
format
(
key
,
elem
[
0
]),
file
=
s2sfile
)
with
open
(
'analysis/e2e.dat'
,
'w'
)
as
e2efile
:
for
key
,
value
in
out
.
items
():
for
elem
in
value
:
print
(
'{}; {}'
.
format
(
key
,
elem
[
1
]),
file
=
e2efile
)
with
open
(
'analysis/misses.dat'
,
'w'
)
as
missesfile
:
for
key
,
value
in
out
.
items
():
for
elem
in
value
:
print
(
'{}; {}'
.
format
(
key
,
elem
[
2
]),
file
=
missesfile
)
with
open
(
'analysis/response.dat'
,
'w'
)
as
responsefile
:
for
key
,
value
in
out
.
items
():
for
elem
in
value
:
print
(
'{}; {}'
.
format
(
key
,
elem
[
3
]),
file
=
responsefile
)
if
__name__
==
'__main__'
:
main
()
Write
Preview
Markdown
is supported
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