Add system power use tracking skeleton.

This commit is contained in:
Bartosz Taudul 2023-03-09 22:31:31 +01:00
parent f428a5b52b
commit 5e2e5eeefb
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
5 changed files with 59 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include "common/tracy_lz4.cpp" #include "common/tracy_lz4.cpp"
#include "client/TracyProfiler.cpp" #include "client/TracyProfiler.cpp"
#include "client/TracyCallstack.cpp" #include "client/TracyCallstack.cpp"
#include "client/TracySysPower.cpp"
#include "client/TracySysTime.cpp" #include "client/TracySysTime.cpp"
#include "client/TracySysTrace.cpp" #include "client/TracySysTrace.cpp"
#include "common/TracySocket.cpp" #include "common/TracySocket.cpp"

View File

@ -1711,6 +1711,9 @@ void Profiler::Worker()
if( m_sock ) break; if( m_sock ) break;
#ifndef TRACY_ON_DEMAND #ifndef TRACY_ON_DEMAND
ProcessSysTime(); ProcessSysTime();
# ifdef TRACY_HAS_SYSPOWER
m_sysPower.Tick();
# endif
#endif #endif
if( m_broadcast ) if( m_broadcast )
@ -1828,6 +1831,9 @@ void Profiler::Worker()
for(;;) for(;;)
{ {
ProcessSysTime(); ProcessSysTime();
#ifdef TRACY_HAS_SYSPOWER
m_sysPower.Tick();
#endif
const auto status = Dequeue( token ); const auto status = Dequeue( token );
const auto serialStatus = DequeueSerial(); const auto serialStatus = DequeueSerial();
if( status == DequeueStatus::ConnectionLost || serialStatus == DequeueStatus::ConnectionLost ) if( status == DequeueStatus::ConnectionLost || serialStatus == DequeueStatus::ConnectionLost )

View File

@ -10,6 +10,7 @@
#include "tracy_concurrentqueue.h" #include "tracy_concurrentqueue.h"
#include "tracy_SPSCQueue.h" #include "tracy_SPSCQueue.h"
#include "TracyCallstack.hpp" #include "TracyCallstack.hpp"
#include "TracySysPower.hpp"
#include "TracySysTime.hpp" #include "TracySysTime.hpp"
#include "TracyFastVector.hpp" #include "TracyFastVector.hpp"
#include "../common/TracyQueue.hpp" #include "../common/TracyQueue.hpp"
@ -941,6 +942,10 @@ private:
void ProcessSysTime() {} void ProcessSysTime() {}
#endif #endif
#ifdef TRACY_HAS_SYSPOWER
SysPower m_sysPower;
#endif
ParameterCallback m_paramCallback; ParameterCallback m_paramCallback;
void* m_paramCallbackData; void* m_paramCallbackData;
SourceContentsCallback m_sourceCallback; SourceContentsCallback m_sourceCallback;

View File

@ -0,0 +1,22 @@
#include "TracySysPower.hpp"
#ifdef TRACY_HAS_SYSPOWER
namespace tracy
{
SysPower::SysPower()
{
}
SysPower::~SysPower()
{
}
void SysPower::Tick()
{
}
}
#endif

View File

@ -0,0 +1,25 @@
#ifndef __TRACYSYSPOWER_HPP__
#define __TRACYSYSPOWER_HPP__
#if defined __linux__
# define TRACY_HAS_SYSPOWER
#endif
#ifdef TRACY_HAS_SYSPOWER
namespace tracy
{
class SysPower
{
public:
SysPower();
~SysPower();
void Tick();
};
}
#endif
#endif