mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-24 03:32:50 +01:00
Low Power Mode detection
Change low to reduced Low Power Mode detection Fix namespace space Low Power Mode detection Fix namespace space Low Power Mode detection
This commit is contained in:
parent
686d2759f4
commit
ce7b1576e0
@ -19,3 +19,11 @@ namespace Darwin_Version
|
||||
return osver.patchVersion;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Darwin_ProcessInfo
|
||||
{
|
||||
bool getLowPowerModeEnabled()
|
||||
{
|
||||
return NSProcessInfo.processInfo.isLowPowerModeEnabled;
|
||||
}
|
||||
}
|
||||
|
@ -513,14 +513,18 @@ int main(int argc, char** argv)
|
||||
rlim.rlim_max = 4096;
|
||||
#ifdef RLIMIT_NOFILE
|
||||
if (::setrlimit(RLIMIT_NOFILE, &rlim) != 0)
|
||||
{
|
||||
std::cerr << "Failed to set max open file limit (4096).\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
rlim.rlim_cur = 0x80000000;
|
||||
rlim.rlim_max = 0x80000000;
|
||||
#ifdef RLIMIT_MEMLOCK
|
||||
if (::setrlimit(RLIMIT_MEMLOCK, &rlim) != 0)
|
||||
{
|
||||
std::cerr << "Failed to set RLIMIT_MEMLOCK size to 2 GiB. Try to update your system configuration.\n";
|
||||
}
|
||||
#endif
|
||||
// Work around crash on startup on KDE: https://bugs.kde.org/show_bug.cgi?id=401637
|
||||
setenv( "KDE_DEBUG", "1", 0 );
|
||||
@ -531,7 +535,9 @@ int main(int argc, char** argv)
|
||||
::getrlimit(RLIMIT_NOFILE, &rlim);
|
||||
rlim.rlim_cur = OPEN_MAX;
|
||||
if (::setrlimit(RLIMIT_NOFILE, &rlim) != 0)
|
||||
{
|
||||
std::cerr << "Failed to set max open file limit (" << OPEN_MAX << ").\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
@ -539,6 +545,11 @@ int main(int argc, char** argv)
|
||||
sys_log.notice("Maximum open file descriptors: %i", utils::get_maxfiles());
|
||||
#endif
|
||||
|
||||
if (utils::get_low_power_mode())
|
||||
{
|
||||
sys_log.error("Low Power Mode is enabled, performance may be reduced.");
|
||||
}
|
||||
|
||||
std::lock_guard qt_init(s_qt_init);
|
||||
|
||||
// The constructor of QApplication eats the --style and --stylesheet arguments.
|
||||
|
@ -57,6 +57,11 @@ namespace Darwin_Version
|
||||
extern int getNSminorVersion();
|
||||
extern int getNSpatchVersion();
|
||||
}
|
||||
|
||||
namespace Darwin_ProcessInfo
|
||||
{
|
||||
extern bool getLowPowerModeEnabled();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool utils::has_ssse3()
|
||||
@ -474,6 +479,15 @@ int utils::get_maxfiles()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool utils::get_low_power_mode()
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
return Darwin_ProcessInfo::getLowPowerModeEnabled();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static constexpr ullong round_tsc(ullong val)
|
||||
{
|
||||
return utils::rounded_div(val, 1'000'000) * 1'000'000;
|
||||
|
@ -51,6 +51,8 @@ namespace utils
|
||||
|
||||
int get_maxfiles();
|
||||
|
||||
bool get_low_power_mode();
|
||||
|
||||
ullong get_tsc_freq();
|
||||
|
||||
u64 get_total_memory();
|
||||
|
Loading…
Reference in New Issue
Block a user