Commit 0025fef3 authored by Philipp Winter's avatar Philipp Winter Committed by Karsten Loesing
Browse files

Add --date-prefix command line switch.

The switch tells OnionPerf to prepend yesterday's date to the analysis
output file.  This new switch is mutually exclusive with --date-filter.

This fixes <>.
parent 7b5e65dc
......@@ -96,12 +96,15 @@ class Analysis(object):
self.json_db['data'][nickname] = analysis.json_db['data'][nickname]
def save(self, filename=None, output_prefix=os.getcwd(), do_compress=True):
def save(self, filename=None, output_prefix=os.getcwd(), do_compress=True, date_prefix=None):
if filename is None:
if self.date_filter is None:
filename = "onionperf.analysis.json.xz"
base_filename = "onionperf.analysis.json.xz"
if date_prefix is not None:
filename = "{0}.{1}".format(util.date_to_string(date_prefix), base_filename)
elif self.date_filter is not None:
filename = "{0}.{1}".format(util.date_to_string(self.date_filter), base_filename)
filename = "{}.onionperf.analysis.json.xz".format(util.date_to_string(self.date_filter))
filename = base_filename
filepath = os.path.abspath(os.path.expanduser("{0}/{1}".format(output_prefix, filename)))
if not os.path.exists(output_prefix):
......@@ -157,10 +157,10 @@ def logrotate_thread_task(writables, tgen_writable, torctl_writable, docroot, ni
# run the analysis, i.e. parse the files
# save the results in onionperf json format in the www docroot, do_compress=True), do_compress=True,
# update the xml index in docroot
......@@ -266,12 +266,19 @@ files generated by this script will be written""",
action="store", dest="nickname",
analyze_parser.add_argument('-d', '--date-filter',
date_group = analyze_parser.add_mutually_exclusive_group()
date_group.add_argument('-d', '--date-filter',
help="""a DATE string in the form YYYY-MM-DD, all log messages that did not occur on this date will be filtered out of the analysis""",
metavar="DATE", type=type_str_date_in,
action="store", dest="date_filter",
date_group.add_argument('-x', '--date-prefix',
help="""a DATE string in the form YYYY-MM-DD to add as prefix to the output file""",
metavar="DATE", type=type_str_date_in,
action="store", dest="date_prefix",
analyze_parser.add_argument('-s', '--do-simple-parse',
help="""parse and export only summary statistics rather than full transfer/circuit/stream data""",
action="store_true", dest="do_simple",
......@@ -381,7 +388,7 @@ def analyze(args):
if args.torctl_logpath is not None:
analysis.analyze(args.do_simple, date_filter=args.date_filter), date_prefix=args.date_prefix)
elif args.tgen_logpath is not None and os.path.isdir(args.tgen_logpath) and args.torctl_logpath is not None and os.path.isdir(args.torctl_logpath):
from onionperf import reprocessing
Supports Markdown
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