mask_type get_thread_affinity_mask_from_lva( naming::address::address_type lva , error_code& ec = throws ) const { // {{{ PSAPI_WORKING_SET_EX_INFORMATION info; info.VirtualAddress = reinterpret_cast<void*>(lva); if (!QueryWorkingSetEx(GetCurrentProcess(), &info, sizeof(info))) { HPX_THROWS_IF(ec, kernel_error , "hpx::threads::windows_topology::get_thread_affinity_mask_from_lva" , "failed to get thread affinity mask"); } if (ec) return 0; ULONGLONG mask = 0; if (!GetNumaNodeProcessorMask(info.VirtualAttributes.Node, &mask)) { HPX_THROWS_IF(ec, kernel_error , "hpx::threads::windows_topology::get_thread_affinity_mask_from_lva" , "failed to get thread affinity mask"); } if (ec) return 0; else if (&ec != &throws) ec = make_success_code(); return static_cast<std::size_t>(mask); } // }}}
bool ProcessInfo::blockInMemory( char * start ) { #if 0 // code for printing out page fault addresses and pc's -- // this could be useful for targetting heavy pagefault locations in the code static BOOL bstat = InitializeProcessForWsWatch( GetCurrentProcess() ); PSAPI_WS_WATCH_INFORMATION_EX wiex[30]; DWORD bufsize = sizeof(wiex); bstat = GetWsChangesEx( GetCurrentProcess(), &wiex[0], &bufsize ); if (bstat) { for (int i=0; i<30; i++) { if (wiex[i].BasicInfo.FaultingPc == 0) break; cout << "faulting pc = " << wiex[i].BasicInfo.FaultingPc << " address = " << wiex[i].BasicInfo.FaultingVa << " thread id = " << wiex[i].FaultingThreadId << endl; } } #endif PSAPI_WORKING_SET_EX_INFORMATION wsinfo; wsinfo.VirtualAddress = start; BOOL result = QueryWorkingSetEx( GetCurrentProcess(), &wsinfo, sizeof(wsinfo) ); if ( result ) if ( wsinfo.VirtualAttributes.Valid ) return true; return false; }