tracy/server/TracyWorker.hpp

683 lines
29 KiB
C++
Raw Normal View History

#ifndef __TRACYWORKER_HPP__
#define __TRACYWORKER_HPP__
#include <atomic>
#include <condition_variable>
#include <limits>
#include <mutex>
#include <shared_mutex>
#include <stdexcept>
#include <string>
2019-10-24 21:03:13 +00:00
#include <string.h>
#include <thread>
#include <vector>
#include "../common/tracy_lz4.hpp"
#include "../common/TracyForceInline.hpp"
#include "../common/TracyQueue.hpp"
2019-04-01 17:17:18 +00:00
#include "../common/TracyProtocol.hpp"
#include "../common/TracySocket.hpp"
#include "tracy_flat_hash_map.hpp"
#include "TracyEvent.hpp"
2019-11-02 14:52:34 +00:00
#include "TracyShortPtr.hpp"
#include "TracySlab.hpp"
2018-08-04 14:33:03 +00:00
#include "TracyStringDiscovery.hpp"
#include "TracyThreadCompress.hpp"
2018-06-19 19:15:36 +00:00
#include "TracyVarArray.hpp"
namespace tracy
{
class FileRead;
class FileWrite;
2018-04-20 14:03:09 +00:00
namespace EventType
{
enum Type : uint32_t
{
2019-08-12 22:56:57 +00:00
Locks = 1 << 0,
Messages = 1 << 1,
Plots = 1 << 2,
Memory = 1 << 3,
FrameImages = 1 << 4,
ContextSwitches = 1 << 5,
2018-04-20 14:03:09 +00:00
2019-08-12 22:56:57 +00:00
None = 0,
All = std::numeric_limits<uint32_t>::max()
2018-04-20 14:03:09 +00:00
};
}
struct UnsupportedVersion : public std::exception
{
UnsupportedVersion( int version ) : version( version ) {}
int version;
};
2019-08-12 10:16:48 +00:00
struct LegacyVersion : public std::exception
{
LegacyVersion( int version ) : version ( version ) {}
int version;
};
2018-07-28 15:59:17 +00:00
struct LoadProgress
{
enum Stage
{
Initialization,
Locks,
Messages,
Zones,
GpuZones,
Plots,
Memory,
2019-06-06 21:40:37 +00:00
CallStacks,
2019-08-12 22:56:57 +00:00
FrameImages,
2019-08-16 14:51:02 +00:00
ContextSwitches,
ContextSwitchesPerCpu
};
2018-07-28 18:13:06 +00:00
LoadProgress() : total( 0 ), progress( 0 ), subTotal( 0 ), subProgress( 0 ) {}
std::atomic<uint64_t> total;
std::atomic<uint64_t> progress;
std::atomic<uint64_t> subTotal;
std::atomic<uint64_t> subProgress;
2018-07-28 15:59:17 +00:00
};
class Worker
{
public:
#pragma pack( 1 )
struct ZoneThreadData
{
2019-10-29 00:32:09 +00:00
tracy_force_inline ZoneEvent* Zone() const { return (ZoneEvent*)( _zone_thread >> 16 ); }
tracy_force_inline void SetZone( ZoneEvent* zone ) { assert( ( uint64_t( zone ) & 0xFFFF000000000000 ) == 0 ); memcpy( ((char*)&_zone_thread)+2, &zone, 4 ); memcpy( ((char*)&_zone_thread)+6, ((char*)&zone)+4, 2 ); }
tracy_force_inline uint16_t Thread() const { return uint16_t( _zone_thread & 0xFFFF ); }
tracy_force_inline void SetThread( uint16_t thread ) { memcpy( &_zone_thread, &thread, 2 ); }
uint64_t _zone_thread;
};
enum { ZoneThreadDataSize = sizeof( ZoneThreadData ) };
#pragma pack()
private:
struct SourceLocationZones
{
Vector<ZoneThreadData> zones;
int64_t min = std::numeric_limits<int64_t>::max();
int64_t max = std::numeric_limits<int64_t>::min();
int64_t total = 0;
double sumSq = 0;
int64_t selfMin = std::numeric_limits<int64_t>::max();
int64_t selfMax = std::numeric_limits<int64_t>::min();
int64_t selfTotal = 0;
};
struct CallstackFrameIdHash
{
2019-03-03 16:54:00 +00:00
size_t operator()( const CallstackFrameId& id ) const { return id.data; }
typedef tracy::power_of_two_hash_policy hash_policy;
};
struct CallstackFrameIdCompare
{
2019-03-03 16:54:00 +00:00
bool operator()( const CallstackFrameId& lhs, const CallstackFrameId& rhs ) const { return lhs.data == rhs.data; }
};
2019-03-03 16:34:56 +00:00
struct RevFrameHash
{
2019-03-03 16:54:00 +00:00
size_t operator()( const CallstackFrameData* data ) const
2019-03-03 16:34:56 +00:00
{
size_t hash = data->size;
for( uint8_t i=0; i<data->size; i++ )
{
const auto& v = data->data[i];
hash = ( ( hash << 5 ) + hash ) ^ size_t( v.line );
hash = ( ( hash << 5 ) + hash ) ^ size_t( v.file.Idx() );
hash = ( ( hash << 5 ) + hash ) ^ size_t( v.name.Idx() );
2019-03-03 16:34:56 +00:00
}
return hash;
}
typedef tracy::power_of_two_hash_policy hash_policy;
};
struct RevFrameComp
{
2019-03-03 16:54:00 +00:00
bool operator()( const CallstackFrameData* lhs, const CallstackFrameData* rhs ) const
2019-03-03 16:34:56 +00:00
{
if( lhs->size != rhs->size ) return false;
for( uint8_t i=0; i<lhs->size; i++ )
{
if( memcmp( lhs->data + i, rhs->data + i, sizeof( CallstackFrame ) ) != 0 ) return false;
}
return true;
}
};
struct DataBlock
{
std::shared_mutex lock;
2018-08-04 17:47:09 +00:00
StringDiscovery<FrameData*> frames;
FrameData* framesBase;
Vector<GpuCtxData*> gpuData;
2019-11-02 15:32:42 +00:00
Vector<short_ptr<MessageData>> messages;
2018-08-04 14:33:03 +00:00
StringDiscovery<PlotData*> plots;
Vector<ThreadData*> threads;
2018-04-01 00:03:34 +00:00
MemData memory;
2019-10-13 12:13:04 +00:00
uint64_t zonesCnt = 0;
uint64_t gpuCnt = 0;
int64_t baseTime = 0;
int64_t lastTime = 0;
uint64_t frameOffset = 0;
flat_hash_map<uint64_t, const char*, nohash<uint64_t>> strings;
Vector<const char*> stringData;
2019-02-12 19:23:14 +00:00
flat_hash_map<charutil::StringKey, uint32_t, charutil::StringKey::HasherPOT, charutil::StringKey::Comparator> stringMap;
flat_hash_map<uint64_t, const char*, nohash<uint64_t>> threadNames;
2019-08-16 17:49:16 +00:00
flat_hash_map<uint64_t, std::pair<const char*, const char*>, nohash<uint64_t>> externalNames;
flat_hash_map<uint64_t, SourceLocation, nohash<uint64_t>> sourceLocation;
Vector<short_ptr<SourceLocation>> sourceLocationPayload;
flat_hash_map<const SourceLocation*, int16_t, SourceLocationHasher, SourceLocationComparator> sourceLocationPayloadMap;
Vector<uint64_t> sourceLocationExpand;
#ifndef TRACY_NO_STATISTICS
flat_hash_map<int16_t, SourceLocationZones, nohash<int16_t>> sourceLocationZones;
bool sourceLocationZonesReady;
2018-07-29 12:16:13 +00:00
#else
flat_hash_map<int16_t, uint64_t> sourceLocationZonesCnt;
#endif
flat_hash_map<VarArray<CallstackFrameId>*, uint32_t, VarArrayHasherPOT<CallstackFrameId>, VarArrayComparator<CallstackFrameId>> callstackMap;
Vector<short_ptr<VarArray<CallstackFrameId>>> callstackPayload;
flat_hash_map<CallstackFrameId, CallstackFrameData*, CallstackFrameIdHash, CallstackFrameIdCompare> callstackFrameMap;
2019-03-03 16:34:56 +00:00
flat_hash_map<CallstackFrameData*, CallstackFrameId, RevFrameHash, RevFrameComp> revFrameMap;
2018-06-19 19:15:36 +00:00
flat_hash_map<uint32_t, LockMap*, nohash<uint32_t>> lockMap;
2018-03-18 19:45:22 +00:00
ThreadCompress localThreadCompress;
ThreadCompress externalThreadCompress;
Store children vectors in a separate data collection. This reduces per-zone memory cost by 9 bytes if there are no children and increases it by 4 bytes, if there are children. This is universally a better solution, as the following data shows: +++ /home/wolf/desktop/tracy-old/android.tracy +++ Vectors: 2794480 Size 0: 2373070 (84.92%) Size 1: 70237 (2.51%) Size 2+: 351173 (12.57%) +++ /home/wolf/desktop/tracy-old/asset-new.tracy +++ Vectors: 1799227 Size 0: 1482691 (82.41%) Size 1: 93272 (5.18%) Size 2+: 223264 (12.41%) +++ /home/wolf/desktop/tracy-old/asset-new-id.tracy +++ Vectors: 1977996 Size 0: 1640817 (82.95%) Size 1: 97198 (4.91%) Size 2+: 239981 (12.13%) +++ /home/wolf/desktop/tracy-old/asset-old.tracy +++ Vectors: 1782395 Size 0: 1471437 (82.55%) Size 1: 88813 (4.98%) Size 2+: 222145 (12.46%) +++ /home/wolf/desktop/tracy-old/big.tracy +++ Vectors: 180794047 Size 0: 172696094 (95.52%) Size 1: 2799772 (1.55%) Size 2+: 5298181 (2.93%) +++ /home/wolf/desktop/tracy-old/darkrl.tracy +++ Vectors: 12014129 Size 0: 11611324 (96.65%) Size 1: 134980 (1.12%) Size 2+: 267825 (2.23%) +++ /home/wolf/desktop/tracy-old/mem.tracy +++ Vectors: 383097 Size 0: 321932 (84.03%) Size 1: 854 (0.22%) Size 2+: 60311 (15.74%) +++ /home/wolf/desktop/tracy-old/new.tracy +++ Vectors: 77536 Size 0: 63035 (81.30%) Size 1: 8886 (11.46%) Size 2+: 5615 (7.24%) +++ /home/wolf/desktop/tracy-old/selfprofile.tracy +++ Vectors: 22940871 Size 0: 22704868 (98.97%) Size 1: 73000 (0.32%) Size 2+: 163003 (0.71%) +++ /home/wolf/desktop/tracy-old/tbrowser.tracy +++ Vectors: 962682 Size 0: 695380 (72.23%) Size 1: 43007 (4.47%) Size 2+: 224295 (23.30%) +++ /home/wolf/desktop/tracy-old/virtualfile_hc.tracy +++ Vectors: 529170 Size 0: 449386 (84.92%) Size 1: 15694 (2.97%) Size 2+: 64090 (12.11%) +++ /home/wolf/desktop/tracy-old/zfile_hc.tracy +++ Vectors: 264849 Size 0: 220589 (83.29%) Size 1: 9386 (3.54%) Size 2+: 34874 (13.17%)
2018-07-22 14:05:50 +00:00
2019-11-02 15:17:20 +00:00
Vector<Vector<short_ptr<ZoneEvent>>> zoneChildren;
2019-11-02 14:52:34 +00:00
Vector<Vector<short_ptr<GpuEvent>>> gpuChildren;
2018-08-20 00:07:31 +00:00
2019-11-02 15:17:20 +00:00
Vector<Vector<short_ptr<ZoneEvent>>> zoneVectorCache;
2019-11-02 15:34:02 +00:00
Vector<short_ptr<FrameImage>> frameImage;
2019-07-12 16:30:45 +00:00
Vector<StringRef> appInfo;
2019-06-06 19:39:54 +00:00
2019-03-26 20:41:44 +00:00
CrashEvent crashEvent;
2019-08-12 22:13:50 +00:00
flat_hash_map<uint64_t, ContextSwitch*, nohash<uint64_t>> ctxSwitch;
2019-08-16 14:28:58 +00:00
CpuData cpuData[256];
int cpuDataCount = 0;
2019-08-17 20:32:41 +00:00
flat_hash_map<uint64_t, uint64_t, nohash<uint64_t>> tidToPid;
2019-08-17 23:50:49 +00:00
flat_hash_map<uint64_t, CpuThreadData, nohash<uint64_t>> cpuThreadData;
2019-10-25 16:16:27 +00:00
2019-10-25 17:19:35 +00:00
std::pair<uint64_t, ThreadData*> threadDataLast = std::make_pair( std::numeric_limits<uint64_t>::max(), nullptr );
std::pair<uint64_t, ContextSwitch*> ctxSwitchLast = std::make_pair( std::numeric_limits<uint64_t>::max(), nullptr );
uint64_t checkSrclocLast = 0;
2019-10-25 19:07:28 +00:00
std::pair<uint64_t, uint16_t> shrinkSrclocLast = std::make_pair( std::numeric_limits<uint64_t>::max(), 0 );
#ifndef TRACY_NO_STATISTICS
std::pair<uint16_t, SourceLocationZones*> srclocZonesLast = std::make_pair( std::numeric_limits<uint16_t>::max(), nullptr );
#else
std::pair<uint16_t, uint64_t*> srclocCntLast = std::make_pair( std::numeric_limits<uint16_t>::max(), nullptr );
#endif
};
struct MbpsBlock
{
2019-10-23 22:47:16 +00:00
MbpsBlock() : mbps( 64 ), compRatio( 1.0 ), queue( 0 ), transferred( 0 ) {}
std::shared_mutex lock;
std::vector<float> mbps;
float compRatio;
2019-04-01 17:55:37 +00:00
size_t queue;
2019-10-23 22:47:16 +00:00
uint64_t transferred;
};
enum class NextCallstackType
{
Zone,
2018-08-20 00:07:31 +00:00
Gpu,
Crash
};
struct NextCallstack
{
NextCallstackType type;
union
{
ZoneEvent* zone;
GpuEvent* gpu;
};
};
2019-01-14 22:22:31 +00:00
struct FailureData
{
uint64_t thread;
int16_t srcloc;
2019-01-14 22:22:31 +00:00
};
public:
2019-01-14 22:22:31 +00:00
enum class Failure
{
None,
ZoneStack,
2019-01-15 23:45:48 +00:00
ZoneEnd,
ZoneText,
ZoneName,
MemFree,
FrameEnd,
FrameImageIndex,
FrameImageTwice,
NUM_FAILURES
2019-01-14 22:22:31 +00:00
};
Worker( const char* addr, int port );
Worker( FileRead& f, EventType::Type eventMask = EventType::All, bool bgTasks = true );
~Worker();
const std::string& GetAddr() const { return m_addr; }
const std::string& GetCaptureName() const { return m_captureName; }
const std::string& GetCaptureProgram() const { return m_captureProgram; }
uint64_t GetCaptureTime() const { return m_captureTime; }
2018-08-19 16:24:43 +00:00
const std::string& GetHostInfo() const { return m_hostInfo; }
int64_t GetDelay() const { return m_delay; }
int64_t GetResolution() const { return m_resolution; }
2019-08-17 20:19:04 +00:00
uint64_t GetPid() const { return m_pid; };
std::shared_mutex& GetDataLock() { return m_data.lock; }
2018-08-04 17:47:09 +00:00
size_t GetFrameCount( const FrameData& fd ) const { return fd.frames.size(); }
2018-09-01 10:38:12 +00:00
size_t GetFullFrameCount( const FrameData& fd ) const;
int64_t GetLastTime() const { return m_data.lastTime; }
uint64_t GetZoneCount() const { return m_data.zonesCnt; }
2019-10-13 12:13:28 +00:00
uint64_t GetGpuZoneCount() const { return m_data.gpuCnt; }
2018-08-08 17:21:53 +00:00
uint64_t GetLockCount() const;
uint64_t GetPlotCount() const;
uint64_t GetContextSwitchCount() const;
uint64_t GetContextSwitchPerCpuCount() const;
bool HasContextSwitches() const { return !m_data.ctxSwitch.empty(); }
2018-08-14 14:36:25 +00:00
uint64_t GetSrcLocCount() const { return m_data.sourceLocationPayload.size() + m_data.sourceLocation.size(); }
uint64_t GetCallstackPayloadCount() const { return m_data.callstackPayload.size() - 1; }
uint64_t GetCallstackFrameCount() const { return m_data.callstackFrameMap.size(); }
2019-06-22 12:11:45 +00:00
uint32_t GetFrameImageCount() const { return (uint32_t)m_data.frameImage.size(); }
2019-09-29 17:22:15 +00:00
uint64_t GetStringsCount() const { return m_data.strings.size() + m_data.stringData.size(); }
2018-07-10 20:39:41 +00:00
uint64_t GetFrameOffset() const { return m_data.frameOffset; }
2018-08-04 17:47:09 +00:00
const FrameData* GetFramesBase() const { return m_data.framesBase; }
2018-08-04 18:58:49 +00:00
const Vector<FrameData*>& GetFrames() const { return m_data.frames.Data(); }
2019-08-14 18:16:11 +00:00
const ContextSwitch* const GetContextSwitchData( uint64_t thread )
{
if( m_data.ctxSwitchLast.first == thread ) return m_data.ctxSwitchLast.second;
return GetContextSwitchDataImpl( thread );
}
2019-08-16 14:30:00 +00:00
const CpuData* GetCpuData() const { return m_data.cpuData; }
int GetCpuDataCpuCount() const { return m_data.cpuDataCount; }
2019-08-17 23:51:02 +00:00
uint64_t GetPidFromTid( uint64_t tid ) const;
const flat_hash_map<uint64_t, CpuThreadData, nohash<uint64_t>>& GetCpuThreadData() const { return m_data.cpuThreadData; }
void GetCpuUsageAtTime( int64_t time, int& own, int& other ) const;
2018-08-04 17:47:09 +00:00
int64_t GetFrameTime( const FrameData& fd, size_t idx ) const;
int64_t GetFrameBegin( const FrameData& fd, size_t idx ) const;
int64_t GetFrameEnd( const FrameData& fd, size_t idx ) const;
2019-06-06 19:48:01 +00:00
const FrameImage* GetFrameImage( const FrameData& fd, size_t idx ) const;
2019-06-22 12:05:18 +00:00
std::pair<int, int> GetFrameRange( const FrameData& fd, int64_t from, int64_t to );
const flat_hash_map<uint32_t, LockMap*, nohash<uint32_t>>& GetLockMap() const { return m_data.lockMap; }
2019-11-02 15:32:42 +00:00
const Vector<short_ptr<MessageData>>& GetMessages() const { return m_data.messages; }
const Vector<GpuCtxData*>& GetGpuData() const { return m_data.gpuData; }
2018-08-04 14:33:03 +00:00
const Vector<PlotData*>& GetPlots() const { return m_data.plots.Data(); }
const Vector<ThreadData*>& GetThreadData() const { return m_data.threads; }
2019-09-08 12:07:16 +00:00
const ThreadData* GetThreadData( uint64_t tid ) const;
2018-04-01 18:25:09 +00:00
const MemData& GetMemData() const { return m_data.memory; }
2019-11-02 15:34:02 +00:00
const Vector<short_ptr<FrameImage>>& GetFrameImages() const { return m_data.frameImage; }
const Vector<StringRef>& GetAppInfo() const { return m_data.appInfo; }
2018-06-19 23:18:59 +00:00
const VarArray<CallstackFrameId>& GetCallstack( uint32_t idx ) const { return *m_data.callstackPayload[idx]; }
const CallstackFrameData* GetCallstackFrame( const CallstackFrameId& ptr ) const;
uint64_t GetCanonicalPointer( const CallstackFrameId& id ) const;
2019-03-26 20:41:44 +00:00
const CrashEvent& GetCrashEvent() const { return m_data.crashEvent; }
2018-03-18 01:53:00 +00:00
// Some zones may have incomplete timing data (only start time is available, end hasn't arrived yet).
// GetZoneEnd() will try to infer the end time by looking at child zones (parent zone can't end
// before its children have ended).
// GetZoneEndDirect() will only return zone's direct timing data, without looking at children.
Store children vectors in a separate data collection. This reduces per-zone memory cost by 9 bytes if there are no children and increases it by 4 bytes, if there are children. This is universally a better solution, as the following data shows: +++ /home/wolf/desktop/tracy-old/android.tracy +++ Vectors: 2794480 Size 0: 2373070 (84.92%) Size 1: 70237 (2.51%) Size 2+: 351173 (12.57%) +++ /home/wolf/desktop/tracy-old/asset-new.tracy +++ Vectors: 1799227 Size 0: 1482691 (82.41%) Size 1: 93272 (5.18%) Size 2+: 223264 (12.41%) +++ /home/wolf/desktop/tracy-old/asset-new-id.tracy +++ Vectors: 1977996 Size 0: 1640817 (82.95%) Size 1: 97198 (4.91%) Size 2+: 239981 (12.13%) +++ /home/wolf/desktop/tracy-old/asset-old.tracy +++ Vectors: 1782395 Size 0: 1471437 (82.55%) Size 1: 88813 (4.98%) Size 2+: 222145 (12.46%) +++ /home/wolf/desktop/tracy-old/big.tracy +++ Vectors: 180794047 Size 0: 172696094 (95.52%) Size 1: 2799772 (1.55%) Size 2+: 5298181 (2.93%) +++ /home/wolf/desktop/tracy-old/darkrl.tracy +++ Vectors: 12014129 Size 0: 11611324 (96.65%) Size 1: 134980 (1.12%) Size 2+: 267825 (2.23%) +++ /home/wolf/desktop/tracy-old/mem.tracy +++ Vectors: 383097 Size 0: 321932 (84.03%) Size 1: 854 (0.22%) Size 2+: 60311 (15.74%) +++ /home/wolf/desktop/tracy-old/new.tracy +++ Vectors: 77536 Size 0: 63035 (81.30%) Size 1: 8886 (11.46%) Size 2+: 5615 (7.24%) +++ /home/wolf/desktop/tracy-old/selfprofile.tracy +++ Vectors: 22940871 Size 0: 22704868 (98.97%) Size 1: 73000 (0.32%) Size 2+: 163003 (0.71%) +++ /home/wolf/desktop/tracy-old/tbrowser.tracy +++ Vectors: 962682 Size 0: 695380 (72.23%) Size 1: 43007 (4.47%) Size 2+: 224295 (23.30%) +++ /home/wolf/desktop/tracy-old/virtualfile_hc.tracy +++ Vectors: 529170 Size 0: 449386 (84.92%) Size 1: 15694 (2.97%) Size 2+: 64090 (12.11%) +++ /home/wolf/desktop/tracy-old/zfile_hc.tracy +++ Vectors: 264849 Size 0: 220589 (83.29%) Size 1: 9386 (3.54%) Size 2+: 34874 (13.17%)
2018-07-22 14:05:50 +00:00
int64_t GetZoneEnd( const ZoneEvent& ev );
int64_t GetZoneEnd( const GpuEvent& ev );
static tracy_force_inline int64_t GetZoneEndDirect( const ZoneEvent& ev ) { return ev.End() >= 0 ? ev.End() : ev.Start(); }
static tracy_force_inline int64_t GetZoneEndDirect( const GpuEvent& ev ) { return ev.GpuEnd() >= 0 ? ev.GpuEnd() : ev.GpuStart(); }
2018-03-18 01:53:00 +00:00
const char* GetString( uint64_t ptr ) const;
const char* GetString( const StringRef& ref ) const;
const char* GetString( const StringIdx& idx ) const;
const char* GetThreadName( uint64_t id ) const;
bool IsThreadLocal( uint64_t id ) const;
const SourceLocation& GetSourceLocation( int16_t srcloc ) const;
2019-08-16 17:49:16 +00:00
std::pair<const char*, const char*> GetExternalName( uint64_t id ) const;
const char* GetZoneName( const SourceLocation& srcloc ) const;
const char* GetZoneName( const ZoneEvent& ev ) const;
const char* GetZoneName( const ZoneEvent& ev, const SourceLocation& srcloc ) const;
const char* GetZoneName( const GpuEvent& ev ) const;
const char* GetZoneName( const GpuEvent& ev, const SourceLocation& srcloc ) const;
2019-11-02 15:17:20 +00:00
tracy_force_inline const Vector<short_ptr<ZoneEvent>>& GetZoneChildren( int32_t idx ) const { return m_data.zoneChildren[idx]; }
2019-11-02 14:52:34 +00:00
tracy_force_inline const Vector<short_ptr<GpuEvent>>& GetGpuChildren( int32_t idx ) const { return m_data.gpuChildren[idx]; }
Store children vectors in a separate data collection. This reduces per-zone memory cost by 9 bytes if there are no children and increases it by 4 bytes, if there are children. This is universally a better solution, as the following data shows: +++ /home/wolf/desktop/tracy-old/android.tracy +++ Vectors: 2794480 Size 0: 2373070 (84.92%) Size 1: 70237 (2.51%) Size 2+: 351173 (12.57%) +++ /home/wolf/desktop/tracy-old/asset-new.tracy +++ Vectors: 1799227 Size 0: 1482691 (82.41%) Size 1: 93272 (5.18%) Size 2+: 223264 (12.41%) +++ /home/wolf/desktop/tracy-old/asset-new-id.tracy +++ Vectors: 1977996 Size 0: 1640817 (82.95%) Size 1: 97198 (4.91%) Size 2+: 239981 (12.13%) +++ /home/wolf/desktop/tracy-old/asset-old.tracy +++ Vectors: 1782395 Size 0: 1471437 (82.55%) Size 1: 88813 (4.98%) Size 2+: 222145 (12.46%) +++ /home/wolf/desktop/tracy-old/big.tracy +++ Vectors: 180794047 Size 0: 172696094 (95.52%) Size 1: 2799772 (1.55%) Size 2+: 5298181 (2.93%) +++ /home/wolf/desktop/tracy-old/darkrl.tracy +++ Vectors: 12014129 Size 0: 11611324 (96.65%) Size 1: 134980 (1.12%) Size 2+: 267825 (2.23%) +++ /home/wolf/desktop/tracy-old/mem.tracy +++ Vectors: 383097 Size 0: 321932 (84.03%) Size 1: 854 (0.22%) Size 2+: 60311 (15.74%) +++ /home/wolf/desktop/tracy-old/new.tracy +++ Vectors: 77536 Size 0: 63035 (81.30%) Size 1: 8886 (11.46%) Size 2+: 5615 (7.24%) +++ /home/wolf/desktop/tracy-old/selfprofile.tracy +++ Vectors: 22940871 Size 0: 22704868 (98.97%) Size 1: 73000 (0.32%) Size 2+: 163003 (0.71%) +++ /home/wolf/desktop/tracy-old/tbrowser.tracy +++ Vectors: 962682 Size 0: 695380 (72.23%) Size 1: 43007 (4.47%) Size 2+: 224295 (23.30%) +++ /home/wolf/desktop/tracy-old/virtualfile_hc.tracy +++ Vectors: 529170 Size 0: 449386 (84.92%) Size 1: 15694 (2.97%) Size 2+: 64090 (12.11%) +++ /home/wolf/desktop/tracy-old/zfile_hc.tracy +++ Vectors: 264849 Size 0: 220589 (83.29%) Size 1: 9386 (3.54%) Size 2+: 34874 (13.17%)
2018-07-22 14:05:50 +00:00
std::vector<int16_t> GetMatchingSourceLocation( const char* query, bool ignoreCase ) const;
#ifndef TRACY_NO_STATISTICS
const SourceLocationZones& GetZonesForSourceLocation( int16_t srcloc ) const;
const flat_hash_map<int16_t, SourceLocationZones, nohash<int16_t>>& GetSourceLocationZones() const { return m_data.sourceLocationZones; }
bool AreSourceLocationZonesReady() const { return m_data.sourceLocationZonesReady; }
#endif
tracy_force_inline uint16_t CompressThread( uint64_t thread ) { return m_data.localThreadCompress.CompressThread( thread ); }
tracy_force_inline uint64_t DecompressThread( uint16_t thread ) const { return m_data.localThreadCompress.DecompressThread( thread ); }
tracy_force_inline uint64_t DecompressThreadExternal( uint16_t thread ) const { return m_data.externalThreadCompress.DecompressThread( thread ); }
2018-03-18 19:45:22 +00:00
std::shared_mutex& GetMbpsDataLock() { return m_mbpsData.lock; }
const std::vector<float>& GetMbpsData() const { return m_mbpsData.mbps; }
float GetCompRatio() const { return m_mbpsData.compRatio; }
2019-04-01 17:55:37 +00:00
size_t GetSendQueueSize() const { return m_mbpsData.queue; }
2019-10-23 22:47:16 +00:00
uint64_t GetDataTransferred() const { return m_mbpsData.transferred; }
bool HasData() const { return m_hasData.load( std::memory_order_acquire ); }
bool IsConnected() const { return m_connected.load( std::memory_order_relaxed ); }
bool IsDataStatic() const { return !m_thread.joinable(); }
bool IsBackgroundDone() const { return m_backgroundDone.load( std::memory_order_relaxed ); }
void Shutdown() { m_shutdown.store( true, std::memory_order_relaxed ); }
2019-08-01 21:14:09 +00:00
void Disconnect();
void Write( FileWrite& f );
2018-07-29 13:33:48 +00:00
int GetTraceVersion() const { return m_traceVersion; }
uint8_t GetHandshakeStatus() const { return m_handshake.load( std::memory_order_relaxed ); }
2018-07-28 15:59:17 +00:00
static const LoadProgress& GetLoadProgress() { return s_loadProgress; }
2019-01-06 18:09:50 +00:00
int64_t GetLoadTime() const { return m_loadTime; }
2018-07-28 15:59:17 +00:00
2019-01-14 22:22:31 +00:00
void ClearFailure() { m_failure = Failure::None; }
Failure GetFailureType() const { return m_failure; }
const FailureData& GetFailureData() const { return m_failureData; }
static const char* GetFailureString( Failure failure );
2019-01-14 22:22:31 +00:00
void PackFrameImage( char*& buf, size_t& bufsz, const char* image, uint16_t w, uint16_t h, uint32_t& csz ) const;
2019-06-08 10:17:18 +00:00
const char* PackFrameImage( const char* image, uint16_t w, uint16_t h, uint32_t& csz );
const char* UnpackFrameImage( const FrameImage& image );
private:
2019-10-28 21:45:10 +00:00
void Network();
void Exec();
2019-04-01 16:52:32 +00:00
void Query( ServerQuery type, uint64_t data );
void QueryTerminate();
2019-01-14 22:08:34 +00:00
tracy_force_inline bool DispatchProcess( const QueueItem& ev, char*& ptr );
tracy_force_inline bool Process( const QueueItem& ev );
tracy_force_inline void ProcessThreadContext( const QueueThreadContext& ev );
tracy_force_inline void ProcessZoneBegin( const QueueZoneBegin& ev );
tracy_force_inline void ProcessZoneBeginCallstack( const QueueZoneBegin& ev );
tracy_force_inline void ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev );
tracy_force_inline void ProcessZoneBeginAllocSrcLocCallstack( const QueueZoneBegin& ev );
2019-01-15 17:55:21 +00:00
tracy_force_inline void ProcessZoneEnd( const QueueZoneEnd& ev );
2019-01-14 21:56:10 +00:00
tracy_force_inline void ProcessZoneValidation( const QueueZoneValidation& ev );
tracy_force_inline void ProcessFrameMark( const QueueFrameMark& ev );
2018-08-05 00:09:59 +00:00
tracy_force_inline void ProcessFrameMarkStart( const QueueFrameMark& ev );
tracy_force_inline void ProcessFrameMarkEnd( const QueueFrameMark& ev );
2019-06-06 19:39:54 +00:00
tracy_force_inline void ProcessFrameImage( const QueueFrameImage& ev );
tracy_force_inline void ProcessZoneText( const QueueZoneText& ev );
2018-06-29 14:12:17 +00:00
tracy_force_inline void ProcessZoneName( const QueueZoneText& ev );
tracy_force_inline void ProcessLockAnnounce( const QueueLockAnnounce& ev );
tracy_force_inline void ProcessLockTerminate( const QueueLockTerminate& ev );
tracy_force_inline void ProcessLockWait( const QueueLockWait& ev );
tracy_force_inline void ProcessLockObtain( const QueueLockObtain& ev );
tracy_force_inline void ProcessLockRelease( const QueueLockRelease& ev );
tracy_force_inline void ProcessLockSharedWait( const QueueLockWait& ev );
tracy_force_inline void ProcessLockSharedObtain( const QueueLockObtain& ev );
tracy_force_inline void ProcessLockSharedRelease( const QueueLockRelease& ev );
tracy_force_inline void ProcessLockMark( const QueueLockMark& ev );
tracy_force_inline void ProcessPlotData( const QueuePlotData& ev );
tracy_force_inline void ProcessMessage( const QueueMessage& ev );
tracy_force_inline void ProcessMessageLiteral( const QueueMessage& ev );
2019-05-10 18:17:44 +00:00
tracy_force_inline void ProcessMessageColor( const QueueMessageColor& ev );
tracy_force_inline void ProcessMessageLiteralColor( const QueueMessageColor& ev );
2019-07-12 16:30:45 +00:00
tracy_force_inline void ProcessMessageAppInfo( const QueueMessage& ev );
tracy_force_inline void ProcessGpuNewContext( const QueueGpuNewContext& ev );
tracy_force_inline void ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev, bool serial );
tracy_force_inline void ProcessGpuZoneBeginCallstack( const QueueGpuZoneBegin& ev, bool serial );
tracy_force_inline void ProcessGpuZoneEnd( const QueueGpuZoneEnd& ev, bool serial );
tracy_force_inline void ProcessGpuTime( const QueueGpuTime& ev );
2018-04-01 00:03:34 +00:00
tracy_force_inline void ProcessMemAlloc( const QueueMemAlloc& ev );
tracy_force_inline bool ProcessMemFree( const QueueMemFree& ev );
2018-06-19 16:52:45 +00:00
tracy_force_inline void ProcessMemAllocCallstack( const QueueMemAlloc& ev );
tracy_force_inline void ProcessMemFreeCallstack( const QueueMemFree& ev );
tracy_force_inline void ProcessCallstackMemory( const QueueCallstackMemory& ev );
2018-06-21 23:15:49 +00:00
tracy_force_inline void ProcessCallstack( const QueueCallstack& ev );
tracy_force_inline void ProcessCallstackAlloc( const QueueCallstackAlloc& ev );
tracy_force_inline void ProcessCallstackFrameSize( const QueueCallstackFrameSize& ev );
2018-06-19 23:07:09 +00:00
tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev );
2018-08-20 00:07:31 +00:00
tracy_force_inline void ProcessCrashReport( const QueueCrashReport& ev );
2019-02-21 21:45:39 +00:00
tracy_force_inline void ProcessSysTime( const QueueSysTime& ev );
2019-08-12 22:13:50 +00:00
tracy_force_inline void ProcessContextSwitch( const QueueContextSwitch& ev );
2019-08-17 15:05:29 +00:00
tracy_force_inline void ProcessThreadWakeup( const QueueThreadWakeup& ev );
2019-08-17 20:32:41 +00:00
tracy_force_inline void ProcessTidToPid( const QueueTidToPid& ev );
tracy_force_inline void ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
tracy_force_inline void ProcessZoneBeginAllocSrcLocImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev, bool serial );
2019-01-14 22:22:31 +00:00
void ZoneStackFailure( uint64_t thread, const ZoneEvent* ev );
2019-01-15 23:45:48 +00:00
void ZoneEndFailure( uint64_t thread );
void ZoneTextFailure( uint64_t thread );
void ZoneNameFailure( uint64_t thread );
void MemFreeFailure( uint64_t thread );
void FrameEndFailure();
void FrameImageIndexFailure();
void FrameImageTwiceFailure();
2019-01-14 22:22:31 +00:00
tracy_force_inline void CheckSourceLocation( uint64_t ptr );
void NewSourceLocation( uint64_t ptr );
2019-10-25 19:07:28 +00:00
tracy_force_inline int16_t ShrinkSourceLocation( uint64_t srcloc )
{
if( m_data.shrinkSrclocLast.first == srcloc ) return m_data.shrinkSrclocLast.second;
return ShrinkSourceLocationReal( srcloc );
}
int16_t ShrinkSourceLocationReal( uint64_t srcloc );
int16_t NewShrinkedSourceLocation( uint64_t srcloc );
tracy_force_inline void MemAllocChanged( int64_t time );
void CreateMemAllocPlot();
void ReconstructMemAllocPlot();
void InsertMessageData( MessageData* msg, uint64_t thread );
2019-08-03 12:35:01 +00:00
ThreadData* NoticeThreadReal( uint64_t thread );
ThreadData* NewThread( uint64_t thread );
2019-10-24 20:33:48 +00:00
tracy_force_inline ThreadData* NoticeThread( uint64_t thread )
2019-08-03 12:35:01 +00:00
{
if( m_data.threadDataLast.first == thread ) return m_data.threadDataLast.second;
return NoticeThreadReal( thread );
}
2019-10-24 20:33:48 +00:00
ThreadData* RetrieveThreadReal( uint64_t thread );
tracy_force_inline ThreadData* RetrieveThread( uint64_t thread )
{
if( m_data.threadDataLast.first == thread ) return m_data.threadDataLast.second;
return RetrieveThreadReal( thread );
}
#ifndef TRACY_NO_STATISTICS
SourceLocationZones* GetSourceLocationZones( uint16_t srcloc )
{
if( m_data.srclocZonesLast.first == srcloc ) return m_data.srclocZonesLast.second;
return GetSourceLocationZonesReal( srcloc );
}
SourceLocationZones* GetSourceLocationZonesReal( uint16_t srcloc );
#else
uint64_t* GetSourceLocationZonesCnt( uint16_t srcloc )
{
if( m_data.srclocCntLast.first == srcloc ) return m_data.srclocCntLast.second;
return GetSourceLocationZonesCntReal( srcloc );
}
uint64_t* GetSourceLocationZonesCntReal( uint16_t srcloc );
#endif
tracy_force_inline void NewZone( ZoneEvent* zone, uint64_t thread );
void InsertLockEvent( LockMap& lockmap, LockEvent* lev, uint64_t thread, int64_t time );
void CheckString( uint64_t ptr );
void CheckThreadString( uint64_t id );
void CheckExternalName( uint64_t id );
void AddSourceLocation( const QueueSourceLocation& srcloc );
void AddSourceLocationPayload( uint64_t ptr, char* data, size_t sz );
void AddString( uint64_t ptr, char* str, size_t sz );
void AddThreadString( uint64_t id, char* str, size_t sz );
void AddCustomString( uint64_t ptr, char* str, size_t sz );
void AddExternalName( uint64_t ptr, char* str, size_t sz );
2019-08-16 17:49:16 +00:00
void AddExternalThreadName( uint64_t ptr, char* str, size_t sz );
2019-06-06 19:39:54 +00:00
void AddFrameImageData( uint64_t ptr, char* data, size_t sz );
2018-06-24 13:28:09 +00:00
tracy_force_inline void AddCallstackPayload( uint64_t ptr, char* data, size_t sz );
2019-03-03 16:34:56 +00:00
tracy_force_inline void AddCallstackAllocPayload( uint64_t ptr, char* data, size_t sz );
2018-06-19 19:15:36 +00:00
void InsertPlot( PlotData* plot, int64_t time, double val );
void HandlePlotName( uint64_t name, char* str, size_t sz );
2018-08-04 18:48:21 +00:00
void HandleFrameName( uint64_t name, char* str, size_t sz );
2018-04-01 00:03:34 +00:00
void HandlePostponedPlots();
StringLocation StoreString( char* str, size_t sz );
2019-08-14 18:16:11 +00:00
const ContextSwitch* const GetContextSwitchDataImpl( uint64_t thread );
2019-11-02 15:17:20 +00:00
tracy_force_inline Vector<short_ptr<ZoneEvent>>& GetZoneChildrenMutable( int32_t idx ) { return m_data.zoneChildren[idx]; }
tracy_force_inline void ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime, int32_t& childIdx );
Store time deltas, instead of absolute time in trace dumps. This change greatly reduces the size of saved dumps, but increase the cost of processing during loading. One notable outlier in the dataset below is mem.tracy, which increased in size, even if changes in the memory dump saving scheme decrease size of the other traces. 041/aa.tracy (0.4.1) {18987 KB} -> 042/aa.tracy (0.4.2) {10140 KB} 53.40% size change 041/android.tracy (0.4.1) {696753 KB} -> 042/android.tracy (0.4.2) {542738 KB} 77.90% size change 041/asset-new.tracy (0.4.1) {97163 KB} -> 042/asset-new.tracy (0.4.2) {78402 KB} 80.69% size change 041/asset-new-id.tracy (0.4.1) {105683 KB} -> 042/asset-new-id.tracy (0.4.2) {84341 KB} 79.81% size change 041/asset-old.tracy (0.4.1) {100205 KB} -> 042/asset-old.tracy (0.4.2) {80688 KB} 80.52% size change 041/big.tracy (0.4.1) {2246014 KB} -> 042/big.tracy (0.4.2) {943083 KB} 41.99% size change 041/crash.tracy (0.4.1) {143 KB} -> 042/crash.tracy (0.4.2) {131 KB} 91.39% size change 041/crash2.tracy (0.4.1) {3411 KB} -> 042/crash2.tracy (0.4.2) {1425 KB} 41.80% size change 041/darkrl.tracy (0.4.1) {31818 KB} -> 042/darkrl.tracy (0.4.2) {15897 KB} 49.96% size change 041/darkrl2.tracy (0.4.1) {18778 KB} -> 042/darkrl2.tracy (0.4.2) {8002 KB} 42.62% size change 041/darkrl-old.tracy (0.4.1) {151346 KB} -> 042/darkrl-old.tracy (0.4.2) {67945 KB} 44.89% size change 041/deadlock.tracy (0.4.1) {53 KB} -> 042/deadlock.tracy (0.4.2) {52 KB} 98.55% size change 041/gn-opengl.tracy (0.4.1) {45860 KB} -> 042/gn-opengl.tracy (0.4.2) {30983 KB} 67.56% size change 041/gn-vulkan.tracy (0.4.1) {45618 KB} -> 042/gn-vulkan.tracy (0.4.2) {31349 KB} 68.72% size change 041/long.tracy (0.4.1) {1583550 KB} -> 042/long.tracy (0.4.2) {1225316 KB} 77.38% size change 041/mem.tracy (0.4.1) {1243058 KB} -> 042/mem.tracy (0.4.2) {1369291 KB} 110.15% size change 041/multi.tracy (0.4.1) {14519 KB} -> 042/multi.tracy (0.4.2) {8110 KB} 55.86% size change 041/new.tracy (0.4.1) {1439 KB} -> 042/new.tracy (0.4.2) {1108 KB} 77.01% size change 041/q3bsp-mt.tracy (0.4.1) {1414323 KB} -> 042/q3bsp-mt.tracy (0.4.2) {949855 KB} 67.16% size change 041/q3bsp-st.tracy (0.4.1) {301334 KB} -> 042/q3bsp-st.tracy (0.4.2) {240347 KB} 79.76% size change 041/selfprofile.tracy (0.4.1) {399648 KB} -> 042/selfprofile.tracy (0.4.2) {197713 KB} 49.47% size change 041/tbrowser.tracy (0.4.1) {13052 KB} -> 042/tbrowser.tracy (0.4.2) {9503 KB} 72.81% size change 041/test.tracy (0.4.1) {60309 KB} -> 042/test.tracy (0.4.2) {40700 KB} 67.49% size change 041/virtualfile_hc.tracy (0.4.1) {108967 KB} -> 042/virtualfile_hc.tracy (0.4.2) {72839 KB} 66.85% size change 041/zfile_hc.tracy (0.4.1) {58814 KB} -> 042/zfile_hc.tracy (0.4.2) {39608 KB} 67.35% size change
2018-12-30 22:06:03 +00:00
tracy_force_inline void ReadTimelinePre042( FileRead& f, ZoneEvent* zone, uint16_t thread, int fileVer );
tracy_force_inline void ReadTimelinePre0510( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime, int fileVer );
tracy_force_inline void ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx );
tracy_force_inline void ReadTimelinePre0510( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int fileVer );
tracy_force_inline void ReadTimelineUpdateStatistics( ZoneEvent* zone, uint16_t thread );
2019-11-02 15:17:20 +00:00
void ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint16_t thread, uint64_t size, int64_t& refTime, int32_t& childIdx );
void ReadTimelinePre042( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint16_t thread, uint64_t size, int fileVer );
void ReadTimelinePre0510( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint16_t thread, uint64_t size, int64_t& refTime, int fileVer );
2019-11-02 14:52:34 +00:00
void ReadTimeline( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx );
void ReadTimelinePre0510( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int fileVer );
2019-11-02 15:17:20 +00:00
void WriteTimeline( FileWrite& f, const Vector<short_ptr<ZoneEvent>>& vec, int64_t& refTime );
2019-11-02 14:52:34 +00:00
void WriteTimeline( FileWrite& f, const Vector<short_ptr<GpuEvent>>& vec, int64_t& refTime, int64_t& refGpuTime );
int64_t TscTime( int64_t tsc ) { return int64_t( tsc * m_timerMul ); }
int64_t TscTime( uint64_t tsc ) { return int64_t( tsc * m_timerMul ); }
Socket m_sock;
std::string m_addr;
int m_port;
std::thread m_thread;
2019-10-28 21:45:10 +00:00
std::thread m_threadNet;
2019-05-27 12:09:55 +00:00
std::atomic<bool> m_connected { false };
std::atomic<bool> m_hasData;
2019-05-27 12:09:55 +00:00
std::atomic<bool> m_shutdown { false };
std::atomic<bool> m_backgroundDone { true };
std::thread m_threadBackground;
int64_t m_delay;
int64_t m_resolution;
double m_timerMul;
std::string m_captureName;
std::string m_captureProgram;
uint64_t m_captureTime;
2018-08-19 16:21:56 +00:00
std::string m_hostInfo;
2019-08-17 20:19:04 +00:00
uint64_t m_pid;
bool m_terminate = false;
bool m_crashed = false;
2019-08-01 21:14:09 +00:00
bool m_disconnect = false;
LZ4_streamDecode_t* m_stream;
char* m_buffer;
int m_bufferOffset;
2018-07-11 23:21:04 +00:00
bool m_onDemand;
bool m_ignoreMemFreeFaults;
2019-11-02 15:29:29 +00:00
short_ptr<GpuCtxData> m_gpuCtxMap[256];
flat_hash_map<uint64_t, StringLocation, nohash<uint64_t>> m_pendingCustomStrings;
uint64_t m_pendingCallstackPtr = 0;
uint32_t m_pendingCallstackId;
flat_hash_map<uint64_t, int16_t, nohash<uint64_t>> m_pendingSourceLocationPayload;
Vector<uint64_t> m_sourceLocationQueue;
flat_hash_map<uint64_t, int16_t, nohash<uint64_t>> m_sourceLocationShrink;
flat_hash_map<uint64_t, ThreadData*, nohash<uint64_t>> m_threadMap;
flat_hash_map<uint64_t, NextCallstack, nohash<uint64_t>> m_nextCallstack;
2019-06-06 19:39:54 +00:00
flat_hash_map<uint64_t, void*, nohash<uint64_t>> m_pendingFrameImageData;
uint32_t m_pendingStrings;
uint32_t m_pendingThreads;
uint32_t m_pendingExternalNames;
uint32_t m_pendingSourceLocation;
2018-06-20 21:42:00 +00:00
uint32_t m_pendingCallstackFrames;
uint8_t m_pendingCallstackSubframes;
CallstackFrameData* m_callstackFrameStaging;
uint64_t m_callstackFrameStagingPtr;
2019-03-03 16:34:56 +00:00
uint64_t m_callstackAllocNextIdx = 0;
2018-06-19 16:52:45 +00:00
uint64_t m_lastMemActionCallstack;
bool m_lastMemActionWasAlloc;
2018-06-19 16:52:45 +00:00
Slab<64*1024*1024> m_slab;
DataBlock m_data;
MbpsBlock m_mbpsData;
2018-07-28 15:59:17 +00:00
2018-07-29 13:33:48 +00:00
int m_traceVersion;
2019-05-27 12:09:55 +00:00
std::atomic<uint8_t> m_handshake { 0 };
2018-07-29 13:33:48 +00:00
2018-07-28 15:59:17 +00:00
static LoadProgress s_loadProgress;
2019-01-06 18:09:50 +00:00
int64_t m_loadTime;
2019-01-14 22:22:31 +00:00
Failure m_failure = Failure::None;
FailureData m_failureData;
2019-02-21 21:45:39 +00:00
PlotData* m_sysTimePlot = nullptr;
2019-04-01 17:17:18 +00:00
Vector<ServerQueryPacket> m_serverQueryQueue;
size_t m_serverQuerySpaceLeft;
2019-06-08 10:17:18 +00:00
flat_hash_map<uint64_t, int32_t> m_frameImageStaging;
2019-06-08 10:17:18 +00:00
char* m_frameImageBuffer = nullptr;
size_t m_frameImageBufferSize = 0;
uint64_t m_threadCtx = 0;
int64_t m_refTimeThread = 0;
int64_t m_refTimeSerial = 0;
2019-10-25 17:13:11 +00:00
int64_t m_refTimeCtx = 0;
2019-10-25 17:52:01 +00:00
int64_t m_refTimeGpu = 0;
std::atomic<uint64_t> m_bytes { 0 };
std::atomic<uint64_t> m_decBytes { 0 };
struct NetBuffer
{
int bufferOffset;
int size;
};
std::vector<NetBuffer> m_netRead;
std::mutex m_netReadLock;
std::condition_variable m_netReadCv;
int m_netWriteCnt = 0;
std::mutex m_netWriteLock;
std::condition_variable m_netWriteCv;
};
}
#endif