mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-29 00:32:29 +00:00
Initial import
This commit is contained in:
commit
c91b3c5006
14915 changed files with 590219 additions and 0 deletions
29
libc/testlib/ezbench.h
Normal file
29
libc/testlib/ezbench.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_TESTLIB_EZBENCH_H_
|
||||
#define COSMOPOLITAN_LIBC_TESTLIB_EZBENCH_H_
|
||||
#include "libc/macros.h"
|
||||
#include "libc/testlib/bench.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
#define EZBENCH(INIT, EXPR) EZBENCH2(#EXPR, INIT, EXPR)
|
||||
#define EZBENCH2(NAME, INIT, EXPR) \
|
||||
do { \
|
||||
uint64_t Control, Speculative, MemoryStrict; \
|
||||
Control = __testlib_ezbenchcontrol(); \
|
||||
INIT; \
|
||||
EXPR; \
|
||||
Speculative = BENCHLOOP(__startbench, __endbench, 128, INIT, (EXPR)); \
|
||||
MemoryStrict = BENCHLOOP(__startbench_m, __endbench_m, 8, ({ \
|
||||
INIT; \
|
||||
thrashcodecache(); \
|
||||
}), \
|
||||
(EXPR)); \
|
||||
Control = MIN(Control, MIN(Speculative, MemoryStrict)); \
|
||||
__testlib_ezbenchreport(NAME, Speculative - Control, \
|
||||
MemoryStrict - Control); \
|
||||
} while (0)
|
||||
|
||||
void __testlib_ezbenchreport(const char *, uint64_t, uint64_t);
|
||||
uint64_t __testlib_ezbenchcontrol(void);
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_TESTLIB_EZBENCH_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue