mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
refactor: define WIN32_LEAN_AND_MEAN
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#else
|
#else
|
||||||
@@ -15,12 +16,14 @@ inline size_t get_current_rss() {
|
|||||||
return pmc.WorkingSetSize;
|
return pmc.WorkingSetSize;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#elif defined(__linux__)
|
||||||
std::ifstream statm("/proc/self/statm");
|
std::ifstream statm("/proc/self/statm");
|
||||||
long vsz = 0, rss_pages = 0;
|
long vsz = 0, rss_pages = 0;
|
||||||
statm >> vsz >> rss_pages;
|
statm >> vsz >> rss_pages;
|
||||||
statm.close();
|
statm.close();
|
||||||
long page_size = sysconf(_SC_PAGESIZE);
|
long page_size = sysconf(_SC_PAGESIZE);
|
||||||
return rss_pages * page_size;
|
return rss_pages * page_size;
|
||||||
|
#else
|
||||||
|
return 0; // Unsupported platform
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <Cubed/tools/log.hpp>
|
#include <Cubed/tools/log.hpp>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
typedef LONG (WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
typedef LONG (WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
||||||
inline bool get_os_version(std::string& str) {
|
inline bool get_os_version(std::string& str) {
|
||||||
|
|||||||
Reference in New Issue
Block a user