Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
mprotect_test.cpp File Reference
#include "xbyak/xbyak.h"
#include <string.h>
#include <vector>
Include dependency graph for mprotect_test.cpp:

Go to the source code of this file.

Classes

struct  Code
 

Macros

#define XBYAK_NO_OP_NAMES
 

Functions

int main ()
 

Macro Definition Documentation

◆ XBYAK_NO_OP_NAMES

#define XBYAK_NO_OP_NAMES

Definition at line 1 of file mprotect_test.cpp.

Function Documentation

◆ main()

int main ( void )

Definition at line 14 of file mprotect_test.cpp.

16{
17#ifdef XBYAK_USE_MMAP_ALLOCATOR
18 puts("use Allocator with mmap");
19#else
20 puts("use Allocator with posix_memalign");
21#endif
22 const int N = 70000;
23 std::vector<Code*> v(N);
24 for (int i = 0; i < N; i++) {
25 v[i] = new Code(i);
26 }
27 long long sum = 0;
28 for (int i = 0; i < N; i++) {
29 sum += v[i]->getCode<int (*)()>()();
30 }
31 for (int i = 0; i < N; i++) {
32 delete v[i];
33 }
34 printf("sum=%lld\n", sum);
35} catch (std::exception& e) {
36 printf("ERR %s\n", e.what());
37}
LOGGING_API void printf(Category category, const char *format,...)
Definition Logging.cpp:30
const int N
Definition quantize.cpp:54
Definition bench.cpp:18