Skip to content

Commit

Permalink
Updates for Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
emeryberger committed Sep 26, 2023
1 parent 97c5842 commit 77352b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all: microbenchmark-pages-new

microbenchmark-pages-new: Makefile microbenchmark-pages-new.cpp
cl /std:c++20 /EHsc -DNDEBUG /Ox /MD -DOBJECT_SIZE=256 -DOBJECT_DISTANCE=4096 microbenchmark-pages-new.cpp printf.cpp
13 changes: 12 additions & 1 deletion src/microbenchmark-pages-new.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <algorithm>
#include <array>
#include <chrono>
#include <cstdlib>
#include <cstring>
Expand All @@ -9,11 +10,21 @@
#include <unordered_set>
#include <vector>

#include <assert.h>

#if _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
extern "C" void _putchar(char ch) {
DWORD written;
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),
&ch,
1,
&written,
NULL);
}
#else
#include <unistd.h>
// For use by the replacement printf routines (see
Expand Down Expand Up @@ -57,7 +68,7 @@ T abs(T x) {
} // namespace

#ifndef N
#define N 15'000 // Number of pages.
#define N 1'000 // Number of pages. // was 15'000
#endif

#ifndef OBJECT_SIZE
Expand Down

0 comments on commit 77352b5

Please sign in to comment.