|
@@ -87,14 +87,14 @@ def parseData(fin):
|
|
|
result.pop()
|
|
result.pop()
|
|
|
return settings, result, cores
|
|
return settings, result, cores
|
|
|
|
|
|
|
|
-def dataGantt(data, cores):
|
|
|
|
|
|
|
+def dataGantt(data):
|
|
|
g = dict()
|
|
g = dict()
|
|
|
for cmd, tm, pid, core in data:
|
|
for cmd, tm, pid, core in data:
|
|
|
if pid not in g: g[pid] = []
|
|
if pid not in g: g[pid] = []
|
|
|
g[pid].append((tm,cmd,core))
|
|
g[pid].append((tm,cmd,core))
|
|
|
return g
|
|
return g
|
|
|
|
|
|
|
|
-def drawGantt(data, fout, rg=3, width=1024, height=600, fontpath=None, settings=None, caption=None):
|
|
|
|
|
|
|
+def drawGantt(data, fout, rg=3, width=1024, height=600, fontpath=None, ncores=None, settings=None, caption=None):
|
|
|
|
|
|
|
|
if fontpath is None:
|
|
if fontpath is None:
|
|
|
fontpath = findfont()
|
|
fontpath = findfont()
|
|
@@ -256,7 +256,9 @@ def drawGantt(data, fout, rg=3, width=1024, height=600, fontpath=None, settings=
|
|
|
if unloadedx <> -1:
|
|
if unloadedx <> -1:
|
|
|
if pids[i] >= 0:
|
|
if pids[i] >= 0:
|
|
|
dist = (x-unloadedx)/2
|
|
dist = (x-unloadedx)/2
|
|
|
- draw.text((unloadedx + dist -2, by-16), str(loadedj), font=font, fill=COLOR_BLACK)
|
|
|
|
|
|
|
+ if ncores is not None and ncores>1:
|
|
|
|
|
+ draw.text((unloadedx + dist -3, by-16), str(loadedj), font=font, fill=COLOR_BLACK)
|
|
|
|
|
+ draw.text((unloadedx + dist -2, by-16), str(loadedj), font=font, fill=COLOR_BLACK) # 'bold'
|
|
|
unloadedx = -1
|
|
unloadedx = -1
|
|
|
|
|
|
|
|
if st == RUNNING and j>0 and sts[j-1] == RUNNINGBLOCKED:
|
|
if st == RUNNING and j>0 and sts[j-1] == RUNNINGBLOCKED:
|
|
@@ -297,10 +299,8 @@ def main(argv):
|
|
|
fout = argv[1]+'.png'
|
|
fout = argv[1]+'.png'
|
|
|
|
|
|
|
|
settings, data, cores = parseData(fin)
|
|
settings, data, cores = parseData(fin)
|
|
|
- #print data
|
|
|
|
|
- gantt = dataGantt(data, cores)
|
|
|
|
|
- #for x in gantt: print gantt[x]
|
|
|
|
|
- drawGantt(gantt, fout, settings=settings, caption=caption)
|
|
|
|
|
|
|
+ gantt = dataGantt(data)
|
|
|
|
|
+ drawGantt(gantt, fout, ncores=cores, settings=settings, caption=caption)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
main(sys.argv)
|
|
main(sys.argv)
|