Skip to content

Commit ac7252c

Browse files
committed
Add CMake switches and documentation
1 parent 71989ea commit ac7252c

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ target_link_libraries(litterer_static PRIVATE Threads::Threads)
3232

3333
add_executable(microbenchmark-pages microbenchmark-pages.cpp)
3434
target_link_libraries(microbenchmark-pages PRIVATE Threads::Threads)
35+
if (MBP_OBJECT_DISTANCE)
36+
target_compile_definitions(microbenchmark-pages PUBLIC OBJECT_DISTANCE=${MBP_OBJECT_DISTANCE})
37+
endif()
38+
if (MBP_OBJECT_SIZE)
39+
target_compile_definitions(microbenchmark-pages PUBLIC OBJECT_SIZE=${MBP_OBJECT_SIZE})
40+
endif()
3541

3642
if(NOT WIN32)
3743
message(STATUS "Downloading and configuring mimalloc")

src/REAMDE.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Microbenchmark
2+
3+
Here are instructions on running and tuning the `microbenchmark-pages` target.
4+
5+
```bash
6+
# On Windows
7+
% cmake src -B build
8+
% cmake --build build --config Release
9+
% ./build/Release/microbenchmark-pages.exe
10+
11+
# On other platforms
12+
% cmake src -B build -DCMAKE_BUILD_TYPE=Release
13+
% cmake --build build
14+
% ./build/microbenchmark-pages.exe
15+
16+
# TODO: Maybe these can be merged into one, just needs testing.
17+
```
18+
19+
Settings can be set using CMake at configuration time (the first step).
20+
21+
```bash
22+
% cmake src -B build -DMBP_OBJECT_SIZE=32 -DMBP_OBJECT_DISTANCE=4096
23+
```

0 commit comments

Comments
 (0)