Skip to content
Snippets Groups Projects
Commit a0025e68 authored by Christian Eichler's avatar Christian Eichler
Browse files

bench_input_energy: Improve error handling

parent ee212333
No related branches found
No related tags found
No related merge requests found
......@@ -162,13 +162,10 @@ def gdb_measure(gdb, inp):
return cycles
def analyze_thread(odir, pipe, Rshunt):
hdf = h5py.File('{}/measurement.hdf5'.format(odir), 'w')
def analyze_thread(odir, pipe, hdf, Rshunt):
while True:
measurement = pipe.recv()
if measurement is None:
hdf.close()
break
inp, cycles, data_per_channel = measurement
......@@ -210,15 +207,19 @@ def run(args):
rm, devs = MSO.find_devices()
mso = MSO.MSO(rm, devs[0])
gdb = gdb_start("/home/chris/i4/palladium/results/bench_input_xmc4500.plain_budget50000_seed1431655765_bits32_samples10000_opt0_ofactor25_rev64c4010eb2f644dc0ea4e551f99de7184b1b5703+_suitedevice/bench.axf", ":2331")
# TODO
gdb = gdb_start("/home/chris/i4/palladium/results/bench_input_xmc4500.plain_budget20000_seed1431655765_bits32_samples10000_opt0_ofactor25_revff42678d10acef590c184a5fa68c5b9b4ded0e63+_suitedevice/bench.axf", ":2331")
inputs = Benchmark.get_input(args.bits, args.seed, args.samples - 1, 1, crafted = False)[0]
hdf = h5py.File('{}/measurement.hdf5'.format(odir), 'w')
hdf.attrs["rshunt_ohm"] = args.sr
# start analysis process
pipe_parent, pipe_child = Pipe()
p = Process(target=analyze_thread, args=(odir, pipe_child, args.sr))
p = Process(target=analyze_thread, args=(odir, pipe_child, hdf, args.sr))
p.start()
try:
for i, inp in enumerate(inputs):
Log.info("({}/{}) Starting measurement for input {}".format(i, len(inputs), inp))
mso.start()
......@@ -230,9 +231,12 @@ def run(args):
data_per_channel = mso.get_values()
pipe_parent.send( (inp, cycles, data_per_channel) )
except Exception as e:
Log.fail("Caught exception during sampling:\n{}".format(e))
pipe_parent.send(None)
p.join()
hdf.close()
desc = "Determine energy consumption via shunt-based measurement"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment