This commit is contained in:
Christien Rioux 2015-12-12 21:39:46 -08:00
parent 26ee21e8de
commit 0d527771eb

View File

@ -229,6 +229,8 @@ unsigned int CLineCount::countThread(int thread_number)
tlc_linecount_t count = 0; tlc_linecount_t count = 0;
void *mem = NULL; void *mem = NULL;
void *mapmem = MMAP(NULL, m_filesize, PROT_READ, MAP_FILE | MAP_SHARED, m_fh, 0);
madvise(mapmem, m_filesize, MADV_SEQUENTIAL);
while (curoffset < m_filesize) while (curoffset < m_filesize)
{ {
if (m_thread_fail) if (m_thread_fail)
@ -253,7 +255,7 @@ unsigned int CLineCount::countThread(int thread_number)
} }
mem = MapViewOfFile(m_filemapping, FILE_MAP_READ, (DWORD)(curoffset >> 32), (DWORD)curoffset, (SIZE_T)mapsize); mem = MapViewOfFile(m_filemapping, FILE_MAP_READ, (DWORD)(curoffset >> 32), (DWORD)curoffset, (SIZE_T)mapsize);
#else #else
if (mem) /* if (mem)
{ {
if(munmap(mem, lastmapsize) !=0) if(munmap(mem, lastmapsize) !=0)
{ {
@ -262,7 +264,8 @@ unsigned int CLineCount::countThread(int thread_number)
return -1; return -1;
} }
} }
mem = MMAP(NULL, mapsize, PROT_READ, MAP_FILE | MAP_SHARED, m_fh, curoffset); mem = MMAP(NULL, mapsize, PROT_READ, MAP_FILE | MAP_SHARED, m_fh, curoffset); */
mem = ((char *)mapmem) + curoffset;
// printf("%p %lld %lld\n",mem, mapsize, curoffset); // printf("%p %lld %lld\n",mem, mapsize, curoffset);
#endif #endif
if (mem == MAP_FAILED) if (mem == MAP_FAILED)