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
Jérome Perrin
apachedex
Commits
1b74aad6
Commit
1b74aad6
authored
Apr 03, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dates are not necessarily utc, apdex is not necessarily daily.
parent
8e1bd9f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
apachedex/__init__.py
apachedex/__init__.py
+13
-13
No files found.
apachedex/__init__.py
View file @
1b74aad6
...
@@ -128,12 +128,12 @@ class GenericSiteStats(object):
...
@@ -128,12 +128,12 @@ class GenericSiteStats(object):
self
.
prefix
=
prefix
self
.
prefix
=
prefix
self
.
status
=
defaultdict
(
partial
(
defaultdict
,
int
))
self
.
status
=
defaultdict
(
partial
(
defaultdict
,
int
))
self
.
slowest_list
=
[(
-
1
,
None
,
None
,
None
)]
self
.
slowest_list
=
[(
-
1
,
None
,
None
,
None
)]
self
.
daily_
apdex
=
defaultdict
(
partial
(
APDEXStats
,
threshold
))
self
.
apdex
=
defaultdict
(
partial
(
APDEXStats
,
threshold
))
def
accumulate
(
self
,
match
,
url_match
,
utc
date
):
def
accumulate
(
self
,
match
,
url_match
,
date
):
self
.
status
[
match
.
group
(
'status'
)][
utc
date
]
+=
1
self
.
status
[
match
.
group
(
'status'
)][
date
]
+=
1
duration
=
match
.
group
(
'duration'
)
duration
=
match
.
group
(
'duration'
)
self
.
daily_apdex
[
utc
date
].
accumulate
(
match
)
self
.
apdex
[
date
].
accumulate
(
match
)
if
duration
is
not
None
:
if
duration
is
not
None
:
duration
=
int
(
duration
)
duration
=
int
(
duration
)
if
url_match
is
None
:
if
url_match
is
None
:
...
@@ -154,19 +154,19 @@ class GenericSiteStats(object):
...
@@ -154,19 +154,19 @@ class GenericSiteStats(object):
def
getApdexData
(
self
):
def
getApdexData
(
self
):
apdex
=
APDEXStats
(
self
.
threshold
)
apdex
=
APDEXStats
(
self
.
threshold
)
for
data
in
self
.
daily_
apdex
.
itervalues
():
for
data
in
self
.
apdex
.
itervalues
():
apdex
.
accumulateFrom
(
data
)
apdex
.
accumulateFrom
(
data
)
return
[
return
[
(
date
,
apdex
.
getApdex
()
*
100
,
apdex
.
getAverage
()
/
US_PER_S
,
(
date
,
apdex
.
getApdex
()
*
100
,
apdex
.
getAverage
()
/
US_PER_S
,
float
(
apdex
.
duration_max
)
/
US_PER_S
,
apdex
.
hit
)
for
date
,
apdex
float
(
apdex
.
duration_max
)
/
US_PER_S
,
apdex
.
hit
)
for
date
,
apdex
in
sorted
(
self
.
daily_
apdex
.
iteritems
(),
key
=
ITEMGETTER0
)]
in
sorted
(
self
.
apdex
.
iteritems
(),
key
=
ITEMGETTER0
)]
def
asHTML
(
self
):
def
asHTML
(
self
):
self
.
_housekeeping
()
self
.
_housekeeping
()
result
=
[]
result
=
[]
append
=
result
.
append
append
=
result
.
append
apdex
=
APDEXStats
(
self
.
threshold
)
apdex
=
APDEXStats
(
self
.
threshold
)
for
data
in
self
.
daily_
apdex
.
itervalues
():
for
data
in
self
.
apdex
.
itervalues
():
apdex
.
accumulateFrom
(
data
)
apdex
.
accumulateFrom
(
data
)
append
(
'<h2>Overall</h2><p>Hits: %i</p><p>Apdex: %i%%</p>'
append
(
'<h2>Overall</h2><p>Hits: %i</p><p>Apdex: %i%%</p>'
'<p>Avg duration (s): %.2f</p><p>Max duration (s): %.2f</p>'
%
(
'<p>Avg duration (s): %.2f</p><p>Max duration (s): %.2f</p>'
%
(
...
@@ -225,14 +225,14 @@ class ERP5SiteStats(GenericSiteStats):
...
@@ -225,14 +225,14 @@ class ERP5SiteStats(GenericSiteStats):
self
.
module
=
defaultdict
(
partial
(
defaultdict
,
partial
(
self
.
module
=
defaultdict
(
partial
(
defaultdict
,
partial
(
defaultdict
,
partial
(
APDEXStats
,
threshold
))))
defaultdict
,
partial
(
APDEXStats
,
threshold
))))
def
accumulate
(
self
,
match
,
url_match
,
utc
date
):
def
accumulate
(
self
,
match
,
url_match
,
date
):
prefix
=
self
.
prefix
prefix
=
self
.
prefix
split
=
url_match
.
group
(
'url'
).
split
(
'?'
,
1
)[
0
].
split
(
'/'
)[
1
+
prefix
:]
split
=
url_match
.
group
(
'url'
).
split
(
'?'
,
1
)[
0
].
split
(
'/'
)[
1
+
prefix
:]
if
split
:
if
split
:
module
=
split
[
0
]
module
=
split
[
0
]
if
module
.
endswith
(
'_module'
):
if
module
.
endswith
(
'_module'
):
super
(
ERP5SiteStats
,
self
).
accumulate
(
match
,
url_match
,
utc
date
)
super
(
ERP5SiteStats
,
self
).
accumulate
(
match
,
url_match
,
date
)
self
.
module
[
module
][
utc
date
][
len
(
split
)
>
2
].
accumulate
(
match
)
self
.
module
[
module
][
date
][
len
(
split
)
>
2
].
accumulate
(
match
)
def
asHTML
(
self
):
def
asHTML
(
self
):
result
=
[]
result
=
[]
...
@@ -439,13 +439,13 @@ def main():
...
@@ -439,13 +439,13 @@ def main():
if
action
is
None
:
if
action
is
None
:
skipped_lines
+=
1
skipped_lines
+=
1
continue
continue
utc
date
=
asDate
(
match
.
group
(
'timestamp'
))
date
=
asDate
(
match
.
group
(
'timestamp'
))
hit_per_day
[
utc
date
]
+=
1
hit_per_day
[
date
]
+=
1
try
:
try
:
site_data
=
per_site
[
site
]
site_data
=
per_site
[
site
]
except
KeyError
:
except
KeyError
:
site_data
=
per_site
[
site
]
=
action
(
threshold
)
site_data
=
per_site
[
site
]
=
action
(
threshold
)
site_data
.
accumulate
(
match
,
url_match
,
utc
date
)
site_data
.
accumulate
(
match
,
url_match
,
date
)
all_lines
+=
lineno
all_lines
+=
lineno
end_parsing_time
=
time
.
time
()
end_parsing_time
=
time
.
time
()
os
.
chdir
(
args
.
out
)
os
.
chdir
(
args
.
out
)
...
...
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