mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-31 17:52:27 +00:00
Make some systemic improvements
- add vdso dump utility - tests now log stack usage - rename g_ftrace to __ftrace - make internal spinlocks go faster - add conformant c11 atomics library - function tracing now logs stack usage - make function call tracing thread safe - add -X unsecure (no ssl) mode to redbean - munmap() has more consistent behavior now - pacify fsync() calls on python unit tests - make --strace flag work better in redbean - start minimizing and documenting compiler flags
This commit is contained in:
parent
c6bbca55e9
commit
9208c83f7a
141 changed files with 1948 additions and 1411 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "libc/calls/struct/sigset.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/spinlock.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/nexgen32e/threaded.h"
|
||||
|
@ -40,20 +41,26 @@
|
|||
#define ENTRIES 256
|
||||
|
||||
char locks[THREADS];
|
||||
volatile bool ready;
|
||||
_Atomic(bool) ready;
|
||||
volatile uint64_t A[THREADS * ENTRIES];
|
||||
|
||||
void OnChld(int sig) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
dontinline void Pause(void) {
|
||||
__builtin_ia32_pause();
|
||||
}
|
||||
|
||||
dontinline void Generate(int i) {
|
||||
A[i] = rand64();
|
||||
}
|
||||
|
||||
int Thrasher(void *arg) {
|
||||
int i, id = (intptr_t)arg;
|
||||
while (!ready) {
|
||||
__builtin_ia32_pause();
|
||||
}
|
||||
while (!ready) Pause();
|
||||
for (i = 0; i < ENTRIES; ++i) {
|
||||
A[id * ENTRIES + i] = rand64();
|
||||
Generate(id * ENTRIES + i);
|
||||
}
|
||||
_spunlock(locks + id);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue