mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Add malloc logging tool
STATIC_YOINK("enable_memory_log");
This commit is contained in:
parent
7e9fb0a9f1
commit
cb67223051
25 changed files with 502 additions and 78 deletions
|
@ -357,12 +357,7 @@ int count;
|
|||
void *ptrs[N];
|
||||
|
||||
void BenchUnmap(void) {
|
||||
int i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
if (ptrs[i]) {
|
||||
ASSERT_EQ(0, munmap(ptrs[i], FRAMESIZE));
|
||||
}
|
||||
}
|
||||
ASSERT_EQ(0, munmap(ptrs[count++], FRAMESIZE));
|
||||
}
|
||||
|
||||
void BenchMmapPrivate(void) {
|
||||
|
@ -375,16 +370,11 @@ void BenchMmapPrivate(void) {
|
|||
|
||||
BENCH(mmap, bench) {
|
||||
EZBENCH2("mmap", donothing, BenchMmapPrivate());
|
||||
BenchUnmap();
|
||||
EZBENCH2("munmap", donothing, BenchUnmap());
|
||||
}
|
||||
|
||||
void BenchUnmapLinux(void) {
|
||||
int i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
if (ptrs[i]) {
|
||||
ASSERT_EQ(0, LinuxMunmap(ptrs[i], FRAMESIZE));
|
||||
}
|
||||
}
|
||||
ASSERT_EQ(0, LinuxMunmap(ptrs[count++], FRAMESIZE));
|
||||
}
|
||||
|
||||
void BenchMmapPrivateLinux(void) {
|
||||
|
@ -399,5 +389,5 @@ BENCH(mmap, benchLinux) {
|
|||
void *p;
|
||||
if (!IsLinux()) return;
|
||||
EZBENCH2("mmap (linux)", donothing, BenchMmapPrivateLinux());
|
||||
BenchUnmapLinux();
|
||||
EZBENCH2("munmap (linux)", donothing, BenchUnmapLinux());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue