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
Arnaud Fontaine
apachedex
Commits
598cea75
Commit
598cea75
authored
Apr 03, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Word wrap.
parent
580a24eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
apachedex/__init__.py
apachedex/__init__.py
+14
-4
No files found.
apachedex/__init__.py
View file @
598cea75
...
@@ -189,7 +189,8 @@ class GenericSiteStats(object):
...
@@ -189,7 +189,8 @@ class GenericSiteStats(object):
append
(
'</tr>'
)
append
(
'</tr>'
)
def
hitTd
(
hit
,
status
):
def
hitTd
(
hit
,
status
):
return
'<td class="%s">%s</td>'
%
(
getClassForStatusHit
(
hit
,
status
),
hit
)
return
'<td class="%s">%s</td>'
%
(
getClassForStatusHit
(
hit
,
status
),
hit
)
for
status
,
data_dict
in
sorted
(
filtered_status
.
iteritems
(),
key
=
ITEMGETTER0
):
for
status
,
data_dict
in
sorted
(
filtered_status
.
iteritems
(),
key
=
ITEMGETTER0
):
append
(
'<tr><td>%s</td>'
%
status
)
append
(
'<tr><td>%s</td>'
%
status
)
append
(
hitTd
(
sum
(
data_dict
.
itervalues
()),
status
))
append
(
hitTd
(
sum
(
data_dict
.
itervalues
()),
status
))
for
date
in
column_list
:
for
date
in
column_list
:
...
@@ -200,7 +201,8 @@ class GenericSiteStats(object):
...
@@ -200,7 +201,8 @@ class GenericSiteStats(object):
for
duration
,
timestamp
,
url
,
referer
in
reversed
(
self
.
slowest_list
):
for
duration
,
timestamp
,
url
,
referer
in
reversed
(
self
.
slowest_list
):
if
timestamp
is
None
:
if
timestamp
is
None
:
continue
continue
append
(
'<tr><td class="%s">%.2f</td><td>%s</td><td class="text">%s</td><td class="text">%s</td></tr>'
%
(
append
(
'<tr><td class="%s">%.2f</td><td>%s</td>'
'<td class="text">%s</td><td class="text">%s</td></tr>'
%
(
getClassForDuration
(
duration
,
self
.
threshold
),
getClassForDuration
(
duration
,
self
.
threshold
),
float
(
duration
)
/
US_PER_S
,
float
(
duration
)
/
US_PER_S
,
escape
(
timestamp
),
escape
(
timestamp
),
...
@@ -267,7 +269,8 @@ class ERP5SiteStats(GenericSiteStats):
...
@@ -267,7 +269,8 @@ class ERP5SiteStats(GenericSiteStats):
'<th>max (s)</th>'
)
'<th>max (s)</th>'
)
append
(
'</tr>'
)
append
(
'</tr>'
)
def
apdexStatsAsHtml
(
data
):
def
apdexStatsAsHtml
(
data
):
return
'<td>%i%%</td><td>%s</td><td class="%s">%.2f</td><td class="%s">%.2f</td>'
%
(
return
'<td>%i%%</td><td>%s</td><td class="%s">%.2f</td>'
\
'<td class="%s">%.2f</td>'
%
(
data
.
getApdex
()
*
100
,
data
.
getApdex
()
*
100
,
data
.
hit
,
data
.
hit
,
getClassForDuration
(
data
.
getAverage
(),
self
.
threshold
),
getClassForDuration
(
data
.
getAverage
(),
self
.
threshold
),
...
@@ -472,7 +475,14 @@ def main():
...
@@ -472,7 +475,14 @@ def main():
end_parsing_time
=
time
.
time
()
end_parsing_time
=
time
.
time
()
os
.
chdir
(
args
.
out
)
os
.
chdir
(
args
.
out
)
with
open
(
'index.html'
,
'w'
)
as
out
:
with
open
(
'index.html'
,
'w'
)
as
out
:
out
.
write
(
'<html><head><title>Stats</title><style>th, td { border: solid 1px #000; } th { text-align: center; } td { text-align: right; } th.text, td.text { text-align: left; } table { border-collapse: collapse; } .problem { background-color: #f00; color: white; } .warning { background-color: #f80; color: white; } </style></head><body><h1>Overall</h1><h2>Hits per day</h2><table><tr><th>date</th><th>hits</th></tr>'
)
out
.
write
(
'<html><head><title>Stats</title><style>'
'th, td { border: solid 1px #000; } th { text-align: center; } '
'td { text-align: right; } th.text, td.text { text-align: left; } '
'table { border-collapse: collapse; } '
'.problem { background-color: #f00; color: white; } '
'.warning { background-color: #f80; color: white; }'
'</style></head><body><h1>Overall</h1>'
'<h2>Hits per day</h2><table><tr><th>date</th><th>hits</th></tr>'
)
for
date
,
hit
in
sorted
(
hit_per_day
.
iteritems
(),
key
=
ITEMGETTER0
):
for
date
,
hit
in
sorted
(
hit_per_day
.
iteritems
(),
key
=
ITEMGETTER0
):
out
.
write
(
'<tr><td>%s</td><td>%s</td></tr>'
%
(
date
,
hit
))
out
.
write
(
'<tr><td>%s</td><td>%s</td></tr>'
%
(
date
,
hit
))
out
.
write
(
'</table>'
)
out
.
write
(
'</table>'
)
...
...
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