shithub: 3dee

Download patch

ref: 3b4794b3730d33bedb08f2105b40e7ce23fb3aa7
parent: 209af11a2e6ad830a1645da31d9e668c02e57240
author: rodri <rgl@antares-labs.eu>
date: Sun Sep 1 10:54:56 EDT 2024

debug/plmon: fix a parsing error. take file as an argument.

--- a/debug/plmon.c
+++ b/debug/plmon.c
@@ -289,7 +289,7 @@
 	dy = (Dy(screen->r) - font->height)/sched.ntask;
 	for(i = 0; i < sched.ntask; i++){
 		yoff = i*dy+dy;
-		string(screen, addpt(screen->r.min, Pt(0,yoff)), pal[CMain], ZP, font, sched.tasks[i].name);
+		string(screen, addpt(screen->r.min, Pt(Graphoff/2,yoff)), pal[CMain], ZP, font, sched.tasks[i].name);
 		line(screen, addpt(screen->r.min, Pt(Graphoff/2,yoff+font->height)), addpt(screen->r.min, Pt(Graphoff,yoff+font->height)), 0, 0, 0, pal[CMain], ZP);
 
 		graphrf.p.y = yoff;
@@ -316,7 +316,7 @@
 void
 usage(void)
 {
-	fprint(2, "usage: %s\n", argv0);
+	fprint(2, "usage: %s [file]\n", argv0);
 	exits("usage");
 }
 
@@ -335,10 +335,10 @@
 	ARGBEGIN{
 	default: usage();
 	}ARGEND
-	if(argc != 0)
+	if(argc > 1)
 		usage();
 
-	bin = Bfdopen(0, OREAD);
+	bin = argc? Bopen(argv[0], OREAD): Bfdopen(0, OREAD);
 	if(bin == nil)
 		sysfatal("Bfdopen: %r");
 	while((line = Brdline(bin, '\n')) != nil){
@@ -346,8 +346,8 @@
 		nf = tokenize(line, f, 3);
 		if(nf != 3)
 			continue;
-		s.t0 = strtoul(f[1], nil, 10);
-		s.t1 = strtoul(f[2], nil, 10);
+		s.t0 = strtoull(f[1], nil, 10);
+		s.t1 = strtoull(f[2], nil, 10);
 		if(s.t0 >= s.t1)
 			continue;
 		addt(f[0], s);