MCPcopy Create free account
hub / github.com/catboost/catboost / InCoreMemory

Function InCoreMemory

util/system/mincore.cpp:16–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#endif
15
16void InCoreMemory(const void* addr, size_t len, unsigned char* vec, size_t vecLen) {
17#if defined(_linux_)
18 const size_t pageSize = NSystemInfo::GetPageSize();
19 void* maddr = const_cast<void*>(AlignDown(addr, pageSize));
20 len = AlignUp(len, pageSize);
21 if (vecLen * pageSize < len) {
22 ythrow yexception() << "vector argument for mincore is too small: " << vecLen * pageSize << " < " << len;
23 }
24 if (::mincore(maddr, len, vec)) {
25 ythrow yexception() << LastSystemErrorText();
26 }
27#else
28 // pessimistic assumption: nothing is in core
29 Y_UNUSED(addr);
30 Y_UNUSED(len);
31 ::memset(vec, 0, vecLen);
32#endif
33}

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 4

Y_UNUSEDFunction · 0.85
AlignDownFunction · 0.70
AlignUpFunction · 0.70
GetPageSizeFunction · 0.50

Tested by

no test coverage detected