mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Mold the redbean binary to minimize page faults
This change brings page faults for precompressed static asset serving down from 27 to 20 (or fewer) after fork. This is more of an art than science. Hopefully Blinkenlights can visualize page faults soon.
This commit is contained in:
parent
2d34819779
commit
e56a9d0e23
14 changed files with 978 additions and 782 deletions
9
libc/dos.h
Normal file
9
libc/dos.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef COSMOPOLITAN_LIBC_DOS_H_
|
||||||
|
#define COSMOPOLITAN_LIBC_DOS_H_
|
||||||
|
|
||||||
|
#define DOS_DATE(YEAR, MONTH_IDX1, DAY_IDX1) \
|
||||||
|
(((YEAR)-1980) << 9 | (MONTH_IDX1) << 5 | (DAY_IDX1))
|
||||||
|
#define DOS_TIME(HOUR, MINUTE, SECOND) \
|
||||||
|
((HOUR) << 11 | (MINUTE) << 5 | (SECOND) >> 1)
|
||||||
|
|
||||||
|
#endif /* COSMOPOLITAN_LIBC_DOS_H_ */
|
|
@ -23,9 +23,13 @@
|
||||||
#include "libc/calls/internal.h"
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/struct/sigset.h"
|
#include "libc/calls/struct/sigset.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
#include "libc/fmt/itoa.h"
|
||||||
#include "libc/intrin/repmovsb.h"
|
#include "libc/intrin/repmovsb.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
#include "libc/nexgen32e/rdtsc.h"
|
||||||
|
#include "libc/nexgen32e/rdtscp.h"
|
||||||
#include "libc/nexgen32e/stackframe.h"
|
#include "libc/nexgen32e/stackframe.h"
|
||||||
|
#include "libc/nexgen32e/x86feature.h"
|
||||||
#include "libc/nt/files.h"
|
#include "libc/nt/files.h"
|
||||||
#include "libc/nt/runtime.h"
|
#include "libc/nt/runtime.h"
|
||||||
#include "libc/nt/thunk/msabi.h"
|
#include "libc/nt/thunk/msabi.h"
|
||||||
|
@ -49,6 +53,7 @@
|
||||||
void ftrace_hook(void);
|
void ftrace_hook(void);
|
||||||
|
|
||||||
static int noreentry;
|
static int noreentry;
|
||||||
|
static uint64_t laststamp;
|
||||||
static char g_buf[512];
|
static char g_buf[512];
|
||||||
static const char *g_lastsymbol;
|
static const char *g_lastsymbol;
|
||||||
static struct SymbolTable *g_symbols;
|
static struct SymbolTable *g_symbols;
|
||||||
|
@ -70,11 +75,14 @@ static noasan int GetNestingLevel(struct StackFrame *frame) {
|
||||||
* according to the System Five NexGen32e ABI.
|
* according to the System Five NexGen32e ABI.
|
||||||
*/
|
*/
|
||||||
privileged noasan void ftrace(void) {
|
privileged noasan void ftrace(void) {
|
||||||
size_t i, j, nesting;
|
char *p;
|
||||||
|
uint64_t stamp;
|
||||||
const char *symbol;
|
const char *symbol;
|
||||||
struct StackFrame *frame;
|
struct StackFrame *frame;
|
||||||
|
size_t nesting, symbolsize;
|
||||||
if (!cmpxchg(&noreentry, 0, 1)) return;
|
if (!cmpxchg(&noreentry, 0, 1)) return;
|
||||||
if (g_symbols) {
|
if (g_symbols) {
|
||||||
|
stamp = rdtsc();
|
||||||
frame = __builtin_frame_address(0);
|
frame = __builtin_frame_address(0);
|
||||||
frame = frame->next;
|
frame = frame->next;
|
||||||
symbol =
|
symbol =
|
||||||
|
@ -84,31 +92,30 @@ privileged noasan void ftrace(void) {
|
||||||
g_symbols->count,
|
g_symbols->count,
|
||||||
frame->addr - g_symbols->addr_base)]
|
frame->addr - g_symbols->addr_base)]
|
||||||
.name_rva];
|
.name_rva];
|
||||||
if (symbol != g_lastsymbol &&
|
if (symbol != g_lastsymbol) {
|
||||||
(nesting = GetNestingLevel(frame)) * 2 < ARRAYLEN(g_buf) - 4) {
|
symbolsize = strlen(symbol);
|
||||||
i = 2;
|
nesting = GetNestingLevel(frame);
|
||||||
j = 0;
|
if (2 + nesting * 2 + symbolsize + 1 + 21 + 2 <= ARRAYLEN(g_buf)) {
|
||||||
while (nesting--) {
|
p = g_buf;
|
||||||
asm volatile("" : : : "memory");
|
*p++ = '+';
|
||||||
g_buf[i++] = ' ';
|
*p++ = ' ';
|
||||||
g_buf[i++] = ' ';
|
memset(p, ' ', nesting * 2);
|
||||||
|
p += nesting * 2;
|
||||||
|
p = mempcpy(p, symbol, symbolsize);
|
||||||
|
*p++ = ' ';
|
||||||
|
p += uint64toarray_radix10((stamp - laststamp) / 3.3, p);
|
||||||
|
*p++ = '\r';
|
||||||
|
*p++ = '\n';
|
||||||
|
write(2, g_buf, p - g_buf);
|
||||||
}
|
}
|
||||||
while (i < ARRAYLEN(g_buf) - 2 && symbol[j]) {
|
|
||||||
asm volatile("" : : : "memory");
|
|
||||||
g_buf[i++] = symbol[j++];
|
|
||||||
}
|
|
||||||
g_buf[i++] = '\r';
|
|
||||||
g_buf[i++] = '\n';
|
|
||||||
write(2, g_buf, i);
|
|
||||||
}
|
}
|
||||||
g_lastsymbol = symbol;
|
g_lastsymbol = symbol;
|
||||||
|
laststamp = X86_HAVE(RDTSCP) ? rdtscp(0) : rdtsc();
|
||||||
}
|
}
|
||||||
noreentry = 0;
|
noreentry = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
textstartup void ftrace_install(void) {
|
textstartup void ftrace_install(void) {
|
||||||
g_buf[0] = '+';
|
|
||||||
g_buf[1] = ' ';
|
|
||||||
if ((g_symbols = OpenSymbolTable(FindDebugBinary()))) {
|
if ((g_symbols = OpenSymbolTable(FindDebugBinary()))) {
|
||||||
__hook(ftrace_hook, g_symbols);
|
__hook(ftrace_hook, g_symbols);
|
||||||
} else {
|
} else {
|
||||||
|
|
30
libc/str/getzipcdirsize.c
Normal file
30
libc/str/getzipcdirsize.c
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||||
|
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||||
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||||
|
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||||
|
│ │
|
||||||
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||||
|
│ any purpose with or without fee is hereby granted, provided that the │
|
||||||
|
│ above copyright notice and this permission notice appear in all copies. │
|
||||||
|
│ │
|
||||||
|
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||||
|
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||||
|
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||||
|
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||||
|
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||||
|
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||||
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "libc/zip.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns size of zip central directory.
|
||||||
|
*/
|
||||||
|
uint64_t GetZipCdirSize(const uint8_t *eocd) {
|
||||||
|
if (READ32LE(eocd) == kZipCdir64HdrMagic) {
|
||||||
|
return ZIP_CDIR64_SIZE(eocd);
|
||||||
|
} else {
|
||||||
|
return ZIP_CDIR_SIZE(eocd);
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,12 +30,22 @@
|
||||||
void *memmem(const void *haystack, size_t haystacklen, const void *needle,
|
void *memmem(const void *haystack, size_t haystacklen, const void *needle,
|
||||||
size_t needlelen) {
|
size_t needlelen) {
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
const char *p;
|
||||||
if (!needlelen) return haystack;
|
if (!needlelen) return haystack;
|
||||||
for (i = 0; i < haystacklen; ++i) {
|
if (needlelen <= haystacklen) {
|
||||||
for (j = 0;; ++j) {
|
p = memchr(haystack, *(const char *)needle, haystacklen);
|
||||||
if (j == needlelen) return (/*unconst*/ char *)haystack + i;
|
if (needlelen == 1) return p;
|
||||||
if (i + j == haystacklen) break;
|
if (p) {
|
||||||
if (((char *)needle)[j] != ((char *)haystack)[i + j]) break;
|
haystacklen -= p - (const char *)haystack;
|
||||||
|
haystack = p;
|
||||||
|
}
|
||||||
|
/* TODO: make not quadratic */
|
||||||
|
for (i = 0; i < haystacklen; ++i) {
|
||||||
|
for (j = 0;; ++j) {
|
||||||
|
if (j == needlelen) return (/*unconst*/ char *)haystack + i;
|
||||||
|
if (i + j == haystacklen) break;
|
||||||
|
if (((char *)needle)[j] != ((char *)haystack)[i + j]) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "libc/bits/bits.h"
|
#include "libc/bits/bits.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
noasan static const char *strchr_x64(const char *p, uint64_t c) {
|
noasan static inline const char *strchr_x64(const char *p, uint64_t c) {
|
||||||
unsigned a, b;
|
unsigned a, b;
|
||||||
uint64_t w, x, y;
|
uint64_t w, x, y;
|
||||||
for (c *= 0x0101010101010101;; p += 8) {
|
for (c *= 0x0101010101010101;; p += 8) {
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/bits/safemacros.internal.h"
|
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,8 +29,13 @@
|
||||||
*/
|
*/
|
||||||
char *strstr(const char *haystack, const char *needle) {
|
char *strstr(const char *haystack, const char *needle) {
|
||||||
size_t i;
|
size_t i;
|
||||||
if (!*needle) return haystack;
|
const char *p;
|
||||||
haystack = firstnonnull(strchr(haystack, *needle), haystack);
|
if (!needle[0]) return haystack;
|
||||||
|
if (haystack == needle) return haystack;
|
||||||
|
p = strchr(haystack, needle[0]);
|
||||||
|
if (!needle[1]) return p;
|
||||||
|
if (p) haystack = p;
|
||||||
|
/* TODO: make not quadratic */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
for (i = 0;;) {
|
for (i = 0;;) {
|
||||||
if (!needle[i]) return (/*unconst*/ char *)haystack;
|
if (!needle[i]) return (/*unconst*/ char *)haystack;
|
||||||
|
|
|
@ -185,6 +185,7 @@ int GetZipCfileMode(const uint8_t *);
|
||||||
uint64_t GetZipCdirOffset(const uint8_t *);
|
uint64_t GetZipCdirOffset(const uint8_t *);
|
||||||
uint64_t GetZipCdirRecords(const uint8_t *);
|
uint64_t GetZipCdirRecords(const uint8_t *);
|
||||||
void *GetZipCdirComment(const uint8_t *);
|
void *GetZipCdirComment(const uint8_t *);
|
||||||
|
uint64_t GetZipCdirSize(const uint8_t *);
|
||||||
uint64_t GetZipCdirCommentSize(const uint8_t *);
|
uint64_t GetZipCdirCommentSize(const uint8_t *);
|
||||||
uint64_t GetZipCfileUncompressedSize(const uint8_t *);
|
uint64_t GetZipCfileUncompressedSize(const uint8_t *);
|
||||||
uint64_t GetZipCfileCompressedSize(const uint8_t *);
|
uint64_t GetZipCfileCompressedSize(const uint8_t *);
|
||||||
|
|
29
test/libc/nexgen32e/memrchr_test.c
Normal file
29
test/libc/nexgen32e/memrchr_test.c
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||||
|
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||||
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||||
|
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||||
|
│ │
|
||||||
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||||
|
│ any purpose with or without fee is hereby granted, provided that the │
|
||||||
|
│ above copyright notice and this permission notice appear in all copies. │
|
||||||
|
│ │
|
||||||
|
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||||
|
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||||
|
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||||
|
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||||
|
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||||
|
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||||
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "libc/nexgen32e/nexgen32e.h"
|
||||||
|
#include "libc/testlib/ezbench.h"
|
||||||
|
#include "libc/testlib/testlib.h"
|
||||||
|
|
||||||
|
TEST(memrchr, test) {
|
||||||
|
EXPECT_STREQ(".there", memrchr("yo.hi.there", '.', 11));
|
||||||
|
}
|
||||||
|
|
||||||
|
BENCH(memrchr, bench) {
|
||||||
|
EZBENCH2("memrchr", donothing, EXPROPRIATE(memrchr("yo.hi.there", '.', 11)));
|
||||||
|
}
|
|
@ -21,6 +21,8 @@
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/str/internal.h"
|
#include "libc/str/internal.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
#include "libc/testlib/ezbench.h"
|
||||||
|
#include "libc/testlib/hyperion.h"
|
||||||
#include "libc/testlib/testlib.h"
|
#include "libc/testlib/testlib.h"
|
||||||
|
|
||||||
#define MakeMemory(SL) memcpy(malloc(sizeof(SL) - 1), SL, sizeof(SL) - 1)
|
#define MakeMemory(SL) memcpy(malloc(sizeof(SL) - 1), SL, sizeof(SL) - 1)
|
||||||
|
@ -60,6 +62,22 @@ TEST(memmem, testEndOfMemory) {
|
||||||
free(needle);
|
free(needle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(memmem, testOneNo) {
|
||||||
|
char *needle = MakeMemory("z");
|
||||||
|
char *haystk = MakeMemory("abc123");
|
||||||
|
EXPECT_EQ(0, memmem(haystk, 6, needle, 1));
|
||||||
|
free(haystk);
|
||||||
|
free(needle);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(memmem, testOneYes) {
|
||||||
|
char *needle = MakeMemory("3");
|
||||||
|
char *haystk = MakeMemory("abc123");
|
||||||
|
EXPECT_EQ(&haystk[5], memmem(haystk, 6, needle, 1));
|
||||||
|
free(haystk);
|
||||||
|
free(needle);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(memmem, testCrossesSseRegister) {
|
TEST(memmem, testCrossesSseRegister) {
|
||||||
char *needle = MakeMemory("eeeeeeeeeeeeefffffffffffff");
|
char *needle = MakeMemory("eeeeeeeeeeeeefffffffffffff");
|
||||||
char *haystk = MakeMemory("eeeeeeeeeeeeeeeeffffffffffffffffrrrrrrrrrrrrrrrr");
|
char *haystk = MakeMemory("eeeeeeeeeeeeeeeeffffffffffffffffrrrrrrrrrrrrrrrr");
|
||||||
|
@ -113,3 +131,12 @@ TEST(memmem, testEmptyHaystackAndNeedle_returnsHaystack) {
|
||||||
TEST(memmem, testWut) {
|
TEST(memmem, testWut) {
|
||||||
ASSERT_STREQ("x", memmem("x", 1, "x", 1));
|
ASSERT_STREQ("x", memmem("x", 1, "x", 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BENCH(memmem, bench) {
|
||||||
|
EZBENCH2("memmem", donothing,
|
||||||
|
EXPROPRIATE(memmem(kHyperion, kHyperionSize, "THE END", 7)));
|
||||||
|
EZBENCH2("memmem", donothing,
|
||||||
|
EXPROPRIATE(memmem(
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
||||||
|
62, "aaaaaab", 7)));
|
||||||
|
}
|
||||||
|
|
|
@ -46,6 +46,12 @@ TEST(strstr, test_notFound) {
|
||||||
free(haystack);
|
free(haystack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(strstr, test_notFound1) {
|
||||||
|
MAKESTRING(haystack, "abc123def");
|
||||||
|
ASSERT_EQ(NULL, strstr(haystack, gc(strdup("x"))));
|
||||||
|
free(haystack);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(strstr, test_middleOfString) {
|
TEST(strstr, test_middleOfString) {
|
||||||
MAKESTRING(haystack, "abc123def");
|
MAKESTRING(haystack, "abc123def");
|
||||||
ASSERT_STREQ(&haystack[3], strstr(haystack, gc(strdup("123"))));
|
ASSERT_STREQ(&haystack[3], strstr(haystack, gc(strdup("123"))));
|
||||||
|
@ -80,8 +86,40 @@ TEST(strstr, test) {
|
||||||
|
|
||||||
BENCH(strstr, bench) {
|
BENCH(strstr, bench) {
|
||||||
EZBENCH2("strstr", donothing, EXPROPRIATE(strstr(kHyperion, "THE END")));
|
EZBENCH2("strstr", donothing, EXPROPRIATE(strstr(kHyperion, "THE END")));
|
||||||
EZBENCH2("strstr", donothing,
|
EZBENCH2("strstr torture 1", donothing,
|
||||||
EXPROPRIATE(strstr(
|
EXPROPRIATE(strstr(
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
"aaaaaab")));
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
||||||
|
"b")));
|
||||||
|
EZBENCH2("strstr torture 2", donothing,
|
||||||
|
EXPROPRIATE(strstr(
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
||||||
|
"ab")));
|
||||||
|
EZBENCH2("strstr torture 4", donothing,
|
||||||
|
EXPROPRIATE(strstr(
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
||||||
|
"aaab")));
|
||||||
|
EZBENCH2("strstr torture 8", donothing,
|
||||||
|
EXPROPRIATE(strstr(
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
||||||
|
"aaaaaaab")));
|
||||||
|
EZBENCH2("strstr torture 16", donothing,
|
||||||
|
EXPROPRIATE(strstr(
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
||||||
|
"aaaaaaaaaaaaaaab")));
|
||||||
|
EZBENCH2("strstr torture 32", donothing,
|
||||||
|
EXPROPRIATE(strstr(
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/stat.h"
|
#include "libc/calls/struct/stat.h"
|
||||||
#include "libc/calls/struct/timespec.h"
|
#include "libc/calls/struct/timespec.h"
|
||||||
|
#include "libc/dos.h"
|
||||||
#include "libc/elf/def.h"
|
#include "libc/elf/def.h"
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
|
@ -55,11 +56,6 @@
|
||||||
#define ZIP_LOCALFILE_SECTION ".zip.2."
|
#define ZIP_LOCALFILE_SECTION ".zip.2."
|
||||||
#define ZIP_DIRECTORY_SECTION ".zip.4."
|
#define ZIP_DIRECTORY_SECTION ".zip.4."
|
||||||
|
|
||||||
#define DOS_DATE(YEAR, MONTH_IDX1, DAY_IDX1) \
|
|
||||||
(((YEAR)-1980) << 9 | (MONTH_IDX1) << 5 | (DAY_IDX1))
|
|
||||||
#define DOS_TIME(HOUR, MINUTE, SECOND) \
|
|
||||||
((HOUR) << 11 | (MINUTE) << 5 | (SECOND) >> 1)
|
|
||||||
|
|
||||||
char *symbol_;
|
char *symbol_;
|
||||||
char *outpath_;
|
char *outpath_;
|
||||||
char *yoink_;
|
char *yoink_;
|
||||||
|
|
94
tool/net/counters.inc
Normal file
94
tool/net/counters.inc
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
C(accepterrors)
|
||||||
|
C(acceptinterrupts)
|
||||||
|
C(acceptresets)
|
||||||
|
C(badlengths)
|
||||||
|
C(badmessages)
|
||||||
|
C(badmethods)
|
||||||
|
C(badranges)
|
||||||
|
C(closeerrors)
|
||||||
|
C(compressedresponses)
|
||||||
|
C(connectionshandled)
|
||||||
|
C(connectsrefused)
|
||||||
|
C(continues)
|
||||||
|
C(decompressedresponses)
|
||||||
|
C(deflates)
|
||||||
|
C(dropped)
|
||||||
|
C(dynamicrequests)
|
||||||
|
C(emfiles)
|
||||||
|
C(enetdowns)
|
||||||
|
C(enfiles)
|
||||||
|
C(enobufs)
|
||||||
|
C(enomems)
|
||||||
|
C(enonets)
|
||||||
|
C(errors)
|
||||||
|
C(expectsrefused)
|
||||||
|
C(failedchildren)
|
||||||
|
C(forbiddens)
|
||||||
|
C(forkerrors)
|
||||||
|
C(frags)
|
||||||
|
C(fumbles)
|
||||||
|
C(http09)
|
||||||
|
C(http10)
|
||||||
|
C(http11)
|
||||||
|
C(http12)
|
||||||
|
C(hugepayloads)
|
||||||
|
C(identityresponses)
|
||||||
|
C(inflates)
|
||||||
|
C(listingrequests)
|
||||||
|
C(loops)
|
||||||
|
C(mapfails)
|
||||||
|
C(maps)
|
||||||
|
C(meltdowns)
|
||||||
|
C(messageshandled)
|
||||||
|
C(missinglengths)
|
||||||
|
C(netafrinic)
|
||||||
|
C(netanonymous)
|
||||||
|
C(netapnic)
|
||||||
|
C(netapple)
|
||||||
|
C(netarin)
|
||||||
|
C(netatt)
|
||||||
|
C(netcogent)
|
||||||
|
C(netcomcast)
|
||||||
|
C(netdod)
|
||||||
|
C(netford)
|
||||||
|
C(netlacnic)
|
||||||
|
C(netloopback)
|
||||||
|
C(netother)
|
||||||
|
C(netprivate)
|
||||||
|
C(netprudential)
|
||||||
|
C(netripe)
|
||||||
|
C(nettestnet)
|
||||||
|
C(netusps)
|
||||||
|
C(notfounds)
|
||||||
|
C(notmodifieds)
|
||||||
|
C(openfails)
|
||||||
|
C(partialresponses)
|
||||||
|
C(payloaddisconnects)
|
||||||
|
C(pipelinedrequests)
|
||||||
|
C(precompressedresponses)
|
||||||
|
C(readerrors)
|
||||||
|
C(readinterrupts)
|
||||||
|
C(readresets)
|
||||||
|
C(readtimeouts)
|
||||||
|
C(redirects)
|
||||||
|
C(reindexes)
|
||||||
|
C(reloads)
|
||||||
|
C(rewrites)
|
||||||
|
C(serveroptions)
|
||||||
|
C(shutdowns)
|
||||||
|
C(slowloris)
|
||||||
|
C(slurps)
|
||||||
|
C(statfails)
|
||||||
|
C(staticrequests)
|
||||||
|
C(stats)
|
||||||
|
C(statuszrequests)
|
||||||
|
C(synchronizationfailures)
|
||||||
|
C(terminatedchildren)
|
||||||
|
C(thiscorruption)
|
||||||
|
C(transfersrefused)
|
||||||
|
C(urisrefused)
|
||||||
|
C(verifies)
|
||||||
|
C(writeerrors)
|
||||||
|
C(writeinterruputs)
|
||||||
|
C(writeresets)
|
||||||
|
C(writetimeouts)
|
|
@ -1 +1,2 @@
|
||||||
Write('hello world\r\n')
|
Write('hello world\r\n')
|
||||||
|
StoreAsset('/hi', 'sup')
|
||||||
|
|
1444
tool/net/redbean.c
1444
tool/net/redbean.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue