2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2021-08-15 14:49:13 +00:00
|
|
|
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
2009-10-04 20:28:08 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-03-01 03:30:19 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
2009-03-01 03:30:19 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-03-01 03:30:19 +00:00
|
|
|
*/
|
2009-10-04 20:28:08 +00:00
|
|
|
|
2021-09-03 10:43:33 +00:00
|
|
|
#if !defined(_WIN32) && !defined(__APPLE__)
|
2009-03-01 03:30:19 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <time.h>
|
2012-03-17 11:21:51 +00:00
|
|
|
#include <unistd.h>
|
2009-03-01 03:30:19 +00:00
|
|
|
#include <sys/time.h>
|
2010-04-25 00:31:27 +00:00
|
|
|
#include <wx/utils.h>
|
2009-03-01 03:30:19 +00:00
|
|
|
|
2021-09-03 10:43:33 +00:00
|
|
|
#include "common/Pcsx2Types.h"
|
|
|
|
|
2010-11-23 21:32:52 +00:00
|
|
|
// Returns 0 on failure (not supported by the operating system).
|
|
|
|
u64 GetPhysicalMemory()
|
|
|
|
{
|
2021-08-18 12:28:47 +00:00
|
|
|
u64 pages = 0;
|
2010-11-23 21:32:52 +00:00
|
|
|
|
|
|
|
#ifdef _SC_PHYS_PAGES
|
2021-08-18 12:28:47 +00:00
|
|
|
pages = sysconf(_SC_PHYS_PAGES);
|
2010-11-23 21:32:52 +00:00
|
|
|
#endif
|
|
|
|
|
2021-08-18 12:28:47 +00:00
|
|
|
return pages * getpagesize();
|
2010-11-23 21:32:52 +00:00
|
|
|
}
|
2009-10-04 21:49:23 +00:00
|
|
|
|
2009-10-04 20:28:08 +00:00
|
|
|
|
2009-03-01 03:30:19 +00:00
|
|
|
void InitCPUTicks()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 GetTickFrequency()
|
|
|
|
{
|
2022-04-07 12:41:07 +00:00
|
|
|
return 1000000000;// unix measures in nanoseconds
|
2009-03-01 03:30:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u64 GetCPUTicks()
|
|
|
|
{
|
2022-04-07 12:41:07 +00:00
|
|
|
struct timespec ts;
|
|
|
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
|
|
|
return (static_cast<u64>(ts.tv_sec) * 1000000000ULL) + ts.tv_nsec;
|
2009-03-01 03:30:19 +00:00
|
|
|
}
|
2009-11-26 03:37:10 +00:00
|
|
|
|
|
|
|
wxString GetOSVersionString()
|
|
|
|
{
|
2021-10-03 20:21:44 +00:00
|
|
|
#if defined(__linux__)
|
2021-08-18 12:28:47 +00:00
|
|
|
return wxGetLinuxDistributionInfo().Description;
|
2021-10-03 20:21:44 +00:00
|
|
|
#else // freebsd
|
|
|
|
return wxGetOsDescription();
|
|
|
|
#endif
|
2009-11-26 03:37:10 +00:00
|
|
|
}
|
|
|
|
|
2015-02-26 02:08:58 +00:00
|
|
|
void ScreensaverAllow(bool allow)
|
|
|
|
{
|
2021-08-18 12:28:47 +00:00
|
|
|
// no-op
|
2015-02-26 02:08:58 +00:00
|
|
|
}
|
2021-09-01 20:31:46 +00:00
|
|
|
#endif
|