ref: 7d13427ccf1f9bcf934a13d3bc9633c07f2ce6e3
parent: 6bc1ec47a08c6ca3ce656da5cc2a58e04b227696
author: Jacob Moody <moody@posixcafe.org>
date: Sat Nov 30 19:39:27 EST 2024
flambe: right click to plumb functions also display percentage of base on hover
--- a/sys/src/cmd/flambe.c
+++ b/sys/src/cmd/flambe.c
@@ -6,6 +6,7 @@
#include <keyboard.h>
#include <bio.h>
#include <mach.h>
+#include <plumb.h>
typedef struct Data Data;
@@ -100,6 +101,25 @@
return buf;
}
+static void
+plumbpc(ulong pc)
+{
+ Symbol s;
+ char buf[256], wd[256];
+ int fd;
+
+ if(!findsym(pc, CTEXT, &s))
+ return;
+
+ fileline(buf, sizeof buf, pc);
+ fd = plumbopen("send", OWRITE);
+ if(fd < 0)
+ return;
+ getwd(wd, sizeof wd);
+ plumbsendtext(fd, "flambe", "edit", wd, buf);
+ close(fd);
+}
+
int rowh;
Image **cols;
int ncols;
@@ -149,7 +169,7 @@
string(screen, r.min, display->black, ZP, font, name(data[i].pc));
r.min.y += font->height + 1;
- snprint(buf, sizeof buf, "Time: %.8f(s), Calls: %lud", (double)data[i].time/cyclefreq, data[i].count);
+ snprint(buf, sizeof buf, "Time: %.8f(s) %.2f%%, Calls: %lud", (double)data[i].time/cyclefreq, (double)data[i].time/total * 100, data[i].count);
string(screen, r.min, display->black, ZP, font, buf);
flushimage(display, 1);
}
@@ -272,7 +292,7 @@
}
break;
case Cmouse:
- if(m.buttons == 4 || m.buttons == 16){
+ if(m.buttons == 16){
redraw(1);
break;
}
@@ -285,6 +305,9 @@
break;
case 1: case 8:
redraw(i);
+ break;
+ case 4:
+ plumbpc(data[i].pc);
break;
}
break;
--
⑨