def main(argv): (opts, args) = get_option_parser().parse_args(argv) if len(args) != 1: print USAGE return 1 pipep = PipeParser(opts.pipe) pipep.start() g = Gnuplot.Gnuplot() g('set data style lines') g.title('FEC Buffer Usage') g.xlabel('Time (s)') g.ylabel('FEC Usage') ydata = [] while True: try: report = pipep.reports.get(False) except Queue.Empty: continue try: ydata.append(report['remote'][0]['fec_cur']) g.plot(list(enumerate(ydata))) except IndexError: continue pipep.reports.task_done() print "Exiting..." # g.reset() # g.close() # del g return 0
def main(argv): (opts, args) = get_option_parser().parse_args(argv) if len(args) != 1: print USAGE return 1 pipep = PipeParser(opts.pipe) pipep.start() while True: try: report = pipep.reports.get(True, 3) except Queue.Empty: continue try: print report['time'], report['remote'][0]['fec_cur'] except IndexError: pass pipep.reports.task_done()