mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #7778 from unknownbrackets/frame-profiler
Improve frame profiler display a bit more
This commit is contained in:
commit
ee1299b8f2
2 changed files with 24 additions and 10 deletions
|
@ -290,6 +290,8 @@ static void __IoFreeFd(int fd, u32 &error) {
|
|||
CoreTiming::UnscheduleEvent(syncNotifyEvent, ((u64)f->waitingSyncThreads[i] << 32) | fd);
|
||||
}
|
||||
|
||||
PROFILE_THIS_SCOPE("io_rw");
|
||||
|
||||
// Discard any pending results.
|
||||
AsyncIOResult managerResult;
|
||||
ioManager.WaitResult(f->handle, managerResult);
|
||||
|
@ -315,6 +317,8 @@ static void __IoFreeFd(int fd, u32 &error) {
|
|||
// TODO: We don't do any of that yet.
|
||||
// For now, let's at least delay the callback notification.
|
||||
static void __IoAsyncNotify(u64 userdata, int cyclesLate) {
|
||||
PROFILE_THIS_SCOPE("io_rw");
|
||||
|
||||
int fd = (int) userdata;
|
||||
|
||||
u32 error;
|
||||
|
@ -368,6 +372,8 @@ static void __IoAsyncNotify(u64 userdata, int cyclesLate) {
|
|||
}
|
||||
|
||||
static void __IoSyncNotify(u64 userdata, int cyclesLate) {
|
||||
PROFILE_THIS_SCOPE("io_rw");
|
||||
|
||||
SceUID threadID = userdata >> 32;
|
||||
int fd = (int) (userdata & 0xFFFFFFFF);
|
||||
|
||||
|
@ -616,6 +622,8 @@ static u32 sceKernelStderr() {
|
|||
}
|
||||
|
||||
u64 __IoCompleteAsyncIO(FileNode *f) {
|
||||
PROFILE_THIS_SCOPE("io_rw");
|
||||
|
||||
if (g_Config.iIOTimingMethod == IOTIMING_REALISTIC) {
|
||||
u64 finishTicks = ioManager.ResultFinishTicks(f->handle);
|
||||
if (finishTicks > CoreTiming::GetTicks()) {
|
||||
|
@ -762,7 +770,7 @@ static u32 npdrmRead(FileNode *f, u8 *data, int size) {
|
|||
}
|
||||
|
||||
static bool __IoRead(int &result, int id, u32 data_addr, int size, int &us) {
|
||||
PROFILE_THIS_SCOPE("ioread");
|
||||
PROFILE_THIS_SCOPE("io_rw");
|
||||
// Low estimate, may be improved later from the ReadFile result.
|
||||
us = size / 100;
|
||||
if (us < 100) {
|
||||
|
@ -895,6 +903,7 @@ static u32 sceIoReadAsync(int id, u32 data_addr, int size) {
|
|||
}
|
||||
|
||||
static bool __IoWrite(int &result, int id, u32 data_addr, int size, int &us) {
|
||||
PROFILE_THIS_SCOPE("io_rw");
|
||||
// Low estimate, may be improved later from the WriteFile result.
|
||||
us = size / 100;
|
||||
if (us < 100) {
|
||||
|
@ -1085,6 +1094,7 @@ static u32 npdrmLseek(FileNode *f, s32 where, FileMove whence)
|
|||
}
|
||||
|
||||
static s64 __IoLseekDest(FileNode *f, s64 offset, int whence, FileMove &seek) {
|
||||
PROFILE_THIS_SCOPE("io_rw");
|
||||
seek = FILEMOVE_BEGIN;
|
||||
|
||||
// Let's make sure this isn't incorrect mid-operation.
|
||||
|
|
|
@ -790,19 +790,19 @@ static const uint32_t nice_colors[] = {
|
|||
0xFFFF40,
|
||||
|
||||
0x40FFFF,
|
||||
0xFF40FF,
|
||||
0xFF70FF,
|
||||
0xc0c0c0,
|
||||
0x8040c0,
|
||||
0xb040c0,
|
||||
|
||||
0x990099,
|
||||
0x184099,
|
||||
0xCC3333,
|
||||
0xFF99CC,
|
||||
0x3399CC,
|
||||
|
||||
0x003366,
|
||||
0x990000,
|
||||
0x33FFFF,
|
||||
0x003366,
|
||||
0xF8F8F8,
|
||||
0x33FFFF,
|
||||
};
|
||||
|
||||
void DrawProfile(UIContext &ui) {
|
||||
|
@ -810,7 +810,7 @@ void DrawProfile(UIContext &ui) {
|
|||
int numCategories = Profiler_GetNumCategories();
|
||||
int historyLength = Profiler_GetHistoryLength();
|
||||
|
||||
float legendWidth = 100.0f;
|
||||
float legendWidth = 80.0f;
|
||||
for (int i = 0; i < numCategories; i++) {
|
||||
const char *name = Profiler_GetCategoryName(i);
|
||||
float w = 0.0f, h = 0.0f;
|
||||
|
@ -819,11 +819,13 @@ void DrawProfile(UIContext &ui) {
|
|||
legendWidth = w;
|
||||
}
|
||||
}
|
||||
legendWidth += 20.0f;
|
||||
|
||||
float legendStartY = ui.GetBounds().centerY();
|
||||
float rowH = 30.0f;
|
||||
float legendHeight = rowH * numCategories;
|
||||
float legendStartY = legendHeight > ui.GetBounds().centerY() ? ui.GetBounds().y2() - legendHeight : ui.GetBounds().centerY();
|
||||
float legendStartX = ui.GetBounds().x2() - std::min(legendWidth, 200.0f);
|
||||
|
||||
float rowH = 30;
|
||||
const uint32_t opacity = 140 << 24;
|
||||
|
||||
for (int i = 0; i < numCategories; i++) {
|
||||
|
@ -835,7 +837,7 @@ void DrawProfile(UIContext &ui) {
|
|||
ui.DrawTextShadow(name, legendStartX + rowH + 2, y, 0xFFFFFFFF, ALIGN_VBASELINE);
|
||||
}
|
||||
|
||||
float graphWidth = ui.GetBounds().x2() - 120;
|
||||
float graphWidth = ui.GetBounds().x2() - legendWidth - 20.0f;
|
||||
float graphHeight = ui.GetBounds().h * 0.8f;
|
||||
|
||||
std::vector<float> history;
|
||||
|
@ -880,12 +882,14 @@ void DrawProfile(UIContext &ui) {
|
|||
if (area)
|
||||
col = opacity | (col & 0xFFFFFF);
|
||||
UI::Drawable color(col);
|
||||
UI::Drawable outline((opacity >> 1) | 0xFFFFFF);
|
||||
|
||||
if (area) {
|
||||
for (int n = 0; n < historyLength; n++) {
|
||||
float val = history[n];
|
||||
float valY1 = ui.GetBounds().y2() - 10 - (val + total[n]) * scale;
|
||||
float valY2 = ui.GetBounds().y2() - 10 - total[n] * scale;
|
||||
ui.FillRect(outline, Bounds(x, valY2, dx, 1.0f));
|
||||
ui.FillRect(color, Bounds(x, valY1, dx, valY2 - valY1));
|
||||
x += dx;
|
||||
total[n] += val;
|
||||
|
|
Loading…
Add table
Reference in a new issue