Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos
Commits
73ec76fd
Commit
73ec76fd
authored
Oct 03, 2024
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5/test: add a script to draw a graph from benchmark results.
parent
d4df80f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
software/erp5/test/plot_benchmark_result.py
software/erp5/test/plot_benchmark_result.py
+60
-0
No files found.
software/erp5/test/plot_benchmark_result.py
0 → 100644
View file @
73ec76fd
import
argparse
import
glob
import
json
import
matplotlib.pyplot
as
plt
import
os
parser
=
argparse
.
ArgumentParser
(
description
=
'Generate a graph from benchmark results.'
)
parser
.
add_argument
(
'dir'
,
nargs
=
'+'
,
help
=
'a directory where mesurestest.*.jsonl exists.'
)
parser
.
add_argument
(
'-o'
,
'--output'
,
metavar
=
'filename'
,
required
=
True
,
help
=
'an output filename (.png, .svg etc.)'
)
args
=
parser
.
parse_args
()
duration_list_dict
=
{}
conflict_list_dict
=
{}
deadlock_list_dict
=
{}
def
get_deadlock_total_count
(
data
):
return
data
.
get
(
'innodb_metrics'
,
{}).
get
(
'lock_deadlocks'
)
or
data
.
get
(
'deadlock_total_count'
)
or
0
for
dir
in
args
.
dir
:
dir
=
dir
.
rstrip
(
'/'
)
path
,
=
glob
.
glob
(
os
.
path
.
join
(
dir
,
'measurestest.*.jsonl'
))
duration_list
=
[]
conflict_list
=
[]
deadlock_list
=
[]
last_data
=
{}
for
l
in
open
(
path
).
readlines
():
data
=
json
.
loads
(
l
)
if
'iteration_'
in
l
:
duration_list
.
append
(
data
[
'step_duration_seconds'
])
conflict_list
.
append
(
data
[
'zeo_stats'
][
'conflicts'
]
-
last_data
[
'zeo_stats'
][
'conflicts'
])
deadlock_total_count
=
get_deadlock_total_count
(
data
)
if
deadlock_total_count
:
deadlock_list
.
append
(
deadlock_total_count
-
get_deadlock_total_count
(
last_data
))
last_data
=
data
duration_list_dict
[
dir
]
=
duration_list
conflict_list_dict
[
dir
]
=
conflict_list
deadlock_list_dict
[
dir
]
=
deadlock_list
plt
.
figure
(
figsize
=
(
7
,
10
))
ax
=
plt
.
subplot
(
3
,
1
,
1
)
plt
.
title
(
'Duration'
)
for
k
,
duration_list
in
duration_list_dict
.
items
():
plt
.
plot
(
range
(
len
(
duration_list
)),
duration_list
,
'-'
,
label
=
k
)
ax
.
set_ylim
(
ymin
=
0
)
plt
.
legend
(
loc
=
'upper right'
,
framealpha
=
0.7
)
ax
=
plt
.
subplot
(
3
,
1
,
2
)
plt
.
title
(
'ZODB Conflicts'
)
for
k
,
conflict_list
in
conflict_list_dict
.
items
():
plt
.
plot
(
range
(
len
(
conflict_list
)),
conflict_list
,
'-'
,
label
=
k
)
ax
.
set_ylim
(
ymin
=
0
)
plt
.
legend
(
loc
=
'upper right'
,
framealpha
=
0.7
)
ax
=
plt
.
subplot
(
3
,
1
,
3
)
plt
.
title
(
'RDB Deadlocks'
)
for
k
,
deadlock_list
in
deadlock_list_dict
.
items
():
plt
.
plot
(
range
(
len
(
deadlock_list
)),
deadlock_list
,
'-'
,
label
=
k
)
ax
.
set_ylim
(
ymin
=
0
)
plt
.
legend
(
loc
=
'upper right'
,
framealpha
=
0.7
)
plt
.
subplots_adjust
(
hspace
=
0.5
)
plt
.
savefig
(
args
.
output
)
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