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
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
Xavier Thompson
erp5
Commits
25c3c180
Commit
25c3c180
authored
Dec 08, 2011
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge bar diagram code into the common decorator.
parent
2b1881fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
58 deletions
+58
-58
erp5/util/benchmark/report.py
erp5/util/benchmark/report.py
+58
-58
No files found.
erp5/util/benchmark/report.py
View file @
25c3c180
...
...
@@ -216,7 +216,56 @@ import pylab
from
matplotlib
import
pyplot
,
ticker
def
drawBarDiagram
(
pdf
,
title
,
stat_list
,
only_average
=
False
):
def
drawDecorator
(
xlabel
,
ylabel
,
with_table
=
False
):
def
inner
(
f
):
def
decorate
(
pdf
,
title
,
*
args
,
**
kwargs
):
# Create the figure
figure
=
pyplot
.
figure
(
figsize
=
(
11.69
,
8.29
))
if
with_table
:
figure
.
subplots_adjust
(
bottom
=
0.13
,
right
=
0.98
,
top
=
0.95
)
else
:
figure
.
subplots_adjust
(
bottom
=
0.1
,
right
=
0.98
,
left
=
0.07
,
top
=
0.95
)
pyplot
.
title
(
title
)
pyplot
.
grid
(
True
,
linewidth
=
1.5
)
# Create the axes
axes
=
figure
.
add_subplot
(
111
)
x_major
,
x_minor
,
y_major
,
y_minor
=
f
(
axes
,
*
args
,
**
kwargs
)
if
x_major
:
axes
.
xaxis
.
set_major_locator
(
x_major
)
axes
.
xaxis
.
grid
(
True
,
'minor'
)
if
x_minor
:
axes
.
xaxis
.
set_minor_locator
(
x_minor
)
if
y_major
:
axes
.
yaxis
.
set_major_locator
(
y_major
)
axes
.
yaxis
.
grid
(
True
,
'minor'
)
if
y_minor
:
axes
.
yaxis
.
set_minor_locator
(
y_minor
)
# Display legend at the best position
axes
.
legend
(
loc
=
0
)
# Add axes labels
if
xlabel
:
axes
.
set_xlabel
(
xlabel
)
if
ylabel
:
axes
.
set_ylabel
(
ylabel
)
pdf
.
savefig
()
pylab
.
close
()
return
decorate
return
inner
@
drawDecorator
(
xlabel
=
None
,
ylabel
=
'Seconds'
,
with_table
=
True
)
def
drawBarDiagram
(
axes
,
stat_list
,
only_average
=
False
):
mean_list
=
[]
yerr_list
=
[]
minimum_list
=
[]
...
...
@@ -240,21 +289,8 @@ def drawBarDiagram(pdf, title, stat_list, only_average=False):
yerr_upper
=
numpy
.
minimum
(
max_array
-
mean_array
,
yerr_list
)
## Draw diagrams
# Create the figure
figure
=
pyplot
.
figure
(
figsize
=
(
11.69
,
8.29
))
figure
.
subplots_adjust
(
bottom
=
0.13
,
right
=
0.98
,
top
=
0.95
)
pyplot
.
title
(
title
)
# Create the axes along with their labels
axes
=
figure
.
add_subplot
(
111
)
axes
.
set_ylabel
(
'Seconds'
)
axes
.
set_xticks
([])
axes
.
yaxis
.
set_major_locator
(
ticker
.
MaxNLocator
(
nbins
=
20
))
axes
.
yaxis
.
set_minor_locator
(
ticker
.
AutoMinorLocator
())
axes
.
yaxis
.
grid
(
True
,
'major'
,
linewidth
=
1.5
)
axes
.
yaxis
.
grid
(
True
,
'minor'
)
# Create the bars
ind
=
numpy
.
arange
(
len
(
label_list
))
width
=
0.33
...
...
@@ -270,9 +306,6 @@ def drawBarDiagram(pdf, title, stat_list, only_average=False):
max_rects
=
axes
.
bar
(
ind
+
width
*
2
,
maximum_list
,
width
,
label
=
'Maximum'
,
color
=
'g'
)
# Add the legend of bars
axes
.
legend
(
loc
=
0
)
axes
.
table
(
rowLabels
=
[
'Minimum'
,
'Average'
,
'Std. deviation'
,
'Maximum'
,
'Errors'
],
colLabels
=
label_list
,
cellText
=
[
formatFloatList
(
minimum_list
),
...
...
@@ -286,44 +319,11 @@ def drawBarDiagram(pdf, title, stat_list, only_average=False):
rowLoc
=
'center'
,
cellLoc
=
'center'
)
pdf
.
savefig
()
pylab
.
close
()
def
drawPlotDecorator
(
xlabel
,
ylabel
):
def
inner
(
f
):
def
decorate
(
pdf
,
title
,
*
args
,
**
kwargs
):
figure
=
pyplot
.
figure
(
figsize
=
(
11.69
,
8.29
),
frameon
=
False
)
figure
.
subplots_adjust
(
bottom
=
0.1
,
right
=
0.98
,
left
=
0.07
,
top
=
0.95
)
pyplot
.
title
(
title
)
pyplot
.
grid
(
True
,
linewidth
=
1.5
)
axes
=
figure
.
add_subplot
(
111
)
x_major
,
x_minor
,
y_major
,
y_minor
=
f
(
axes
,
*
args
,
**
kwargs
)
axes
.
xaxis
.
set_major_locator
(
x_major
)
if
x_minor
:
axes
.
xaxis
.
set_minor_locator
(
x_minor
)
axes
.
xaxis
.
grid
(
True
,
'minor'
)
axes
.
yaxis
.
set_major_locator
(
y_major
)
if
y_minor
:
axes
.
yaxis
.
set_minor_locator
(
y_minor
)
axes
.
yaxis
.
grid
(
True
,
'minor'
)
axes
.
legend
(
loc
=
0
)
axes
.
set_xlabel
(
xlabel
)
axes
.
set_ylabel
(
ylabel
)
pdf
.
savefig
()
pylab
.
close
()
return
decorate
return
inner
return
(
None
,
None
,
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
())
@
draw
Plot
Decorator
(
xlabel
=
'Time (in hours)'
,
ylabel
=
'Use cases'
)
@
drawDecorator
(
xlabel
=
'Time (in hours)'
,
ylabel
=
'Use cases'
)
def
drawUseCasePerNumberOfUserPlot
(
axes
,
use_case_count_list
,
time_elapsed_list
,
...
...
@@ -385,8 +385,8 @@ def drawUseCasePerNumberOfUserPlot(axes,
return
(
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
(),
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
())
@
draw
Plot
Decorator
(
xlabel
=
'Concurrent Users'
,
ylabel
=
'Use cases/h'
)
@
drawDecorator
(
xlabel
=
'Concurrent Users'
,
ylabel
=
'Use cases/h'
)
def
drawConcurrentUsersUseCasePlot
(
axes
,
nb_users_list
,
use_case_stat_list
,
...
...
@@ -452,8 +452,8 @@ def drawConcurrentUsersUseCasePlot(axes,
return
(
ticker
.
FixedLocator
(
nb_users_list
),
None
,
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
())
@
draw
Plot
Decorator
(
xlabel
=
'Concurrent users'
,
ylabel
=
'Seconds'
)
@
drawDecorator
(
xlabel
=
'Concurrent users'
,
ylabel
=
'Seconds'
)
def
drawConcurrentUsersPlot
(
axes
,
nb_users_list
,
stat_list
,
only_average
=
False
):
min_array
=
numpy
.
array
([
stat
.
minimum
for
stat
in
stat_list
])
mean_array
=
numpy
.
array
([
stat
.
mean
for
stat
in
stat_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