Deleted Added
full compact
27c27
< # $FreeBSD: head/tools/sched/schedgraph.py 166203 2007-01-23 22:19:27Z jeff $
---
> # $FreeBSD: head/tools/sched/schedgraph.py 166209 2007-01-24 21:19:56Z jeff $
67c67,68
< from_=1000, to_=1000000, orient=HORIZONTAL, resolution=1000)
---
> from_=1000, to_=10000000, orient=HORIZONTAL,
> resolution=1000)
412a414,418
> if (self.duration < 0):
> self.duration = 0
> print "Unsynchronized timestamp"
> print self.cpu, self.timestamp
> print next.cpu, next.timestamp
816,817c822,826
< self.timestamp_first = None
< self.timestamp_last = None
---
> self.timestamp_first = {}
> self.timestamp_last = {}
> self.timestamp_adjust = {}
> self.timestamp_f = None
> self.timestamp_l = None
823a833
> self.stathz = 0
828,829c838,839
< ticksps = self.ticksps()
< print "Ticks per second", ticksps, "timespan", self.timespan()
---
> print "first", self.timestamp_f, "last", self.timestamp_l
> print "time span", self.timespan()
831c841,842
< print "first", self.timestamp_first, "last", self.timestamp_last
---
> ticksps = self.ticksps()
> print "Ticks per second", ticksps
898c909,911
< for line in ifp.readlines():
---
> lines = ifp.readlines()
> self.synchstamp(lines)
> for line in lines:
911c924,950
< def checkstamp(self, timestamp):
---
> def synchstamp(self, lines):
> status.startup("Rationalizing Timestamps")
> tstamp_re = re.compile("\s+\d+\s+(\d+)\s+(\d+)\s+.*")
> for line in lines:
> m = tstamp_re.match(line)
> if (m != None):
> self.addstamp(*m.groups())
> self.pickstamp()
> self.monostamp(lines)
>
>
> def monostamp(self, lines):
> laststamp = None
> tstamp_re = re.compile("\s+\d+\s+(\d+)\s+(\d+)\s+.*")
> for line in lines:
> m = tstamp_re.match(line)
> if (m == None):
> continue
> (cpu, timestamp) = m.groups()
> timestamp = int(timestamp)
> cpu = int(cpu)
> timestamp -= self.timestamp_adjust[cpu]
> if (laststamp != None and timestamp > laststamp):
> self.timestamp_adjust[cpu] += timestamp - laststamp
> laststamp = timestamp
>
> def addstamp(self, cpu, timestamp):
913,915c952,987
< if (self.timestamp_first == None):
< self.timestamp_first = timestamp
< if (timestamp > self.timestamp_first):
---
> cpu = int(cpu)
> try:
> if (timestamp > self.timestamp_first[cpu]):
> return
> except:
> self.timestamp_first[cpu] = timestamp
> self.timestamp_last[cpu] = timestamp
>
> def pickstamp(self):
> base = self.timestamp_last[0]
> for i in range(0, len(self.timestamp_last)):
> if (self.timestamp_last[i] < base):
> base = self.timestamp_last[i]
>
> print "Adjusting to base stamp", base
> for i in range(0, len(self.timestamp_last)):
> self.timestamp_adjust[i] = self.timestamp_last[i] - base;
> print "CPU ", i, "adjust by ", self.timestamp_adjust[i]
>
> self.timestamp_f = 0
> for i in range(0, len(self.timestamp_first)):
> first = self.timestamp_first[i] - self.timestamp_adjust[i]
> if (first > self.timestamp_f):
> self.timestamp_f = first
>
> self.timestamp_l = 0
> for i in range(0, len(self.timestamp_last)):
> last = self.timestamp_last[i] - self.timestamp_adjust[i]
> if (last > self.timestamp_l):
> self.timestamp_l = last
>
>
> def checkstamp(self, cpu, timestamp):
> cpu = int(cpu)
> timestamp = int(timestamp)
> if (timestamp > self.timestamp_first[cpu]):
918,919c990,991
< self.timestamp_last = timestamp
< return (1)
---
> timestamp -= self.timestamp_adjust[cpu]
> return (timestamp)
922c994
< return (self.timestamp_first - self.timestamp_last);
---
> return (self.timestamp_f - self.timestamp_l);
934c1006,1007
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
955c1028,1029
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
961c1035,1036
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
968c1043,1044
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
974c1050,1051
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
982c1059,1060
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
989c1067,1068
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
995c1074,1075
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
1010c1090,1091
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
1018c1099,1100
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
1030c1112,1113
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
1042c1125,1126
< if (self.checkstamp(timestamp) == 0):
---
> timestamp = self.checkstamp(cpu, timestamp)
> if (timestamp == 0):
1064,1065c1148,1149
< Padevent(source, -1, self.timestamp_last)
< Padevent(source, -1, self.timestamp_first, last=1)
---
> Padevent(source, -1, self.timestamp_l)
> Padevent(source, -1, self.timestamp_f, last=1)