Esempio n. 1
0
            colon = cmd.find(":")
            cname = cmd[(colon + 2) :]
            lnum = int(cmd[4 : (colon - 1)])
            # print "cname=",cname
            year = time.strftime("%Y")  # Use current year since log doesn't contain year
            tdata = time.strptime(year + " " + gtime, "%Y %H:%M:%S")
            t = time.mktime(tdata)
            if lastgeminicmd != None:
                if t - lasttime > 30:
                    print "Skipping long pause of %d seconds for %s" % (t - lasttime, lastgeminicmd)
                elif t < lasttime:
                    print "Skipping negative elapsed time of %d seconds for %s" % (t - lasttime, lastgeminicmd)
                elif lastgeminicmd in geminicmdtimes.keys():
                    geminicmdtimes[lastgeminicmd] += t - lasttime
                    geminicmdcnt[lastgeminicmd] += 1
                else:
                    geminicmdtimes[lastgeminicmd] = t - lasttime
                    geminicmdcnt[lastgeminicmd] = 1
            lastgeminicmd = cname
            lasttime = t
# print "log=",dl
dl.printallsamples()

for cmd in geminicmdtimes.keys():
    print "%s: %.0f seconds for %.0f occurrences:   %.2f second/call" % (
        cmd,
        geminicmdtimes[cmd],
        geminicmdcnt[cmd],
        geminicmdtimes[cmd] * 1.0 / geminicmdcnt[cmd],
    )
Esempio n. 2
0
            colon = cmd.find(':')
            cname = cmd[(colon + 2):]
            lnum = int(cmd[4:(colon - 1)])
            #print "cname=",cname
            year = time.strftime(
                "%Y")  # Use current year since log doesn't contain year
            tdata = time.strptime(year + " " + gtime, "%Y %H:%M:%S")
            t = time.mktime(tdata)
            if lastgeminicmd != None:
                if t - lasttime > 30:
                    print "Skipping long pause of %d seconds for %s" % (
                        t - lasttime, lastgeminicmd)
                elif t < lasttime:
                    print "Skipping negative elapsed time of %d seconds for %s" % (
                        t - lasttime, lastgeminicmd)
                elif lastgeminicmd in geminicmdtimes.keys():
                    geminicmdtimes[lastgeminicmd] += (t - lasttime)
                    geminicmdcnt[lastgeminicmd] += 1
                else:
                    geminicmdtimes[lastgeminicmd] = (t - lasttime)
                    geminicmdcnt[lastgeminicmd] = 1
            lastgeminicmd = cname
            lasttime = t
#print "log=",dl
dl.printallsamples()

for cmd in geminicmdtimes.keys():
    print "%s: %.0f seconds for %.0f occurrences:   %.2f second/call" % (
        cmd, geminicmdtimes[cmd], geminicmdcnt[cmd],
        geminicmdtimes[cmd] * 1.0 / geminicmdcnt[cmd])