-
-
Save mu-mu-mu/9cabb073f9eb92a164c09eec7e7ed56c to your computer and use it in GitHub Desktop.
Demand Paging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <chrono> | |
#include <sys/mman.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <string.h> | |
using namespace std; | |
int main(){ | |
mlockall(MCL_FUTURE); | |
std::chrono::system_clock::time_point start, end; | |
start = std::chrono::system_clock::now(); | |
auto tt = new char[4194304]; | |
memset(tt, 0, 4194304); | |
end = std::chrono::system_clock::now(); | |
auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end-start).count(); | |
cout << elapsed << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment