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
Ekaterina
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
Show 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
...
@@ -216,7 +216,56 @@ import pylab
from
matplotlib
import
pyplot
,
ticker
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
=
[]
mean_list
=
[]
yerr_list
=
[]
yerr_list
=
[]
minimum_list
=
[]
minimum_list
=
[]
...
@@ -240,21 +289,8 @@ def drawBarDiagram(pdf, title, stat_list, only_average=False):
...
@@ -240,21 +289,8 @@ def drawBarDiagram(pdf, title, stat_list, only_average=False):
yerr_upper
=
numpy
.
minimum
(
max_array
-
mean_array
,
yerr_list
)
yerr_upper
=
numpy
.
minimum
(
max_array
-
mean_array
,
yerr_list
)
## Draw diagrams
## 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
.
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
# Create the bars
ind
=
numpy
.
arange
(
len
(
label_list
))
ind
=
numpy
.
arange
(
len
(
label_list
))
width
=
0.33
width
=
0.33
...
@@ -270,9 +306,6 @@ def drawBarDiagram(pdf, title, stat_list, only_average=False):
...
@@ -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'
,
max_rects
=
axes
.
bar
(
ind
+
width
*
2
,
maximum_list
,
width
,
label
=
'Maximum'
,
color
=
'g'
)
color
=
'g'
)
# Add the legend of bars
axes
.
legend
(
loc
=
0
)
axes
.
table
(
rowLabels
=
[
'Minimum'
,
'Average'
,
'Std. deviation'
,
'Maximum'
,
'Errors'
],
axes
.
table
(
rowLabels
=
[
'Minimum'
,
'Average'
,
'Std. deviation'
,
'Maximum'
,
'Errors'
],
colLabels
=
label_list
,
colLabels
=
label_list
,
cellText
=
[
formatFloatList
(
minimum_list
),
cellText
=
[
formatFloatList
(
minimum_list
),
...
@@ -286,43 +319,10 @@ def drawBarDiagram(pdf, title, stat_list, only_average=False):
...
@@ -286,43 +319,10 @@ def drawBarDiagram(pdf, title, stat_list, only_average=False):
rowLoc
=
'center'
,
rowLoc
=
'center'
,
cellLoc
=
'center'
)
cellLoc
=
'center'
)
pdf
.
savefig
()
return
(
None
,
None
,
pylab
.
close
()
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
())
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
@
draw
Plot
Decorator
(
xlabel
=
'Time (in hours)'
,
@
drawDecorator
(
xlabel
=
'Time (in hours)'
,
ylabel
=
'Use cases'
)
ylabel
=
'Use cases'
)
def
drawUseCasePerNumberOfUserPlot
(
axes
,
def
drawUseCasePerNumberOfUserPlot
(
axes
,
use_case_count_list
,
use_case_count_list
,
...
@@ -385,7 +385,7 @@ def drawUseCasePerNumberOfUserPlot(axes,
...
@@ -385,7 +385,7 @@ def drawUseCasePerNumberOfUserPlot(axes,
return
(
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
(),
return
(
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
(),
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
())
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
())
@
draw
Plot
Decorator
(
xlabel
=
'Concurrent Users'
,
@
drawDecorator
(
xlabel
=
'Concurrent Users'
,
ylabel
=
'Use cases/h'
)
ylabel
=
'Use cases/h'
)
def
drawConcurrentUsersUseCasePlot
(
axes
,
def
drawConcurrentUsersUseCasePlot
(
axes
,
nb_users_list
,
nb_users_list
,
...
@@ -452,7 +452,7 @@ def drawConcurrentUsersUseCasePlot(axes,
...
@@ -452,7 +452,7 @@ def drawConcurrentUsersUseCasePlot(axes,
return
(
ticker
.
FixedLocator
(
nb_users_list
),
None
,
return
(
ticker
.
FixedLocator
(
nb_users_list
),
None
,
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
())
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
())
@
draw
Plot
Decorator
(
xlabel
=
'Concurrent users'
,
@
drawDecorator
(
xlabel
=
'Concurrent users'
,
ylabel
=
'Seconds'
)
ylabel
=
'Seconds'
)
def
drawConcurrentUsersPlot
(
axes
,
nb_users_list
,
stat_list
,
only_average
=
False
):
def
drawConcurrentUsersPlot
(
axes
,
nb_users_list
,
stat_list
,
only_average
=
False
):
min_array
=
numpy
.
array
([
stat
.
minimum
for
stat
in
stat_list
])
min_array
=
numpy
.
array
([
stat
.
minimum
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