/* Copyright (c) 2003-2005 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include #include #include #include #include #include #include #include #include #include struct ThreadData { char * mapAddr; Uint32 mapSize; Uint32 chunk; Uint32 idx; }; long long getMilli(); long long getMicro(); void* mapSegment(void * arg); void* unmapSegment(void * arg); void* mapSegment(void * arg) { ThreadData * threadArgs; long long start=0; int total=0; int id = *(int *)arg; threadArgs = new ThreadData [1]; Uint32 size=5*1024*1024; struct NdbThread* unmapthread_var; void *status = 0; int run = 1; int max=0, min =100000000, sum=0; while(run < 1001) { start=getMicro(); char * ptr =(char*) mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); total=(int)(getMicro()-start); ndbout << "T" << id << ": mmap took : " << total << " microsecs. " << " Run: " << run ; ndbout_c(" mapped @ %p \n", ptr); if(total>max) max = total; if(totalmapSize; Uint32 chunk = threadData->chunk; mapAddr = threadData->mapAddr; freeAddr = mapAddr+mapSize-chunk; NdbSleep_MilliSleep(100); for(Uint32 i=0;i