diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 866820b694..cdd6361b55 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -291,6 +291,8 @@ set(pcsx2GuiSources gui/AppMain.cpp gui/AppRes.cpp gui/ConsoleLogger.cpp + gui/CpuUsageProvider.cpp + gui/CpuUsageProviderLnx.cpp gui/Dialogs/AboutBoxDialog.cpp gui/Dialogs/AppConfigDialog.cpp gui/Dialogs/AssertionDialog.cpp @@ -342,6 +344,7 @@ set(pcsx2GuiHeaders gui/AppConfig.h gui/AppForwardDefs.h gui/ConsoleLogger.h + gui/CpuUsageProvider.h gui/Dialogs/ConfigurationDialog.h gui/Dialogs/LogOptionsDialog.h gui/Dialogs/ModalPopups.h diff --git a/pcsx2/Gif.cpp b/pcsx2/Gif.cpp index d79bb5966f..a1353b0824 100644 --- a/pcsx2/Gif.cpp +++ b/pcsx2/Gif.cpp @@ -72,7 +72,7 @@ __forceinline void gsInterrupt() { Console.Warning("gs dma masked, re-scheduling..."); // re-raise the int shortly in the future - CPU_INT( 2, 64 ); + CPU_INT( DMAC_GIF, 64 ); return; } @@ -196,7 +196,7 @@ void GIFdma() if ((gif->madr + (gif->qwc * 16)) > dmacRegs->stadr.ADDR) { - CPU_INT(2, gscycles); + CPU_INT(DMAC_GIF, gscycles); gscycles = 0; return; } @@ -213,7 +213,7 @@ void GIFdma() { // We are in image mode doing DIRECTHL, Path 1 is in queue, and in intermittant mode. GIF_LOG("Waiting VU %x, PATH2 %x, GIFMODE %x Progress %x", gifRegs->stat.P1Q, (vif1.cmd & 0x7f), gifRegs->mode._u32, Path3progress); - CPU_INT(2, 16); + CPU_INT(DMAC_GIF, 16); return; } @@ -235,14 +235,14 @@ void GIFdma() if (Path3progress == STOPPED_MODE) /*|| (vif1Regs->stat._u32 |= VIF1_STAT_VGW) == 0*/ { vif1Regs->stat.VGW = false; - if (gif->qwc == 0) CPU_INT(2, 16); + if (gif->qwc == 0) CPU_INT(DMAC_GIF, 16); return; } //Check with Path3 masking games if (gif->qwc > 0) { GIFchain(); - CPU_INT(2, gscycles * BIAS); + CPU_INT(DMAC_GIF, gscycles * BIAS); return; } //else DevCon.WriteLn("GIFdma() case 1, but qwc = 0!"); //Don't do 0 GIFchain and then return @@ -260,7 +260,7 @@ void GIFdma() //Check with Path3 masking games if (gif->qwc > 0) { GIFchain(); //Transfers the data set by the switch - CPU_INT(2, gscycles * BIAS); + CPU_INT(DMAC_GIF, gscycles * BIAS); return; } //else DevCon.WriteLn("GIFdma() case 2, but qwc = 0!"); //Don't do 0 GIFchain and then return, fixes Dual Hearts @@ -283,7 +283,7 @@ void GIFdma() prevcycles = gscycles; gif->tadr -= 16; hwDmacIrq(DMAC_STALL_SIS); - CPU_INT(2, gscycles); + CPU_INT(DMAC_GIF, gscycles); gscycles = 0; return; } @@ -305,11 +305,11 @@ void GIFdma() checkTieBit(ptag); GIF_LOG("gifdmaChain %8.8x_%8.8x size=%d, id=%d, addr=%lx", ptag[1]._u32, ptag[0]._u32, gif->qwc, ptag->ID, gif->madr); - CPU_INT(2, gscycles * BIAS); + CPU_INT(DMAC_GIF, gscycles * BIAS); } else { - CPU_INT(2, gscycles * BIAS); + CPU_INT(DMAC_GIF, gscycles * BIAS); gscycles = 0; } } diff --git a/pcsx2/Linux/pcsx2.cbp b/pcsx2/Linux/pcsx2.cbp index 954b9be5c7..5487cce122 100644 --- a/pcsx2/Linux/pcsx2.cbp +++ b/pcsx2/Linux/pcsx2.cbp @@ -351,6 +351,9 @@ + + + diff --git a/pcsx2/SPR.cpp b/pcsx2/SPR.cpp index bd11106c64..59dbc16d15 100644 --- a/pcsx2/SPR.cpp +++ b/pcsx2/SPR.cpp @@ -202,7 +202,7 @@ static __forceinline void _dmaSPR0() if (!done) { ptag = (tDMA_TAG*)&psSu32(spr0->sadr); //Set memory pointer to SADR - CPU_INT(8, ptag[0].QWC / BIAS); // the lower 16bits of the tag / BIAS); + CPU_INT(DMAC_FROM_SPR, ptag[0].QWC / BIAS); // the lower 16bits of the tag / BIAS); return; } SPR_LOG("spr0 dmaChain complete %8.8x_%8.8x size=%d, id=%d, addr=%lx spr=%lx", @@ -264,13 +264,13 @@ void dmaSPR0() // fromSPR { tDMA_TAG *ptag; ptag = (tDMA_TAG*)&psSu32(spr0->sadr); //Set memory pointer to SADR - CPU_INT(8, ptag[0].QWC / BIAS); + CPU_INT(DMAC_FROM_SPR, ptag[0].QWC / BIAS); return; } // COMPLETE HACK!!! For now at least.. FFX Videos dont rely on interrupts or reading DMA values // It merely assumes that the last one has finished then starts another one (broke with the DMA fix) // This "shouldn't" cause any problems as SPR is generally faster than the other DMAS anyway. (Refraction) - CPU_INT(8, spr0->qwc / BIAS); + CPU_INT(DMAC_FROM_SPR, spr0->qwc / BIAS); } __forceinline static void SPR1transfer(u32 *data, int size) @@ -387,7 +387,7 @@ void _dmaSPR1() // toSPR work function if (!done) { ptag = dmaGetAddr(spr1->tadr); //Set memory pointer to TADR - CPU_INT(9, (ptag[0].QWC / BIAS));// the lower 16 bits of the tag / BIAS); + CPU_INT(DMAC_TO_SPR, (ptag[0].QWC / BIAS));// the lower 16 bits of the tag / BIAS); } break; } @@ -411,13 +411,13 @@ void dmaSPR1() // toSPR { tDMA_TAG *ptag; ptag = dmaGetAddr(spr1->tadr); //Set memory pointer to TADR - CPU_INT(9, ptag[0].QWC / BIAS); + CPU_INT(DMAC_TO_SPR, ptag[0].QWC / BIAS); return; } // COMPLETE HACK!!! For now at least.. FFX Videos dont rely on interrupts or reading DMA values // It merely assumes that the last one has finished then starts another one (broke with the DMA fix) // This "shouldn't" cause any problems as SPR is generally faster than the other DMAS anyway. (Refraction) - CPU_INT(9, spr1->qwc / BIAS); + CPU_INT(DMAC_TO_SPR, spr1->qwc / BIAS); } void SPRTOinterrupt() diff --git a/pcsx2/Sif.cpp b/pcsx2/Sif.cpp index 3b13915bfc..aed8acb186 100644 --- a/pcsx2/Sif.cpp +++ b/pcsx2/Sif.cpp @@ -251,7 +251,7 @@ static __forceinline void SIF0EEend(int &cycles) sif0.end = 0; eesifbusy[0] = false; if (cycles == 0) DevCon.Warning("EESIF0cycles = 0"); // No transfer happened - else CPU_INT(5, cycles*BIAS); // Hence no Interrupt + else CPU_INT(DMAC_SIF0, cycles*BIAS); // Hence no Interrupt } static __forceinline void SIF1EEend(int &cycles) @@ -264,7 +264,7 @@ static __forceinline void SIF1EEend(int &cycles) // Other games reach like 50k cycles here, but the EE will long have given up by then and just retry. // (Cause of double interrupts on the EE) if (cycles == 0) DevCon.Warning("EESIF1cycles = 0"); // No transfer happened - else CPU_INT(6, min((int)(cycles*BIAS), 384)); // Hence no Interrupt (fixes Eternal Poison reboot when selecting new game) + else CPU_INT(DMAC_SIF1, min((int)(cycles*BIAS), 384)); // Hence no Interrupt (fixes Eternal Poison reboot when selecting new game) } static __forceinline void SIF0IOPend(int &psxCycles) diff --git a/pcsx2/Vif.cpp b/pcsx2/Vif.cpp index e9757b282a..83187ecaaf 100644 --- a/pcsx2/Vif.cpp +++ b/pcsx2/Vif.cpp @@ -151,7 +151,7 @@ _f void vif0FBRST(u32 value) { _VIF0chain(); vif0ch->chcr.STR = true; - CPU_INT(0, g_vifCycles); // Gets the timing right - Flatout + CPU_INT(DMAC_VIF0, g_vifCycles); // Gets the timing right - Flatout } } } @@ -173,7 +173,7 @@ _f void vif1FBRST(u32 value) { { vif1Regs->mskpath3 = 0; gifRegs->stat.IMT = false; - if (gif->chcr.STR) CPU_INT(2, 4); + if (gif->chcr.STR) CPU_INT(DMAC_GIF, 4); } vif1Regs->err.reset(); @@ -232,7 +232,7 @@ _f void vif1FBRST(u32 value) { case MFD_RESERVED: case MFD_GIF: // Wonder if this should be with VIF? // Gets the timing right - Flatout - CPU_INT(1, vif1ch->qwc * BIAS); + CPU_INT(DMAC_VIF1, vif1ch->qwc * BIAS); break; } diff --git a/pcsx2/Vif0_Dma.cpp b/pcsx2/Vif0_Dma.cpp index 43a19a5b87..91964c6b85 100644 --- a/pcsx2/Vif0_Dma.cpp +++ b/pcsx2/Vif0_Dma.cpp @@ -270,7 +270,7 @@ void vif0Interrupt() else _VIF0chain(); - CPU_INT(0, /*g_vifCycles*/ VifCycleVoodoo); + CPU_INT(DMAC_VIF0, /*g_vifCycles*/ VifCycleVoodoo); return; } } @@ -291,7 +291,7 @@ void vif0Interrupt() else _chainVIF0(); - CPU_INT(0, /*g_vifCycles*/ VifCycleVoodoo); + CPU_INT(DMAC_VIF0, /*g_vifCycles*/ VifCycleVoodoo); return; } @@ -325,11 +325,11 @@ void dmaVIF0() } vif0.done = true; - CPU_INT(0, /*g_vifCycles*/ VifCycleVoodoo); + CPU_INT(DMAC_VIF0, /*g_vifCycles*/ VifCycleVoodoo); return; } // Chain Mode vif0.done = false; - CPU_INT(0, 0); + CPU_INT(DMAC_VIF0, 0); } diff --git a/pcsx2/Vif1_Dma.cpp b/pcsx2/Vif1_Dma.cpp index 935c91d184..220f0c7bbe 100644 --- a/pcsx2/Vif1_Dma.cpp +++ b/pcsx2/Vif1_Dma.cpp @@ -227,7 +227,7 @@ void vif1TransferFromMemory() vif1ch->qwc = 0; vif1.done = true; - CPU_INT(1, 0); + CPU_INT(DMAC_VIF1, 0); return; //An error has occurred. } @@ -391,7 +391,7 @@ __forceinline void vif1Interrupt() { if (gif->chcr.STR) { - CPU_INT(1, gif->qwc * BIAS); + CPU_INT(DMAC_VIF1, gif->qwc * BIAS); return; } else @@ -420,14 +420,14 @@ __forceinline void vif1Interrupt() if (vif1.stallontag) vif1SetupTransfer(); else - _VIF1chain();//CPU_INT(13, vif1ch->qwc * BIAS); + _VIF1chain();//CPU_INT(DMAC_STALL_SIS, vif1ch->qwc * BIAS); } } if (vif1.inprogress & 0x1) { _VIF1chain(); - CPU_INT(1, /*g_vifCycles*/ VifCycleVoodoo); + CPU_INT(DMAC_VIF1, /*g_vifCycles*/ VifCycleVoodoo); return; } @@ -442,13 +442,13 @@ __forceinline void vif1Interrupt() if ((vif1.inprogress & 0x1) == 0) vif1SetupTransfer(); - CPU_INT(1, /*g_vifCycles*/ VifCycleVoodoo); + CPU_INT(DMAC_VIF1, /*g_vifCycles*/ VifCycleVoodoo); return; } if (vif1.vifstalled && vif1.irq) { - CPU_INT(1, 0); + CPU_INT(DMAC_VIF1, 0); return; //Dont want to end if vif is stalled. } #ifdef PCSX2_DEVBUILD diff --git a/pcsx2/Vif_Commands.cpp b/pcsx2/Vif_Commands.cpp index c091a3af85..feb0a6dfcb 100644 --- a/pcsx2/Vif_Commands.cpp +++ b/pcsx2/Vif_Commands.cpp @@ -81,7 +81,7 @@ void Vif1MskPath3() { //Let the Gif know it can transfer again (making sure any vif stall isnt unset prematurely) Path3progress = TRANSFER_MODE; gifRegs->stat.IMT = false; - CPU_INT(2, 4); + CPU_INT(DMAC_GIF, 4); } schedulepath3msk = 0; @@ -333,7 +333,7 @@ _vifT void vifCMD_FlushA() // Gif is already transferring so wait for it. if (((Path3progress != STOPPED_MODE) || !vif1Regs->mskpath3) && gif->chcr.STR) { vif1Regs->stat.VGW = true; - CPU_INT(2, 4); + CPU_INT(DMAC_GIF, 4); } vifX.cmd &= ~0x7f; diff --git a/pcsx2/gui/CpuUsageProvider.cpp b/pcsx2/gui/CpuUsageProvider.cpp index 061f38b5a1..b1127b694d 100644 --- a/pcsx2/gui/CpuUsageProvider.cpp +++ b/pcsx2/gui/CpuUsageProvider.cpp @@ -17,7 +17,11 @@ #include "CpuUsageProvider.h" #include "System.h" + +#ifndef __LINUX__ #include "SysThreads.h" +#endif + #include "GS.h" DefaultCpuUsageProvider::DefaultCpuUsageProvider()