Commit 598cea75 authored by Vincent Pelletier's avatar Vincent Pelletier

Word wrap.

parent 580a24eb
...@@ -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>')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment