rosalina: Add define to print process creation time

This commit is contained in:
TuxSH 2022-04-23 13:03:30 +02:00
parent b79717e848
commit e17ff09713

View File

@ -42,6 +42,7 @@
typedef struct ProcessInfo
{
u32 pid;
u32 creationTimeMs;
u64 titleId;
char name[8];
bool isZombie;
@ -87,6 +88,13 @@ static inline int ProcessListMenu_FormatInfoLine(char *out, const ProcessInfo *i
}
}
else
{
#ifdef ROSALINA_PRINT_PROCESS_CREATION_TIME
sprintf(commentBuf, "%lums\n", info->creationTimeMs);
#endif
}
if (gdbServer.super.running)
GDB_UnlockAllContexts(&gdbServer);
return sprintf(out, "%s%-4lu %-8.8s %s", checkbox, info->pid, info->name, commentBuf); // Theoritically PIDs are 32-bit ints, but we'll only justify 4 digits
@ -661,7 +669,8 @@ s32 ProcessListMenu_FetchInfo(void)
for(s32 i = 0; i < processAmount; i++)
{
Handle processHandle;
Handle processHandle = 0;
s64 creationTimeTicks = 0;
Result res = svcOpenProcess(&processHandle, pidList[i]);
if(R_FAILED(res))
continue;
@ -670,6 +679,8 @@ s32 ProcessListMenu_FetchInfo(void)
svcGetProcessInfo((s64 *)&infos[i].name, processHandle, 0x10000);
svcGetProcessInfo((s64 *)&infos[i].titleId, processHandle, 0x10001);
infos[i].isZombie = svcWaitSynchronization(processHandle, 0) == 0;
svcGetHandleInfo(&creationTimeTicks, processHandle, 0);
infos[i].creationTimeMs = (u32)(1000 * creationTimeTicks / SYSCLOCK_ARM11);
svcCloseHandle(processHandle);
}