-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve initial setup time and memory consumption in fast histogram
- Loading branch information
Showing
8 changed files
with
237 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/*! | ||
* Copyright 2017 by Contributors | ||
* \file memory.h | ||
* \brief Utility for memory | ||
* \author Philip Cho | ||
*/ | ||
#ifndef XGBOOST_COMMON_MEMORY_H_ | ||
#define XGBOOST_COMMON_MEMORY_H_ | ||
|
||
#ifndef _WIN32 | ||
#include <unistd.h> | ||
#else | ||
#include <windows.h> | ||
#endif | ||
|
||
namespace xgboost { | ||
namespace common { | ||
|
||
#ifndef _WIN32 | ||
inline unsigned long long GetSystemMemory() | ||
{ | ||
long pages = sysconf(_SC_PHYS_PAGES); | ||
long page_size = sysconf(_SC_PAGE_SIZE); | ||
return pages * page_size; | ||
} | ||
#else | ||
inline unsigned long long GetSystemMemory() | ||
{ | ||
MEMORYSTATUSEX status; | ||
status.dwLength = sizeof(status); | ||
GlobalMemoryStatusEx(&status); | ||
return status.ullTotalPhys; | ||
} | ||
#endif | ||
|
||
} // namespace common | ||
} // namespace xgboost | ||
#endif // XGBOOST_COMMON_MEMORY_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.