ref: 8a4a2dea70aa77475a50968f4c5bd6cdab5d2fb1
parent: 87299152ec6af407392c9069107004c60953b696
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Apr 7 12:09:46 EDT 2024
kernel: remove some debugging cruft from taslock.c Only keep the data structures for LOCKCYCLES when LOCKCYCLES is actually defined (saves 2K in data segment). Remove unused dumplockmem() function.
--- a/sys/src/9/port/taslock.c
+++ b/sys/src/9/port/taslock.c
@@ -6,6 +6,7 @@
#include "../port/error.h"
#include "edf.h"
+#ifdef LOCKCYCLES
long maxlockcycles;
long maxilockcycles;
long cumlockcycles;
@@ -12,6 +13,8 @@
long cumilockcycles;
uintptr maxlockpc;
uintptr maxilockpc;
+uintptr ilockpcs[0x100] = { [0xff] = 1 };+#endif
struct
{@@ -20,19 +23,6 @@
ulong inglare;
} lockstats;
-static void
-dumplockmem(char *tag, Lock *l)
-{- uchar *cp;
- int i;
-
- iprint("%s: ", tag);- cp = (uchar*)l;
- for(i = 0; i < 64; i++)
- iprint("%2.2ux ", cp[i]);- iprint("\n");-}
-
void
lockloop(Lock *l, uintptr pc)
{@@ -213,9 +203,6 @@
sched();
}
-uintptr ilockpcs[0x100] = { [0xff] = 1 };-static int n;
-
void
iunlock(Lock *l)
{@@ -222,6 +209,7 @@
ulong sr;
#ifdef LOCKCYCLES
+ static uint n;
l->lockcycles += lcycles();
cumilockcycles += l->lockcycles;
if(l->lockcycles > maxilockcycles){@@ -229,7 +217,7 @@
maxilockpc = l->pc;
}
if(l->lockcycles > 2400)
- ilockpcs[n++ & 0xff] = l->pc;
+ ilockpcs[n++ % nelem(ilockpcs)] = l->pc;
#endif
if(l->key == 0)
print("iunlock(%#p): not locked: pc %#p\n", l, getcallerpc(&l));--
⑨