Revision 9d95c3af

b/man/gnt-debug.sgml
145 145

  
146 146
      <cmdsynopsis>
147 147
        <command>submit-job</command>
148

  
148
        <arg choice="opt">--verbose</arg>
149
        <arg choice="opt">--timing-stats</arg>
150
        <arg choice="opt">--job-repeat <option>N</option></arg>
151
        <arg choice="opt">--op-repeat <option>N</option></arg>
149 152
        <arg choice="req" rep="repeat">opcodes_file</arg>
150 153
      </cmdsynopsis>
151 154

  
......
156 159
        command line.
157 160
      </para>
158 161

  
162
      <para>
163
        The <option>verbose</option> option will job the job IDs of
164
        the submitted jobs and the progress in waiting for the jobs;
165
        the <option>timing-stats</option> option will show some
166
        overall statistics with the number of total opcodes and jobs
167
        submitted, and time time for each stage (submit, exec, total).
168
      </para>
169

  
170
      <para>
171
        The <option>job-repeat</option> and <option>op-repeat</option>
172
        options allow to submit multiple copies of the passed
173
        arguments; the job repeat will cause N copies of each job
174
        (input file) to be submitted (equivalent to passing the
175
        arguments N times) while the op repeat will cause each job to
176
        contain multiple copies of the opcodes (equivalent to each
177
        file containing N copies of the opcodes).
178
      </para>
179

  
159 180
    </refsect2>
160 181

  
161 182
  </refsect1>
b/scripts/gnt-debug
71 71

  
72 72
  """
73 73
  cl = cli.GetClient()
74
  jex = cli.JobExecutor(cl=cl)
75

  
76
  for fname in args:
77
    op_data = simplejson.loads(open(fname).read())
78
    op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data]
79
    jex.QueueJob("file %s" % fname, *op_list)
80

  
74
  jex = cli.JobExecutor(cl=cl, verbose=opts.verbose)
75

  
76
  job_cnt = 0
77
  op_cnt = 0
78
  if opts.timing_stats:
79
    ToStdout("Loading...")
80
  for job_idx in range(opts.rep_job):
81
    for fname in args:
82
      op_data = simplejson.loads(open(fname).read())
83
      op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data]
84
      op_list = op_list * opts.rep_op
85
      jex.QueueJob("file %s/%d" % (fname, job_idx), *op_list)
86
      op_cnt += len(op_list)
87
      job_cnt += 1
88

  
89
  if opts.timing_stats:
90
    t1 = time.time()
91
    ToStdout("Submitting...")
92
  jex.SubmitPending()
93

  
94
  if opts.timing_stats:
95
    t2 = time.time()
96
    ToStdout("Executing...")
81 97
  jex.GetResults()
98
  if opts.timing_stats:
99
    t3 = time.time()
100
    ToStdout("C:op     %4d" % op_cnt)
101
    ToStdout("C:job    %4d" % job_cnt)
102
    ToStdout("T:submit %4.4f" % (t2-t1))
103
    ToStdout("T:exec   %4.4f" % (t3-t2))
104
    ToStdout("T:total  %4.4f" % (t3-t1))
82 105
  return 0
83 106

  
84 107

  
......
143 166
            "[opts...] <duration>", "Executes a TestDelay OpCode"),
144 167
  'submit-job': (GenericOpCodes, ARGS_ATLEAST(1),
145 168
                 [DEBUG_OPT,
169
                  make_option("--op-repeat", type="int", default="1",
170
                              dest="rep_op",
171
                              help="Repeat the opcode sequence this number"
172
                              " of times"),
173
                  make_option("--job-repeat", type="int", default="1",
174
                              dest="rep_job",
175
                              help="Repeat the job this number"
176
                              " of times"),
177
                  make_option("-v", "--verbose", default=False,
178
                              action="store_true",
179
                              help="Make the operation more verbose"),
180
                  make_option("--timing-stats", default=False,
181
                              action="store_true",
182
                              help="Show timing stats"),
146 183
                  ],
147 184
                 "<op_list_file...>", "Submits jobs built from json files"
148 185
                 " containing a list of serialized opcodes"),

Also available in: Unified diff