Convert rtperfomance to use new logging facility

This commit is contained in:
Azamat H. Hackimov 2024-08-20 04:22:23 +03:00
parent d8de33eb35
commit df93488815
2 changed files with 10 additions and 9 deletions

View File

@ -6,6 +6,7 @@ set(CPPS
add_library(rtperformance STATIC ${HEADERS} ${CPPS}) add_library(rtperformance STATIC ${HEADERS} ${CPPS})
target_link_libraries(rtperformance PRIVATE target_link_libraries(rtperformance PRIVATE
ddio ddio
plog::plog
) )
target_include_directories(rtperformance PUBLIC target_include_directories(rtperformance PUBLIC
$<BUILD_INTERFACE: $<BUILD_INTERFACE:

View File

@ -66,7 +66,7 @@
#include "cfile.h" #include "cfile.h"
#include "ddio.h" #include "ddio.h"
#include "manage.h" #include "manage.h"
#include "mono.h" #include "log.h"
#include "rtperformance.h" #include "rtperformance.h"
float rtp_startlog_time; float rtp_startlog_time;
@ -107,7 +107,7 @@ void rtp_WriteBufferLog() {
CFILE *file = cfopen(std::filesystem::path(LocalD3Dir) / "D3Performance.txt", "wt"); CFILE *file = cfopen(std::filesystem::path(LocalD3Dir) / "D3Performance.txt", "wt");
if (file) { if (file) {
mprintf(0, "RTP: Recording Log\n"); LOG_DEBUG << "RTP: Recording Log";
strcpy(buffer, "FrameNum,FrameTime,RenderFrameTime,MultiFrameTime,MusicFrameTime,AmbientSoundTime,WeatherFrameTime," strcpy(buffer, "FrameNum,FrameTime,RenderFrameTime,MultiFrameTime,MusicFrameTime,AmbientSoundTime,WeatherFrameTime,"
"PlayerFrameTime,DoorwayFrameTime,LevelGoalFrameTime,MatCenFrameTime,ObjectFrameTime,AIFrameAllTime," "PlayerFrameTime,DoorwayFrameTime,LevelGoalFrameTime,MatCenFrameTime,ObjectFrameTime,AIFrameAllTime,"
@ -202,7 +202,7 @@ void rtp_WriteBufferLog() {
// Close the log file // Close the log file
cfclose(file); cfclose(file);
} else } else
mprintf(0, "RTP: Unable to open log for writing\n"); LOG_DEBUG << "RTP: Unable to open log for writing";
#endif #endif
} }
@ -256,7 +256,7 @@ void rtp_Init() {
LARGE_INTEGER freq; LARGE_INTEGER freq;
if (!QueryPerformanceFrequency(&freq)) { if (!QueryPerformanceFrequency(&freq)) {
// there is no hi-res clock available....ummmm // there is no hi-res clock available....ummmm
mprintf(0, "RTP: No Hi-Resolution clock available on this system!!!!!!\n"); LOG_DEBUG << "RTP: No Hi-Resolution clock available on this system!!!!!!";
// well, this isn't good...what to do, what to do? // well, this isn't good...what to do, what to do?
} }
@ -307,7 +307,7 @@ void rtp_StartLog
*/ */
void rtp_StartLog() { void rtp_StartLog() {
#ifdef USE_RTP #ifdef USE_RTP
mprintf(0, "RTP: Starting Log\n"); LOG_DEBUG << "RTP: Starting Log";
Runtime_performance_counter = 0; Runtime_performance_counter = 0;
Runtime_performance_enabled = 1; Runtime_performance_enabled = 1;
memset(&RTP_SingleFrame, 0, sizeof(tRTFrameInfo)); memset(&RTP_SingleFrame, 0, sizeof(tRTFrameInfo));
@ -322,8 +322,8 @@ void rtp_StopLog
*/ */
void rtp_StopLog() { void rtp_StopLog() {
#ifdef USE_RTP #ifdef USE_RTP
mprintf(0, "Recorded performance for %f seconds\n", timer_GetTime() - rtp_startlog_time); LOG_DEBUG.printf("Recorded performance for %f seconds", timer_GetTime() - rtp_startlog_time);
mprintf(0, "RTP: Stopping Log\n"); LOG_DEBUG << "RTP: Stopping Log";
// Save out the log now // Save out the log now
rtp_WriteBufferLog(); rtp_WriteBufferLog();
@ -338,7 +338,7 @@ void rtp_PauseLog
*/ */
void rtp_PauseLog() { void rtp_PauseLog() {
#ifdef USE_RTP #ifdef USE_RTP
mprintf(0, "RTP: Pausing Log\n"); LOG_DEBUG << "RTP: Pausing Log";
Runtime_performance_enabled = 0; Runtime_performance_enabled = 0;
#endif #endif
} }
@ -349,7 +349,7 @@ void rtp_ResumeLog
*/ */
void rtp_ResumeLog() { void rtp_ResumeLog() {
#ifdef USE_RTP #ifdef USE_RTP
mprintf(0, "RTP: Resuming Log\n"); LOG_DEBUG << "RTP: Resuming Log";
Runtime_performance_enabled = 1; Runtime_performance_enabled = 1;
#endif #endif
} }