From c67faf61df57247679a5bb79f2818b810bc017e1 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 1 Jun 2024 20:36:58 -0700 Subject: [PATCH] Delete some unintentional code --- examples/demangle.c | 67 --------------------------------------------- libc/str/BUILD.mk | 4 --- 2 files changed, 71 deletions(-) delete mode 100644 examples/demangle.c diff --git a/examples/demangle.c b/examples/demangle.c deleted file mode 100644 index 052e207ab..000000000 --- a/examples/demangle.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "libc/assert.h" -#include "libc/calls/struct/timespec.h" -#include "libc/cosmo.h" -#include "libc/runtime/runtime.h" -#include "libc/stdio/internal.h" -#include "libc/stdio/stdio.h" -#include "libc/str/str.h" -#include "libc/time.h" - -void nothing(void) { -} - -void (*barrier)(void) = nothing; - -struct timespec now(void) { - struct timespec ts; - timespec_get(&ts, TIME_UTC); - return ts; -} - -long long tonanos(struct timespec x) { - return x.tv_sec * 1000000000ll + x.tv_nsec; -} - -struct timespec tub(struct timespec a, struct timespec b) { - a.tv_sec -= b.tv_sec; - if (a.tv_nsec < b.tv_nsec) { - a.tv_nsec += 1000000000; - a.tv_sec--; - } - a.tv_nsec -= b.tv_nsec; - return a; -} - -#define BENCH(ITERATIONS, WORK_PER_RUN, CODE) \ - do { \ - struct timespec start = now(); \ - for (int i = 0; i < ITERATIONS; ++i) { \ - barrier(); \ - CODE; \ - } \ - long long work = WORK_PER_RUN * ITERATIONS; \ - double nanos = (tonanos(tub(now(), start)) + work - 1) / (double)work; \ - printf("%10g ns %2dx %s\n", nanos, ITERATIONS, #CODE); \ - } while (0) - -char got[5632]; -char huge[262144]; - -__static_yoink("PrintBacktraceUsingSymbols"); -__static_yoink("GetSymbolTable"); - -int main(int argc, char *argv[]) { - ShowCrashReports(); - const char *sym = - "_ZN12_GLOBAL__N_116tinyBLAS_Q0_AVX2ILi0E10block_q4_010block_" - "q8_0fE4gemmILi3ELi2ELi0EEEvllll"; - __demangle(got, sym, sizeof(got)); - printf("%s\n", got); - BENCH(1000, 1, __demangle(got, sym, sizeof(got))); -} diff --git a/libc/str/BUILD.mk b/libc/str/BUILD.mk index e8af3a9e8..ab0193593 100644 --- a/libc/str/BUILD.mk +++ b/libc/str/BUILD.mk @@ -100,10 +100,6 @@ $(LIBC_STR_A_OBJS): private \ -Wframe-larger-than=4096 \ -Walloca-larger-than=4096 -o/$(MODE)/libc/str/demangle.o: private \ - OVERRIDE_CFLAGS += \ - -ffreestanding - LIBC_STR_LIBS = $(foreach x,$(LIBC_STR_ARTIFACTS),$($(x))) LIBC_STR_SRCS = $(foreach x,$(LIBC_STR_ARTIFACTS),$($(x)_SRCS)) LIBC_STR_HDRS = $(foreach x,$(LIBC_STR_ARTIFACTS),$($(x)_HDRS))