Commit 9d95c3af authored by Iustin Pop's avatar Iustin Pop
Browse files

Extend gnt-debug with more debugging options



This patch extends gnt-debug to be able to submit multiple copies of the
input jobs and job contents, in order to simplify testing. It also adds
a timing mode, and splits the execution into separate submit and
execution stages (for timing purposes).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent c118d1f4
......@@ -145,7 +145,10 @@
<cmdsynopsis>
<command>submit-job</command>
<arg choice="opt">--verbose</arg>
<arg choice="opt">--timing-stats</arg>
<arg choice="opt">--job-repeat <option>N</option></arg>
<arg choice="opt">--op-repeat <option>N</option></arg>
<arg choice="req" rep="repeat">opcodes_file</arg>
</cmdsynopsis>
......@@ -156,6 +159,24 @@
command line.
</para>
<para>
The <option>verbose</option> option will job the job IDs of
the submitted jobs and the progress in waiting for the jobs;
the <option>timing-stats</option> option will show some
overall statistics with the number of total opcodes and jobs
submitted, and time time for each stage (submit, exec, total).
</para>
<para>
The <option>job-repeat</option> and <option>op-repeat</option>
options allow to submit multiple copies of the passed
arguments; the job repeat will cause N copies of each job
(input file) to be submitted (equivalent to passing the
arguments N times) while the op repeat will cause each job to
contain multiple copies of the opcodes (equivalent to each
file containing N copies of the opcodes).
</para>
</refsect2>
</refsect1>
......
......@@ -71,14 +71,37 @@ def GenericOpCodes(opts, args):
"""
cl = cli.GetClient()
jex = cli.JobExecutor(cl=cl)
for fname in args:
op_data = simplejson.loads(open(fname).read())
op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data]
jex.QueueJob("file %s" % fname, *op_list)
jex = cli.JobExecutor(cl=cl, verbose=opts.verbose)
job_cnt = 0
op_cnt = 0
if opts.timing_stats:
ToStdout("Loading...")
for job_idx in range(opts.rep_job):
for fname in args:
op_data = simplejson.loads(open(fname).read())
op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data]
op_list = op_list * opts.rep_op
jex.QueueJob("file %s/%d" % (fname, job_idx), *op_list)
op_cnt += len(op_list)
job_cnt += 1
if opts.timing_stats:
t1 = time.time()
ToStdout("Submitting...")
jex.SubmitPending()
if opts.timing_stats:
t2 = time.time()
ToStdout("Executing...")
jex.GetResults()
if opts.timing_stats:
t3 = time.time()
ToStdout("C:op %4d" % op_cnt)
ToStdout("C:job %4d" % job_cnt)
ToStdout("T:submit %4.4f" % (t2-t1))
ToStdout("T:exec %4.4f" % (t3-t2))
ToStdout("T:total %4.4f" % (t3-t1))
return 0
......@@ -143,6 +166,20 @@ commands = {
"[opts...] <duration>", "Executes a TestDelay OpCode"),
'submit-job': (GenericOpCodes, ARGS_ATLEAST(1),
[DEBUG_OPT,
make_option("--op-repeat", type="int", default="1",
dest="rep_op",
help="Repeat the opcode sequence this number"
" of times"),
make_option("--job-repeat", type="int", default="1",
dest="rep_job",
help="Repeat the job this number"
" of times"),
make_option("-v", "--verbose", default=False,
action="store_true",
help="Make the operation more verbose"),
make_option("--timing-stats", default=False,
action="store_true",
help="Show timing stats"),
],
"<op_list_file...>", "Submits jobs built from json files"
" containing a list of serialized opcodes"),
......
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