From: Adam Crume Date: Mon, 21 Jul 2014 21:40:29 +0000 (-0700) Subject: rbd-replay: Add command-line arguments to prep-for-replay.py X-Git-Tag: v0.86~231^2~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0421b692786334c07050dc81431d542c21cf716a;p=ceph.git rbd-replay: Add command-line arguments to prep-for-replay.py Includes: --print-on-read --print-on-write --window Signed-off-by: Adam Crume --- diff --git a/src/rbd_replay/prep-for-replay.py b/src/rbd_replay/prep-for-replay.py index c8a5557eee38..e9a06500e76f 100755 --- a/src/rbd_replay/prep-for-replay.py +++ b/src/rbd_replay/prep-for-replay.py @@ -13,6 +13,7 @@ # # +import argparse from babeltrace import * import datetime import struct @@ -288,14 +289,22 @@ class Processor(object): def completed(self, io): self.recentCompletions.append(io) self.recentCompletions[:] = [x for x in self.recentCompletions if x.start_time > io.start_time - self.window] - def run(self, args): - inputFileName = args[0] - outputFileName = args[1] + def run(self, raw_args): + parser = argparse.ArgumentParser(description='convert librbd trace output to an rbd-replay input file.') + parser.add_argument('--print-on-read', action="store_true", help='print events as they are read in (for debugging)') + parser.add_argument('--print-on-write', action="store_true", help='print events as they are written out (for debugging)') + parser.add_argument('--window', default=1, type=float, help='size of the window, in seconds. Larger values slow down processing, and smaller values may miss dependencies. Default: 1') + parser.add_argument('input', help='trace to read') + parser.add_argument('output', help='replay file to write') + args = parser.parse_args(raw_args) + self.window = 1e9 * args.window + inputFileName = args.input + outputFileName = args.output ios = [] pendingIOs = {} limit = 100000000000 - printOnRead = False - printOnWrite = False + printOnRead = args.print_on_read + printOnWrite = args.print_on_write threads = {} traces = TraceCollection() traces.add_trace(inputFileName, "ctf")