Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int main(int argc, char* argv[]) {
- if (argc<3) {
- cout << "Usage:" << endl << "./memtest_performance_experiment MEMORY_IN_MEGABYTES NUMBER_OF_PASSES SEED(-1=linear access)";
- return -1;
- }
- int argPos=1;
- int memoryInMegabytes = atoi(argv[argPos++]);
- long long int size = memoryInMegabytes*1024l*1024l;
- int numberOfPasses = atoi(argv[argPos++]);
- int seed = atoi(argv[argPos++]);
- char *memory = new char[size];
- if (seed>=0) {
- } else {
- for (int passNo=0; passNo<numberOfPasses; passNo++) {
- for (long long int index=0; index<size; index++) {
- memory[index]=(char)(index%255);
- }
- }
- if (memory[rand()%size] > rand()%255) {
- cout << "" << endl;
- }
- }
- delete [] memory;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement