Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
1
Merge Requests
1
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
Boxiang Sun
erp5
Commits
88c4ccf7
Commit
88c4ccf7
authored
Aug 29, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that diagram bars are properly aligned in scalability test report.
parent
20bcfa15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
erp5/util/benchmark/report.py
erp5/util/benchmark/report.py
+26
-5
No files found.
erp5/util/benchmark/report.py
View file @
88c4ccf7
...
@@ -269,6 +269,25 @@ def drawDecorator(xlabel, ylabel, with_table=False):
...
@@ -269,6 +269,25 @@ def drawDecorator(xlabel, ylabel, with_table=False):
return
inner
return
inner
def
forceZeroBarDrawing
(
result_list
):
"""
Dirty hack to draw a bar even if the value is zero, otherwise nothing is
drawn and bars are not properly aligned
"""
no_zero_list
=
[]
zero_count
=
0
for
value
in
result_list
:
if
value
==
0
:
value
=
1e-20
zero_count
+=
1
no_zero_list
.
append
(
value
)
if
len
(
result_list
)
==
zero_count
:
return
result_list
return
no_zero_list
@
drawDecorator
(
xlabel
=
None
,
ylabel
=
'Seconds'
,
with_table
=
True
)
@
drawDecorator
(
xlabel
=
None
,
ylabel
=
'Seconds'
,
with_table
=
True
)
def
drawBarDiagram
(
axes
,
stat_list
,
only_average
=
False
):
def
drawBarDiagram
(
axes
,
stat_list
,
only_average
=
False
):
mean_list
=
[]
mean_list
=
[]
...
@@ -306,17 +325,19 @@ def drawBarDiagram(axes, stat_list, only_average=False):
...
@@ -306,17 +325,19 @@ def drawBarDiagram(axes, stat_list, only_average=False):
width
=
0.33
width
=
0.33
avg_rect_position
=
ind
+
width
avg_rect_position
=
ind
+
width
avg_rects
=
axes
.
bar
(
avg_rect_position
,
mean_list
,
width
,
color
=
'r'
,
avg_rects
=
axes
.
bar
(
avg_rect_position
,
forceZeroBarDrawing
(
mean_list
)
,
label
=
'Mean'
)
width
,
color
=
'r'
,
label
=
'Mean'
)
axes
.
errorbar
(
numpy
.
arange
(
0.5
,
len
(
stat_list
)),
mean_list
,
axes
.
errorbar
(
numpy
.
arange
(
0.5
,
len
(
stat_list
)),
mean_list
,
yerr
=
[
yerr_lower
,
yerr_upper
],
fmt
=
None
,
yerr
=
[
yerr_lower
,
yerr_upper
],
fmt
=
None
,
label
=
'Standard deviation'
)
label
=
'Standard deviation'
)
if
not
only_average
:
if
not
only_average
:
min_rects
=
axes
.
bar
(
ind
,
minimum_list
,
width
,
color
=
'y'
,
label
=
'Minimum'
)
min_rects
=
axes
.
bar
(
ind
,
forceZeroBarDrawing
(
minimum_list
),
max_rects
=
axes
.
bar
(
ind
+
width
*
2
,
maximum_list
,
width
,
label
=
'Maximum'
,
width
,
color
=
'y'
,
label
=
'Minimum'
)
color
=
'g'
)
max_rects
=
axes
.
bar
(
ind
+
width
*
2
,
forceZeroBarDrawing
(
maximum_list
),
width
,
label
=
'Maximum'
,
color
=
'g'
)
axes
.
table
(
rowLabels
=
[
'Minimum'
,
'Average'
,
'Std. deviation'
,
'Maximum'
,
'Errors'
],
axes
.
table
(
rowLabels
=
[
'Minimum'
,
'Average'
,
'Std. deviation'
,
'Maximum'
,
'Errors'
],
colLabels
=
label_list
,
colLabels
=
label_list
,
...
...
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