mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
59 lines
1.0 KiB
C++
Executable File
59 lines
1.0 KiB
C++
Executable File
#ifndef __TRACYPROFILER_HPP__
|
|
#define __TRACYPROFILER_HPP__
|
|
|
|
#include <atomic>
|
|
#include <stdint.h>
|
|
#include <thread>
|
|
|
|
#include "../common/tracy_lz4.hpp"
|
|
#include "../common/TracyQueue.hpp"
|
|
|
|
namespace tracy
|
|
{
|
|
|
|
class Socket;
|
|
|
|
class Profiler
|
|
{
|
|
public:
|
|
Profiler();
|
|
~Profiler();
|
|
|
|
static uint64_t GetNewId();
|
|
static int64_t GetTime();
|
|
|
|
static uint64_t ZoneBegin( QueueZoneBegin&& data );
|
|
static void ZoneEnd( uint64_t id, QueueZoneEnd&& data );
|
|
static void FrameMark();
|
|
|
|
static bool ShouldExit();
|
|
|
|
private:
|
|
void Worker();
|
|
|
|
bool SendData( const char* data, size_t len );
|
|
bool SendString( uint64_t ptr, const char* str, QueueType type );
|
|
|
|
bool HandleServerQuery();
|
|
|
|
void CalibrateTimer();
|
|
void CalibrateDelay();
|
|
|
|
double m_timerMul;
|
|
uint64_t m_delay;
|
|
int64_t m_timeBegin;
|
|
uint64_t m_mainThread;
|
|
std::thread m_thread;
|
|
std::atomic<bool> m_shutdown;
|
|
std::atomic<uint64_t> m_id;
|
|
std::unique_ptr<Socket> m_sock;
|
|
|
|
LZ4_stream_t* m_stream;
|
|
char* m_buffer;
|
|
int m_bufferOffset;
|
|
};
|
|
|
|
};
|
|
|
|
#endif
|