MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / cpu_getPageSize

Function cpu_getPageSize

quest/src/cpu/cpu_config.cpp:145–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143
144
145long cpu_getPageSize() {
146
147 // avoid repeated queries to this fixed value
148 static long pageSize = 0;
149 if (pageSize > 0)
150 return pageSize;
151
152 // obtain pageSize for the first time
153#if defined(_WIN32)
154 SYSTEM_INFO sysInfo;
155 GetSystemInfo(&sysInfo);
156 pageSize = sysInfo.dwPageSize;
157#else
158 pageSize = sysconf(_SC_PAGESIZE);
159#endif
160
161 // rigorously check the found pagesize is valid
162 // and consistent with preconditions assumed by
163 // callers, to avoid extremely funky bugs on
164 // esoteric future systems
165
166 if (pageSize <= 0)
167 error_gettingPageSizeFailed();
168
169 if (!isPowerOf2(pageSize))
170 error_pageSizeNotAPowerOf2();
171
172 if (pageSize % sizeof(qcomp) != 0)
173 error_pageSizeNotAMultipleOfQcomp();
174
175 return pageSize;
176}
177
178
179qcomp* cpu_allocArray(qindex length) {

Callers 3

cpu_allocNumaArrayFunction · 0.85
cpu_deallocNumaArrayFunction · 0.85

Calls 4

isPowerOf2Function · 0.85

Tested by

no test coverage detected