Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -145,7 +145,10 @@ ...@@ -145,7 +145,10 @@
<cmdsynopsis> <cmdsynopsis>
<command>submit-job</command> <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> <arg choice="req" rep="repeat">opcodes_file</arg>
</cmdsynopsis> </cmdsynopsis>
...@@ -156,6 +159,24 @@ ...@@ -156,6 +159,24 @@
command line. command line.
</para> </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> </refsect2>
</refsect1> </refsect1>
......
...@@ -71,14 +71,37 @@ def GenericOpCodes(opts, args): ...@@ -71,14 +71,37 @@ def GenericOpCodes(opts, args):
""" """
cl = cli.GetClient() cl = cli.GetClient()
jex = cli.JobExecutor(cl=cl) jex = cli.JobExecutor(cl=cl, verbose=opts.verbose)
for fname in args: job_cnt = 0
op_data = simplejson.loads(open(fname).read()) op_cnt = 0
op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data] if opts.timing_stats:
jex.QueueJob("file %s" % fname, *op_list) 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() 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 return 0
...@@ -143,6 +166,20 @@ commands = { ...@@ -143,6 +166,20 @@ commands = {
"[opts...] <duration>", "Executes a TestDelay OpCode"), "[opts...] <duration>", "Executes a TestDelay OpCode"),
'submit-job': (GenericOpCodes, ARGS_ATLEAST(1), 'submit-job': (GenericOpCodes, ARGS_ATLEAST(1),
[DEBUG_OPT, [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" "<op_list_file...>", "Submits jobs built from json files"
" containing a list of serialized opcodes"), " containing a list of serialized opcodes"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment