From 868ba6279a20e4d1412c2d576c67400167de6694 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Tue, 30 Apr 2019 16:12:35 +0500 Subject: Integrated Optick profiler --- external/optick/optick_message.h | 130 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 external/optick/optick_message.h (limited to 'external/optick/optick_message.h') diff --git a/external/optick/optick_message.h b/external/optick/optick_message.h new file mode 100644 index 0000000..a6d553e --- /dev/null +++ b/external/optick/optick_message.h @@ -0,0 +1,130 @@ +#pragma once +#include "optick.config.h" + +#if USE_OPTICK + +#include "optick_common.h" +#include "optick_serialization.h" + +namespace Optick +{ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +static const uint32 NETWORK_PROTOCOL_VERSION = 24; +static const uint16 NETWORK_APPLICATION_ID = 0xB50F; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +struct DataResponse +{ + enum Type : uint16 + { + FrameDescriptionBoard = 0, // DescriptionBoard for Instrumental Frames + EventFrame = 1, // Instrumental Data + SamplingFrame = 2, // Sampling Data + NullFrame = 3, // Last Fame Mark + ReportProgress = 4, // Report Current Progress + Handshake = 5, // Handshake Response + Reserved_0 = 6, + SynchronizationData = 7, // Synchronization Data for the thread + TagsPack = 8, // Pack of tags + CallstackDescriptionBoard = 9, // DescriptionBoard with resolved function addresses + CallstackPack = 10, // Pack of CallStacks + Reserved_1 = 11, + Reserved_2 = 12, + Reserved_3 = 13, + Reserved_4 = 14, + //... + Reserved_255 = 255, + + FiberSynchronizationData = 1 << 8, // Synchronization Data for the Fibers + SyscallPack, + SummaryPack, + }; + + uint32 version; + uint32 size; + Type type; + uint16 application; + + DataResponse(Type t, uint32 s) : version(NETWORK_PROTOCOL_VERSION), size(s), type(t), application(NETWORK_APPLICATION_ID){} +}; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +OutputDataStream& operator << (OutputDataStream& os, const DataResponse& val); +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +class IMessage +{ +public: + enum Type : uint16 + { + Start, + Stop, + Cancel, + TurnSampling, + COUNT, + }; + + virtual void Apply() = 0; + virtual ~IMessage() {} + + static IMessage* Create( InputDataStream& str ); +}; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +template +class Message : public IMessage +{ + enum { id = MESSAGE_TYPE }; +public: + static uint32 GetMessageType() { return id; } +}; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +struct CaptureSettings +{ + // Capture Mode + uint32 mode; + // Category Filter + uint32 categoryMask; + // Tracer: Sampling Frequency + uint32 samplingFrequency; + // Max Duration for a capture (frames) + uint32 frameLimit; + // Max Duration for a capture (us) + uint32 timeLimitUs; + // Max Duration for a capture (us) + uint32 spikeLimitUs; + // Max Memory for a capture (MB) + uint64 memoryLimitMb; + // Tracer: Root Password for the Device + string password; + + CaptureSettings() : mode(0), categoryMask(0), samplingFrequency(0), frameLimit(0), timeLimitUs(0), spikeLimitUs(0), memoryLimitMb(0) {} +}; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +struct StartMessage : public Message +{ + CaptureSettings settings; + static IMessage* Create(InputDataStream&); + virtual void Apply() override; +}; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +struct StopMessage : public Message +{ + static IMessage* Create(InputDataStream&); + virtual void Apply() override; +}; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +struct CancelMessage : public Message +{ + static IMessage* Create(InputDataStream&); + virtual void Apply() override; +}; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +struct TurnSamplingMessage : public Message +{ + int32 index; + byte isSampling; + + static IMessage* Create(InputDataStream& stream); + virtual void Apply() override; +}; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +} + +#endif //USE_OPTICK \ No newline at end of file -- cgit v1.2.3