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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Noah Brackenbury
erp5
Commits
0306787c
Commit
0306787c
authored
Dec 08, 2011
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add argument to specify whether minimum and maximum plots should not be created.
parent
f57d9de3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
22 deletions
+35
-22
erp5/util/benchmark/report.py
erp5/util/benchmark/report.py
+35
-22
No files found.
erp5/util/benchmark/report.py
View file @
0306787c
...
@@ -66,6 +66,13 @@ def parseArguments():
...
@@ -66,6 +66,13 @@ def parseArguments():
type
=
re
.
compile
,
type
=
re
.
compile
,
help
=
'Ignore labels with the specified regex'
)
help
=
'Ignore labels with the specified regex'
)
parser
.
add_argument
(
'--only-average-plots'
,
dest
=
'only_average'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Do not create maximum and minimum plots, '
'only average (with standard deviation)'
)
parser
.
add_argument
(
'report_directory'
,
parser
.
add_argument
(
'report_directory'
,
help
=
'Reports directory'
)
help
=
'Reports directory'
)
...
@@ -209,7 +216,7 @@ import pylab
...
@@ -209,7 +216,7 @@ import pylab
from
matplotlib
import
pyplot
,
ticker
from
matplotlib
import
pyplot
,
ticker
def
drawBarDiagram
(
pdf
,
title
,
stat_list
):
def
drawBarDiagram
(
pdf
,
title
,
stat_list
,
only_average
=
False
):
mean_list
=
[]
mean_list
=
[]
yerr_list
=
[]
yerr_list
=
[]
minimum_list
=
[]
minimum_list
=
[]
...
@@ -252,14 +259,14 @@ def drawBarDiagram(pdf, title, stat_list):
...
@@ -252,14 +259,14 @@ def drawBarDiagram(pdf, title, stat_list):
ind
=
numpy
.
arange
(
len
(
label_list
))
ind
=
numpy
.
arange
(
len
(
label_list
))
width
=
0.33
width
=
0.33
min_rects
=
axes
.
bar
(
ind
,
minimum_list
,
width
,
color
=
'y'
,
label
=
'Minimum'
)
avg_rects
=
axes
.
bar
(
ind
+
width
,
mean_list
,
width
,
color
=
'r'
,
label
=
'Mean'
)
avg_rects
=
axes
.
bar
(
ind
+
width
,
mean_list
,
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
:
min_rects
=
axes
.
bar
(
ind
,
minimum_list
,
width
,
color
=
'y'
,
label
=
'Minimum'
)
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'
)
...
@@ -320,7 +327,8 @@ def drawPlotDecorator(xlabel, ylabel):
...
@@ -320,7 +327,8 @@ def drawPlotDecorator(xlabel, ylabel):
def
drawUseCasePerNumberOfUserPlot
(
axes
,
def
drawUseCasePerNumberOfUserPlot
(
axes
,
use_case_count_list
,
use_case_count_list
,
time_elapsed_list
,
time_elapsed_list
,
is_single_plot
=
False
):
is_single_plot
=
False
,
only_average
=
False
):
def
get_cum_stat
(
stat_list
):
def
get_cum_stat
(
stat_list
):
cum_min_list
=
[]
cum_min_list
=
[]
cum_min
=
0
cum_min
=
0
...
@@ -350,8 +358,6 @@ def drawUseCasePerNumberOfUserPlot(axes,
...
@@ -350,8 +358,6 @@ def drawUseCasePerNumberOfUserPlot(axes,
if
is_single_plot
:
if
is_single_plot
:
axes
.
plot
(
time_cum_max_list
,
use_case_cum_max_list
,
'gs-'
)
axes
.
plot
(
time_cum_max_list
,
use_case_cum_max_list
,
'gs-'
)
else
:
else
:
axes
.
plot
(
time_cum_min_list
,
use_case_cum_min_list
,
'yo-'
,
label
=
'Minimum'
)
xerr_list
=
[
stat
.
standard_deviation
for
stat
in
time_elapsed_list
]
xerr_list
=
[
stat
.
standard_deviation
for
stat
in
time_elapsed_list
]
xerr_left
=
numpy
.
minimum
([(
cum_mean
-
time_cum_min_list
[
i
])
for
i
,
cum_mean
in
\
xerr_left
=
numpy
.
minimum
([(
cum_mean
-
time_cum_min_list
[
i
])
for
i
,
cum_mean
in
\
...
@@ -372,6 +378,8 @@ def drawUseCasePerNumberOfUserPlot(axes,
...
@@ -372,6 +378,8 @@ def drawUseCasePerNumberOfUserPlot(axes,
fmt
=
'D-'
,
fmt
=
'D-'
,
capsize
=
10.0
)
capsize
=
10.0
)
if
not
only_average
:
axes
.
plot
(
time_cum_min_list
,
use_case_cum_min_list
,
'yo-'
,
label
=
'Minimum'
)
axes
.
plot
(
time_cum_max_list
,
use_case_cum_max_list
,
'gs-'
,
label
=
'Maximum'
)
axes
.
plot
(
time_cum_max_list
,
use_case_cum_max_list
,
'gs-'
,
label
=
'Maximum'
)
return
(
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
(),
return
(
ticker
.
MaxNLocator
(
nbins
=
20
),
ticker
.
AutoMinorLocator
(),
...
@@ -381,7 +389,8 @@ def drawUseCasePerNumberOfUserPlot(axes,
...
@@ -381,7 +389,8 @@ def drawUseCasePerNumberOfUserPlot(axes,
ylabel
=
'Use cases/h'
)
ylabel
=
'Use cases/h'
)
def
drawConcurrentUsersUseCasePlot
(
axes
,
def
drawConcurrentUsersUseCasePlot
(
axes
,
nb_users_list
,
nb_users_list
,
use_case_stat_list
):
use_case_stat_list
,
only_average
=
False
):
use_case_per_hour_min_list
=
[]
use_case_per_hour_min_list
=
[]
use_case_per_hour_mean_list
=
[]
use_case_per_hour_mean_list
=
[]
use_case_per_hour_max_list
=
[]
use_case_per_hour_max_list
=
[]
...
@@ -423,8 +432,6 @@ def drawConcurrentUsersUseCasePlot(axes,
...
@@ -423,8 +432,6 @@ def drawConcurrentUsersUseCasePlot(axes,
y_error_lower_list
.
append
(
y_error_lower
)
y_error_lower_list
.
append
(
y_error_lower
)
y_error_upper_list
.
append
(
y_error_upper
)
y_error_upper_list
.
append
(
y_error_upper
)
axes
.
plot
(
nb_users_list
,
use_case_per_hour_min_list
,
'yo-'
,
label
=
'Minimum'
)
axes
.
errorbar
(
nb_users_list
,
axes
.
errorbar
(
nb_users_list
,
use_case_per_hour_mean_list
,
use_case_per_hour_mean_list
,
yerr
=
[
y_error_lower_list
,
y_error_upper_list
],
yerr
=
[
y_error_lower_list
,
y_error_upper_list
],
...
@@ -435,6 +442,8 @@ def drawConcurrentUsersUseCasePlot(axes,
...
@@ -435,6 +442,8 @@ def drawConcurrentUsersUseCasePlot(axes,
fmt
=
'D-'
,
fmt
=
'D-'
,
capsize
=
10.0
)
capsize
=
10.0
)
if
not
only_average
:
axes
.
plot
(
nb_users_list
,
use_case_per_hour_min_list
,
'yo-'
,
label
=
'Minimum'
)
axes
.
plot
(
nb_users_list
,
use_case_per_hour_max_list
,
'gs-'
,
label
=
'Maximum'
)
axes
.
plot
(
nb_users_list
,
use_case_per_hour_max_list
,
'gs-'
,
label
=
'Maximum'
)
axes
.
set_xticks
(
nb_users_list
)
axes
.
set_xticks
(
nb_users_list
)
...
@@ -445,7 +454,7 @@ def drawConcurrentUsersUseCasePlot(axes,
...
@@ -445,7 +454,7 @@ def drawConcurrentUsersUseCasePlot(axes,
@
drawPlotDecorator
(
xlabel
=
'Concurrent users'
,
@
drawPlotDecorator
(
xlabel
=
'Concurrent users'
,
ylabel
=
'Seconds'
)
ylabel
=
'Seconds'
)
def
drawConcurrentUsersPlot
(
axes
,
nb_users_list
,
stat_list
):
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
])
mean_array
=
numpy
.
array
([
stat
.
mean
for
stat
in
stat_list
])
mean_array
=
numpy
.
array
([
stat
.
mean
for
stat
in
stat_list
])
max_array
=
numpy
.
array
([
stat
.
maximum
for
stat
in
stat_list
])
max_array
=
numpy
.
array
([
stat
.
maximum
for
stat
in
stat_list
])
...
@@ -454,8 +463,6 @@ def drawConcurrentUsersPlot(axes, nb_users_list, stat_list):
...
@@ -454,8 +463,6 @@ def drawConcurrentUsersPlot(axes, nb_users_list, stat_list):
yerr_lower
=
numpy
.
minimum
(
mean_array
-
min_array
,
yerr_list
)
yerr_lower
=
numpy
.
minimum
(
mean_array
-
min_array
,
yerr_list
)
yerr_upper
=
numpy
.
minimum
(
max_array
-
mean_array
,
yerr_list
)
yerr_upper
=
numpy
.
minimum
(
max_array
-
mean_array
,
yerr_list
)
axes
.
plot
(
nb_users_list
,
min_array
,
'yo-'
,
label
=
'Minimum'
)
axes
.
errorbar
(
nb_users_list
,
axes
.
errorbar
(
nb_users_list
,
mean_array
,
mean_array
,
yerr
=
[
yerr_lower
,
yerr_upper
],
yerr
=
[
yerr_lower
,
yerr_upper
],
...
@@ -466,6 +473,8 @@ def drawConcurrentUsersPlot(axes, nb_users_list, stat_list):
...
@@ -466,6 +473,8 @@ def drawConcurrentUsersPlot(axes, nb_users_list, stat_list):
fmt
=
'D-'
,
fmt
=
'D-'
,
capsize
=
10.0
)
capsize
=
10.0
)
if
not
only_average
:
axes
.
plot
(
nb_users_list
,
min_array
,
'yo-'
,
label
=
'Minimum'
)
axes
.
plot
(
nb_users_list
,
max_array
,
'gs-'
,
label
=
'Maximum'
)
axes
.
plot
(
nb_users_list
,
max_array
,
'gs-'
,
label
=
'Maximum'
)
axes
.
set_xticks
(
nb_users_list
)
axes
.
set_xticks
(
nb_users_list
)
...
@@ -522,7 +531,8 @@ def generateReport():
...
@@ -522,7 +531,8 @@ def generateReport():
drawBarDiagram
(
pdf
,
title
,
drawBarDiagram
(
pdf
,
title
,
stat_list
[
slice_start_idx
:
slice_start_idx
+
stat_list
[
slice_start_idx
:
slice_start_idx
+
DIAGRAM_PER_PAGE
])
DIAGRAM_PER_PAGE
],
only_average
=
argument_namespace
.
only_average
)
for
suite_name
,
use_case_dict
in
use_case_dict
.
viewitems
():
for
suite_name
,
use_case_dict
in
use_case_dict
.
viewitems
():
drawUseCasePerNumberOfUserPlot
(
drawUseCasePerNumberOfUserPlot
(
...
@@ -530,7 +540,8 @@ def generateReport():
...
@@ -530,7 +540,8 @@ def generateReport():
"Scalability for %s with %d users"
%
(
suite_name
,
nb_users
),
"Scalability for %s with %d users"
%
(
suite_name
,
nb_users
),
use_case_dict
[
'count_stats'
],
use_case_dict
[
'count_stats'
],
use_case_dict
[
'duration_stats'
],
use_case_dict
[
'duration_stats'
],
is_single_plot
=
(
nb_users
==
1
))
is_single_plot
=
(
nb_users
==
1
),
only_average
=
argument_namespace
.
only_average
)
if
is_range_user
:
if
is_range_user
:
nb_users_list
=
per_nb_users_report_dict
.
keys
()
nb_users_list
=
per_nb_users_report_dict
.
keys
()
...
@@ -544,13 +555,15 @@ def generateReport():
...
@@ -544,13 +555,15 @@ def generateReport():
pdf
,
pdf
,
title_fmt
%
label
,
title_fmt
%
label
,
nb_users_list
,
nb_users_list
,
stat_list
)
stat_list
,
only_average
=
argument_namespace
.
only_average
)
drawConcurrentUsersUseCasePlot
(
drawConcurrentUsersUseCasePlot
(
pdf
,
pdf
,
title_fmt
%
(
"%s: Use cases"
%
suite_name
),
title_fmt
%
(
"%s: Use cases"
%
suite_name
),
nb_users_list
,
nb_users_list
,
report_dict
[
'use_cases'
])
report_dict
[
'use_cases'
],
only_average
=
argument_namespace
.
only_average
)
pdf
.
close
()
pdf
.
close
()
...
...
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