Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log "host" thread names when not on EmuThread #19664

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Common/GPU/Vulkan/VulkanLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static VulkanLibraryHandle VulkanLoadLibrary(std::string *errorString) {
return nullptr;
#elif PPSSPP_PLATFORM(UWP)
return nullptr;
#elif PPSSPP_PLATFORM(MACOS) && PPSSPP_ARCH(AMD64)
#elif PPSSPP_PLATFORM(MAC) && PPSSPP_ARCH(AMD64)
// Disable Vulkan on Mac/x86. Too many configurations that don't work with MoltenVK
// for whatever reason.
return nullptr;
Expand Down
21 changes: 18 additions & 3 deletions Common/Log/LogManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "Common/Log/StdioListener.h"
#include "Common/TimeUtil.h"
#include "Common/Thread/ThreadUtil.h"
#include "Common/File/FileUtil.h"
#include "Common/StringUtils.h"

Expand Down Expand Up @@ -254,11 +255,23 @@ void LogManager::LogLine(LogLevel level, Log type, const char *file, int line, c
file = fileshort + 1;
}

GetCurrentTimeFormatted(message.timestamp);
const char *threadName;
#if PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(MAC)
const char *hostThreadName = GetCurrentThreadName();
if (strcmp(hostThreadName, "EmuThread") != 0 || !hleCurrentThreadName) {
// Use the host thread name.
threadName = hostThreadName;
} else {
// Use the PSP HLE thread name.
threadName = hleCurrentThreadName;
}
#else
threadName = hleCurrentThreadName;
#endif

if (hleCurrentThreadName) {
if (threadName) {
snprintf(message.header, sizeof(message.header), "%-12.12s %c[%s]: %s:%d",
hleCurrentThreadName, level_to_char[(int)level],
threadName, level_to_char[(int)level],
log.m_shortName,
file, line);
} else {
Expand All @@ -267,6 +280,8 @@ void LogManager::LogLine(LogLevel level, Log type, const char *file, int line, c
log.m_shortName);
}

GetCurrentTimeFormatted(message.timestamp);

char msgBuf[1024];
va_list args_copy;

Expand Down
Loading