Exemplo n.º 1
0
def log(location, stats, file=None):
    "Write a standard llmetrics log"
    metrics = {'location': location, 'stats': stats}
    if file is None:
        # do this check here in case sys.stdout changes at some
        # point. as a default parameter, it will never be
        # re-evaluated.
        file = sys.stdout
    print >> file, "LLMETRICS:", llsd.format_notation(metrics)
Exemplo n.º 2
0
def log(location, stats, file=None):
    "Write a standard llmetrics log"
    metrics = {'location':location, 'stats':stats}
    if file is None:
        # do this check here in case sys.stdout changes at some
        # point. as a default parameter, it will never be
        # re-evaluated.
        file = sys.stdout
    print >>file, "LLMETRICS:", llsd.format_notation(metrics)
Exemplo n.º 3
0
def _log(header, table, data, dest):
    if dest is None:
        # do this check here in case sys.stdout changes at some
        # point. as a default parameter, it will never be
        # re-evaluated.
        dest = sys.stdout
    global _sequence_id
    print >>dest, header, "(" + str(_sequence_id) + ")",
    print >>dest, table, llsd.format_notation(data)
    _sequence_id += 1
Exemplo n.º 4
0
    def done(self):
        global gBlockMap

        if not self.get():
            return

        output_name = "/dev/shm/simperf/%s_proc.%d.llsd" % (self.process_name, os.getpid())
        output_file = open(output_name, 'w')
        process_info = {
            "name"  :   self.process_name,
            "pid"   :   os.getpid(),
            "ppid"  :   os.getppid(),
            "timestamp" :   self.mTimeStamp,
            "utc_time"  :   self.mUTCTime,
            }
        output_file.write(llsd.format_notation(process_info))
        output_file.write('\n')

        for key in gBlockMap.keys():
            gBlockMap[key] = gBlockMap[key].get_map()
        output_file.write(llsd.format_notation(gBlockMap))
        output_file.write('\n')
        output_file.close()
Exemplo n.º 5
0
    def done(self):
        global gBlockMap

        if not self.get():
            return

        output_name = "/dev/shm/simperf/%s_proc.%d.llsd" % (self.process_name,
                                                            os.getpid())
        output_file = open(output_name, 'w')
        process_info = {
            "name": self.process_name,
            "pid": os.getpid(),
            "ppid": os.getppid(),
            "timestamp": self.mTimeStamp,
            "utc_time": self.mUTCTime,
        }
        output_file.write(llsd.format_notation(process_info))
        output_file.write('\n')

        for key in gBlockMap.keys():
            gBlockMap[key] = gBlockMap[key].get_map()
        output_file.write(llsd.format_notation(gBlockMap))
        output_file.write('\n')
        output_file.close()
Exemplo n.º 6
0
 def log(self, msg, llsd):
     payload = 'LLLOGMESSAGE (%d) %s %s' % (self.next(), msg,
                                            format_notation(llsd))
     syslog.syslog(payload)
Exemplo n.º 7
0
def _log(header, table, data):
    log_line = "%s (%d) %s %s" \
               % (header, _next_id(), table, format_notation(data))
    dest = _dest()
    dest.write(log_line)
    dest.flush()
Exemplo n.º 8
0
 def log(self, msg, llsd):
     payload = 'INFO: log: LLLOGMESSAGE (%d) %s %s' % (self.next(), msg,
                                            format_notation(llsd))
     syslog.syslog(payload)