summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-04-05 15:00:57 +0000
committerrodri <rgl@antares-labs.eu>2024-04-05 15:00:57 +0000
commit53dcc34e34cca4453017bae72c0944f2fe1c93fb (patch)
treed1e3f52641eff0f1a831dec933d64bc20dc90c4c
parent8551f75ceaafd6678d8e489abfa82f5b414ef42a (diff)
downloadrenderfs-53dcc34e34cca4453017bae72c0944f2fe1c93fb.tar.gz
renderfs-53dcc34e34cca4453017bae72c0944f2fe1c93fb.tar.bz2
renderfs-53dcc34e34cca4453017bae72c0944f2fe1c93fb.zip
add profile flag.
-rw-r--r--fs.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/fs.c b/fs.c
index df4de3f..011baf2 100644
--- a/fs.c
+++ b/fs.c
@@ -77,8 +77,9 @@ Memsubfont *memfont;
Renderer *renderer;
Client *clients;
ulong nclients;
+int doprof;
-static LightSource light = {{0,100,100,1}, {1,1,1,1}, LIGHT_POINT};
+LightSource light = {{0,100,100,1}, {1,1,1,1}, LIGHT_POINT};
static Client *getclient(ulong);
@@ -644,10 +645,27 @@ Srv fs = {
.end = fsending,
};
+static void
+confproc(void)
+{
+ char buf[64];
+ int fd;
+
+ snprint(buf, sizeof buf, "/proc/%d/ctl", getpid());
+ fd = open(buf, OWRITE);
+ if(fd < 0)
+ sysfatal("open: %r");
+
+ if(doprof)
+ fprint(fd, "profile\n");
+
+ close(fd);
+}
+
void
usage(void)
{
- fprint(2, "usage: %s [-D] [-s srvname] [-m mtpt]\n", argv0);
+ fprint(2, "usage: %s [-Dp] [-s srvname] [-m mtpt]\n", argv0);
exits("usage");
}
@@ -663,6 +681,9 @@ threadmain(int argc, char *argv[])
case 'D':
chatty9p++;
break;
+ case 'p':
+ doprof++;
+ break;
case 's':
srvname = EARGF(usage());
break;
@@ -674,6 +695,7 @@ threadmain(int argc, char *argv[])
if(argc != 0)
usage();
+ confproc();
jefe = getuser();
if(memimageinit() != 0)