#!/bin/env python # Dump monitor records # (C) 2005 - Kael Hanson / IceCube (kael.hanson@icecube.wisc.edu) import sys from struct import unpack from icecube.domtest.monitoring import * fout = dict() for inputfilename in sys.argv[1:]: fm = file(inputfilename, 'rb') while 1: hdr = fm.read(32) if len(hdr) < 32: break (recl, fmt, domid, utc) = unpack('>iiq8xq', hdr) domid = "%12.12x" % domid utctime = utc #print "HEADER:", recl, fmt, domid, utc buf = fm.read(recl-32) m = MonitorRecordFactory(buf, domid, utc) if isinstance(m, HardwareMonitorRecord): if m.domid not in fout: fout[m.domid] = file(m.domid + ".moni", "a") # txt = "%011.1f %d" % (1113800000+ (m.domClock * 25e-9), m.getSPERate()) txt = "%011.1f %d" % (1104537600 + (utctime * 50e-9/500), m.getSPERate()) # txt = "%011.1f %d" % (1167670800 + (utctime * 50e-9/500), m.getSPERate()) # # we should subtract 24 hours (86400 sec) if the gps fix has not been done # # # Normally this would be done only once every 10 s txt += (" %.1f %d %d" % ( m.getTemperature(), m.getPressure(), m.getHVMonitor()*2. ) ) fout[m.domid] = open(m.domid + ".moni", "a") if (utctime > 1): print >> fout[m.domid], txt fout[m.domid].close()