Commit fa46d997 authored by Vincent Pelletier's avatar Vincent Pelletier

Add state loading stats.

parent 46535e9f
...@@ -942,7 +942,7 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict, ...@@ -942,7 +942,7 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
out.write('<h1>Parsing stats</h1><table class="stats">') out.write('<h1>Parsing stats</h1><table class="stats">')
buildno, builddate = platform.python_build() buildno, builddate = platform.python_build()
end_parsing_time = stats['end_parsing_time'] end_parsing_time = stats['end_parsing_time']
parsing_time = end_parsing_time - stats['start_time'] parsing_time = end_parsing_time - stats['parsing_start_time']
all_lines = stats['all_lines'] all_lines = stats['all_lines']
for caption, value in ( for caption, value in (
('Execution date', datetime.now().isoformat()), ('Execution date', datetime.now().isoformat()),
...@@ -952,6 +952,9 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict, ...@@ -952,6 +952,9 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
buildno, buildno,
builddate, builddate,
)), )),
('State file count', stats['state_file_count']),
('State loading time', timedelta(seconds=stats['parsing_start_time']
- stats['loading_start_time'])),
('File count', stats['file_count']), ('File count', stats['file_count']),
('Lines', all_lines), ('Lines', all_lines),
('... malformed', stats['malformed_lines']), ('... malformed', stats['malformed_lines']),
...@@ -1149,6 +1152,7 @@ def main(): ...@@ -1149,6 +1152,7 @@ def main():
if '-' in args.state_file and '-' in infile_list: if '-' in args.state_file and '-' in infile_list:
print >> sys.stderr, 'stdin cannot be used both as log and state input.' print >> sys.stderr, 'stdin cannot be used both as log and state input.'
sys.exit(1) sys.exit(1)
loading_start_time = time.time()
for state_file_name in args.state_file: for state_file_name in args.state_file:
print >> sys.stderr, 'Loading', state_file_name, '...', print >> sys.stderr, 'Loading', state_file_name, '...',
if state_file_name == '-': if state_file_name == '-':
...@@ -1187,7 +1191,7 @@ def main(): ...@@ -1187,7 +1191,7 @@ def main():
all_lines = 0 all_lines = 0
skipped_user_agent = 0 skipped_user_agent = 0
show_progress = not args.extra_quiet show_progress = not args.extra_quiet
start_time = time.time() parsing_start_time = time.time()
for fileno, filename in enumerate(infile_list, 1): for fileno, filename in enumerate(infile_list, 1):
if show_progress: if show_progress:
print >> sys.stderr, 'Processing %s [%i/%i]' % ( print >> sys.stderr, 'Processing %s [%i/%i]' % (
...@@ -1295,7 +1299,9 @@ def main(): ...@@ -1295,7 +1299,9 @@ def main():
'graph_period': graph_period, 'graph_period': graph_period,
'graph_coefficient': graph_coefficient, 'graph_coefficient': graph_coefficient,
}, { }, {
'start_time': start_time, 'state_file_count': len(args.state_file),
'loading_start_time': loading_start_time,
'parsing_start_time': parsing_start_time,
'end_parsing_time': end_parsing_time, 'end_parsing_time': end_parsing_time,
'file_count': file_count, 'file_count': file_count,
'all_lines': all_lines, 'all_lines': all_lines,
......
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