tracy: added PthreadMutex markup
This commit is contained in:
parent
142ad54876
commit
a0fe34b01f
|
@ -51,4 +51,7 @@ enum MarkersPallete : int {
|
||||||
#define GPU_SCOPE_LOCATION(name, color) \
|
#define GPU_SCOPE_LOCATION(name, color) \
|
||||||
tracy::SourceLocationData{name, TracyFunction, TracyFile, (uint32_t)TracyLine, color};
|
tracy::SourceLocationData{name, TracyFunction, TracyFile, (uint32_t)TracyLine, color};
|
||||||
|
|
||||||
|
#define MUTEX_LOCATION(name) \
|
||||||
|
tracy::SourceLocationData{nullptr, name, TracyFile, (uint32_t)TracyLine, 0};
|
||||||
|
|
||||||
#define FRAME_END FrameMark
|
#define FRAME_END FrameMark
|
||||||
|
|
|
@ -429,7 +429,11 @@ int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMut
|
||||||
|
|
||||||
int result = pthread_mutex_init(&(*mutex)->pth_mutex, &(*attr)->pth_mutex_attr);
|
int result = pthread_mutex_init(&(*mutex)->pth_mutex, &(*attr)->pth_mutex_attr);
|
||||||
|
|
||||||
|
static auto mutex_loc = MUTEX_LOCATION("mutex");
|
||||||
|
(*mutex)->tracy_lock = std::make_unique<tracy::LockableCtx>(&mutex_loc);
|
||||||
|
|
||||||
if (name != nullptr) {
|
if (name != nullptr) {
|
||||||
|
(*mutex)->tracy_lock->CustomName(name, std::strlen(name));
|
||||||
LOG_INFO(Kernel_Pthread, "name={}, result={}", name, result);
|
LOG_INFO(Kernel_Pthread, "name={}, result={}", name, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,10 +545,15 @@ int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*mutex)->tracy_lock->BeforeLock();
|
||||||
|
|
||||||
int result = pthread_mutex_lock(&(*mutex)->pth_mutex);
|
int result = pthread_mutex_lock(&(*mutex)->pth_mutex);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_TRACE(Kernel_Pthread, "Locked name={}, result={}", (*mutex)->name, result);
|
LOG_TRACE(Kernel_Pthread, "Locked name={}, result={}", (*mutex)->name, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*mutex)->tracy_lock->AfterLock();
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case 0:
|
case 0:
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
|
@ -569,6 +578,9 @@ int PS4_SYSV_ABI scePthreadMutexUnlock(ScePthreadMutex* mutex) {
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_TRACE(Kernel_Pthread, "Unlocking name={}, result={}", (*mutex)->name, result);
|
LOG_TRACE(Kernel_Pthread, "Unlocking name={}, result={}", (*mutex)->name, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*mutex)->tracy_lock->AfterUnlock();
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case 0:
|
case 0:
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
|
@ -1099,6 +1111,9 @@ int PS4_SYSV_ABI scePthreadMutexTrylock(ScePthreadMutex* mutex) {
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_TRACE(Kernel_Pthread, "name={}, result={}", (*mutex)->name, result);
|
LOG_TRACE(Kernel_Pthread, "name={}, result={}", (*mutex)->name, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*mutex)->tracy_lock->AfterTryLock(result == 0);
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case 0:
|
case 0:
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
#include "common/debug.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
namespace Core::Loader {
|
namespace Core::Loader {
|
||||||
|
@ -72,6 +73,7 @@ struct PthreadMutexInternal {
|
||||||
u8 reserved[256];
|
u8 reserved[256];
|
||||||
std::string name;
|
std::string name;
|
||||||
pthread_mutex_t pth_mutex;
|
pthread_mutex_t pth_mutex;
|
||||||
|
std::unique_ptr<tracy::LockableCtx> tracy_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PthreadMutexattrInternal {
|
struct PthreadMutexattrInternal {
|
||||||
|
|
Loading…
Reference in New Issue