summaryrefslogtreecommitdiffstats
path: root/external/optick/optick_message.h
diff options
context:
space:
mode:
Diffstat (limited to 'external/optick/optick_message.h')
-rw-r--r--external/optick/optick_message.h130
1 files changed, 130 insertions, 0 deletions
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<IMessage::Type MESSAGE_TYPE>
+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<IMessage::Start>
+{
+ CaptureSettings settings;
+ static IMessage* Create(InputDataStream&);
+ virtual void Apply() override;
+};
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+struct StopMessage : public Message<IMessage::Stop>
+{
+ static IMessage* Create(InputDataStream&);
+ virtual void Apply() override;
+};
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+struct CancelMessage : public Message<IMessage::Cancel>
+{
+ static IMessage* Create(InputDataStream&);
+ virtual void Apply() override;
+};
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+struct TurnSamplingMessage : public Message<IMessage::TurnSampling>
+{
+ int32 index;
+ byte isSampling;
+
+ static IMessage* Create(InputDataStream& stream);
+ virtual void Apply() override;
+};
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+}
+
+#endif //USE_OPTICK \ No newline at end of file