mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
Debug: measure initialization time (before main() function)
This commit is contained in:
parent
52360b3f98
commit
3d78694590
1 changed files with 17 additions and 0 deletions
|
@ -60,6 +60,8 @@ static atomic_t<char*> s_argv0;
|
|||
extern char **environ;
|
||||
#endif
|
||||
|
||||
LOG_CHANNEL(sys_log, "SYS");
|
||||
|
||||
[[noreturn]] extern void report_fatal_error(const std::string& text)
|
||||
{
|
||||
const bool local = s_qt_init.try_lock();
|
||||
|
@ -263,6 +265,15 @@ QCoreApplication* createApplication(int& argc, char* argv[])
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
ULONG64 intro_cycles{};
|
||||
QueryThreadCycleTime(GetCurrentThread(), &intro_cycles);
|
||||
#elif defined(RUSAGE_THREAD)
|
||||
struct ::rusage intro_stats{};
|
||||
::getrusage(RUSAGE_THREAD, &intro_stats);
|
||||
const u64 intro_time = (intro_stats.ru_utime.tv_sec + intro_stats.ru_stime.tv_sec) * 1000000000ull + (intro_stats.ru_utime.tv_usec + intro_stats.ru_stime.tv_usec) * 1000ull;
|
||||
#endif
|
||||
|
||||
s_argv0 = argv[0]; // Save for report_fatal_error
|
||||
|
||||
// Only run RPCS3 to display an error
|
||||
|
@ -354,6 +365,12 @@ int main(int argc, char** argv)
|
|||
logs::set_init({std::move(ver), std::move(os)});
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
sys_log.notice("Initialization times before main(): %fGc", intro_cycles / 1000000000.);
|
||||
#elif defined(RUSAGE_THREAD)
|
||||
sys_log.notice("Initialization times before main(): %fs", intro_time / 1000000000.);
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
struct ::rlimit rlim;
|
||||
rlim.rlim_cur = 4096;
|
||||
|
|
Loading…
Add table
Reference in a new issue