Ver código fonte

core num mas visible, no se ve si solo hay 1 core

David 10 anos atrás
pai
commit
284f26a889
1 arquivos alterados com 7 adições e 7 exclusões
  1. 7 7
      graphsched.py

+ 7 - 7
graphsched.py

@@ -87,14 +87,14 @@ def parseData(fin):
 	result.pop()
 	return settings, result, cores
 
-def dataGantt(data, cores):
+def dataGantt(data):
 	g = dict()
 	for cmd, tm, pid, core in data:
 		if pid not in g: g[pid] = []
 		g[pid].append((tm,cmd,core))
 	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:
 		fontpath = findfont()
@@ -256,7 +256,9 @@ def drawGantt(data, fout, rg=3, width=1024, height=600, fontpath=None, settings=
 					if unloadedx <> -1:
 						if pids[i] >= 0:
 							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
 
 				if st == RUNNING and j>0 and sts[j-1] == RUNNINGBLOCKED:
@@ -297,10 +299,8 @@ def main(argv):
 		fout = argv[1]+'.png'
 
 	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__":
 	main(sys.argv)