Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apachedex
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
Xiaowu Zhang
apachedex
Commits
9aa3b814
Commit
9aa3b814
authored
Apr 04, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Specify threshold in seconds.
parent
ab6cae21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
apachedex/__init__.py
apachedex/__init__.py
+16
-12
No files found.
apachedex/__init__.py
View file @
9aa3b814
...
...
@@ -76,6 +76,7 @@ def getClassForStatusHit(hit, status):
class
APDEXStats
(
object
):
def
__init__
(
self
,
threshold
):
threshold
*=
US_PER_S
self
.
threshold
=
threshold
self
.
threshold4
=
threshold
*
APDEX_TOLERATING_COEF
self
.
apdex_1
=
0
...
...
@@ -108,9 +109,12 @@ class APDEXStats(object):
def
getAverage
(
self
):
if
self
.
hit
:
return
float
(
self
.
duration_total
)
/
self
.
hit
return
float
(
self
.
duration_total
)
/
(
US_PER_S
*
self
.
hit
)
return
0
def
getMax
(
self
):
return
float
(
self
.
duration_max
)
/
US_PER_S
class
GenericSiteStats
(
object
):
def
__init__
(
self
,
threshold
,
prefix
=
1
,
error_detail
=
False
):
self
.
threshold
=
threshold
...
...
@@ -151,8 +155,8 @@ class GenericSiteStats(object):
for
data
in
self
.
apdex
.
itervalues
():
apdex
.
accumulateFrom
(
data
)
return
[
(
date
,
apdex
.
getApdex
()
*
100
,
apdex
.
getAverage
()
/
US_PER_S
,
float
(
apdex
.
duration_max
)
/
US_PER_S
,
apdex
.
hit
)
for
date
,
apdex
(
date
,
apdex
.
getApdex
()
*
100
,
apdex
.
getAverage
(),
apdex
.
getMax
()
,
apdex
.
hit
)
for
date
,
apdex
in
sorted
(
self
.
apdex
.
iteritems
(),
key
=
ITEMGETTER0
)]
def
asHTML
(
self
,
stat_filter
=
lambda
x
:
x
):
...
...
@@ -166,8 +170,8 @@ class GenericSiteStats(object):
'<p>Avg duration (s): %.2f</p><p>Max duration (s): %.2f</p>'
%
(
apdex
.
hit
,
apdex
.
getApdex
()
*
100
,
apdex
.
getAverage
()
/
US_PER_S
,
float
(
apdex
.
duration_max
)
/
US_PER_S
,
apdex
.
getAverage
(),
apdex
.
getMax
()
,
))
column_set
=
set
()
filtered_status
=
defaultdict
(
partial
(
defaultdict
,
int
))
...
...
@@ -303,9 +307,9 @@ class ERP5SiteStats(GenericSiteStats):
apdex
*
100
,
data
.
hit
,
getClassForDuration
(
data
.
getAverage
(),
self
.
threshold
),
data
.
getAverage
()
/
US_PER_S
,
getClassForDuration
(
data
.
duration_max
,
self
.
threshold
),
float
(
data
.
duration_max
)
/
US_PER_S
,
data
.
getAverage
(),
getClassForDuration
(
data
.
getMax
()
,
self
.
threshold
),
data
.
getMax
()
,
)
def
apdexAsColumns
(
data_dict
):
data_total
=
APDEXStats
(
self
.
threshold
)
...
...
@@ -398,9 +402,9 @@ def main():
help
=
'Folder containing needed js files. Default: %(default)s'
)
group
=
parser
.
add_argument_group
(
'generated content'
)
group
.
add_argument
(
'-a'
,
'--apdex'
,
default
=
US_PER_S
,
type
=
in
t
,
help
=
'First threshold for Apdex computation, in
micro
seconds. '
'Default: %(default)
r
'
)
group
.
add_argument
(
'-a'
,
'--apdex'
,
default
=
1.0
,
type
=
floa
t
,
help
=
'First threshold for Apdex computation, in seconds. '
'Default: %(default)
.2fs
'
)
group
.
add_argument
(
'-e'
,
'--error-detail'
,
action
=
'store_true'
,
help
=
'Include detailed report (url & referers) for error statuses.'
)
group
.
add_argument
(
'-p'
,
'--period'
,
default
=
'day'
,
choices
=
period_parser
,
...
...
@@ -550,7 +554,7 @@ def main():
out
.
write
(
'</head><body><h1>Overall</h1><h2>Parameters</h2>'
'<table class="stats">'
)
for
caption
,
value
in
(
(
'Apdex threshold'
,
'%.2fs'
%
(
float
(
args
.
apdex
)
/
US_PER_S
)
),
(
'Apdex threshold'
,
'%.2fs'
%
args
.
apdex
),
(
'Period'
,
args
.
period
),
):
out
.
write
(
'<tr><th class="text">%s</th><td>%s</td></tr>'
%
(
...
...
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