[..] Module – remotery
Module remotery provides bindings for the Remotery CPU/GPU profiling library.
#import "jc/ext/remotery";
Index
Constants (18)
- PStr
- RMT_ASSUME_LITTLE_ENDIAN
- RMT_D3D11_RESYNC_ON_DISJOINT
- RMT_ENABLED
- RMT_GPU_CPU_SYNC_NUM_ITERATIONS
- RMT_GPU_CPU_SYNC_SECONDS
- RMT_USE_CUDA
- RMT_USE_D3D11
- RMT_USE_D3D12
- RMT_USE_INTERNAL_HASH_FUNCTION
- RMT_USE_LEGACY_ATOMICS
- RMT_USE_METAL
- RMT_USE_OPENGL
- RMT_USE_POSIX_THREADNAMES
- RMT_USE_TINYCRT
- RMT_USE_VULKAN
- STATIC
- SampleTree
Procedures (35)
- BeginCPUSample
- CreateGlobalInstance
- DestroyGlobalInstance
- EndCPUSample
- GetGlobalInstance
- GetLastErrorMessage
- HashString32
- IterateChildren
- IterateNext
- LogText
- MarkFrame
- PropertyAddValue
- PropertyFrameResetAll
- PropertyGetDescription
- PropertyGetName
- PropertyGetNameHash
- PropertyGetType
- PropertyGetValue
- PropertyIterateChildren
- PropertyIterateNext
- PropertySetValue
- PropertySnapshotAll
- SampleGetCallCount
- SampleGetColour
- SampleGetName
- SampleGetNameHash
- SampleGetSelfTime
- SampleGetStart
- SampleGetTime
- SampleGetType
- SampleTreeGetRootSample
- SampleTreeGetThreadName
- SetCurrentThreadName
- SetGlobalInstance
- Settings_
Types (34)
Imports (1)
Constants
RMT_ASSUME_LITTLE_ENDIAN ¶
RMT_ASSUME_LITTLE_ENDIAN :: 0;
RMT_D3D11_RESYNC_ON_DISJOINT ¶
RMT_D3D11_RESYNC_ON_DISJOINT :: 1;
RMT_ENABLED ¶
RMT_ENABLED :: 1;
RMT_GPU_CPU_SYNC_NUM_ITERATIONS ¶
RMT_GPU_CPU_SYNC_NUM_ITERATIONS :: 16;
RMT_GPU_CPU_SYNC_SECONDS ¶
RMT_GPU_CPU_SYNC_SECONDS :: 30;
RMT_USE_CUDA ¶
RMT_USE_CUDA :: 0;
RMT_USE_D3D11 ¶
RMT_USE_D3D11 :: 0;
RMT_USE_D3D12 ¶
RMT_USE_D3D12 :: 0;
RMT_USE_INTERNAL_HASH_FUNCTION ¶
RMT_USE_INTERNAL_HASH_FUNCTION :: 1;
RMT_USE_LEGACY_ATOMICS ¶
RMT_USE_LEGACY_ATOMICS :: 0;
RMT_USE_METAL ¶
RMT_USE_METAL :: 0;
RMT_USE_OPENGL ¶
RMT_USE_OPENGL :: 0;
RMT_USE_POSIX_THREADNAMES ¶
RMT_USE_POSIX_THREADNAMES :: 0;
RMT_USE_TINYCRT ¶
RMT_USE_TINYCRT :: 0;
RMT_USE_VULKAN ¶
RMT_USE_VULKAN :: 0;
SampleTree ¶
SampleTree :: Msg_SampleTree;
Procedures
BeginCPUSample ¶
BeginCPUSample :: (name: PStr, flags: U32, hash_cache: *U32)
CreateGlobalInstance ¶
CreateGlobalInstance :: (remotery: **Remotery) -> Error
DestroyGlobalInstance ¶
DestroyGlobalInstance :: (remotery: *Remotery)
EndCPUSample ¶
EndCPUSample :: ()
GetGlobalInstance ¶
GetGlobalInstance :: () -> *Remotery
GetLastErrorMessage ¶
GetLastErrorMessage :: (__args: ..Any) -> PStr
HashString32 ¶
HashString32 :: (s: *u8, len: s32, seed: U32) -> U32
IterateChildren ¶
IterateChildren :: (iter: *SampleIterator, sample: *Sample)
IterateNext ¶
IterateNext :: (iter: *SampleIterator) -> Bool
PropertyAddValue ¶
PropertyAddValue :: (property: *Property, add_value: PropertyValue)
PropertyFrameResetAll ¶
PropertyFrameResetAll :: (__args: ..Any)
PropertyGetDescription ¶
PropertyGetDescription :: (property: *Property) -> *u8
PropertyGetName ¶
PropertyGetName :: (property: *Property) -> *u8
PropertyGetNameHash ¶
PropertyGetNameHash :: (property: *Property) -> U32
PropertyGetType ¶
PropertyGetType :: (property: *Property) -> PropertyType
PropertyGetValue ¶
PropertyGetValue :: (property: *Property) -> PropertyValue
PropertyIterateChildren ¶
PropertyIterateChildren :: (iter: *PropertyIterator, property: *Property)
PropertyIterateNext ¶
PropertyIterateNext :: (iter: *PropertyIterator) -> Bool
PropertySetValue ¶
PropertySetValue :: (property: *Property)
PropertySnapshotAll ¶
PropertySnapshotAll :: (__args: ..Any) -> Error
SampleGetCallCount ¶
SampleGetCallCount :: (sample: *Sample) -> U32
SampleGetColour ¶
SampleGetColour :: (sample: *Sample, r: *U8, g: *U8, b: *U8)
SampleGetName ¶
SampleGetName :: (sample: *Sample) -> *u8
SampleGetNameHash ¶
SampleGetNameHash :: (sample: *Sample) -> U32
SampleGetSelfTime ¶
SampleGetSelfTime :: (sample: *Sample) -> U64
SampleGetStart ¶
SampleGetStart :: (sample: *Sample) -> U64
SampleGetTime ¶
SampleGetTime :: (sample: *Sample) -> U64
SampleGetType ¶
SampleGetType :: (sample: *Sample) -> SampleType
SampleTreeGetRootSample ¶
SampleTreeGetRootSample :: (sample_tree: *SampleTree) -> *Sample
SampleTreeGetThreadName ¶
SampleTreeGetThreadName :: (sample_tree: *SampleTree) -> *u8
SetCurrentThreadName ¶
SetCurrentThreadName :: (thread_name: PStr)
SetGlobalInstance ¶
SetGlobalInstance :: (remotery: *Remotery)
Macros
This section is empty.
Types
CUDABind ¶
CUDABind :: struct {
// The main context that all driver functions apply before each call
_context: *void;
// Driver API function pointers that need to be pointed to
// Untyped so that the CUDA headers are not required in this file
// NOTE: These are named differently to the CUDA functions because the CUDA API has a habit of using
// macros to point function calls to different versions, e.g. cuEventDestroy is a macro for
// cuEventDestroy_v2.
CtxSetCurrent: *void;
CtxGetCurrent: *void;
EventCreate: *void;
EventDestroy: *void;
EventRecord: *void;
EventQuery: *void;
EventElapsedTime: *void;
}D3D12Bind ¶
D3D12Bind :: struct {
// The main device shared by all threads
device: *void;
// The queue command lists are executed on for profiling
queue: *void;
}Error ¶
Error :: enum u32 {
NONE :: 0;
RECURSIVE_SAMPLE :: 1;
UNKNOWN :: 2;
INVALID_INPUT :: 3;
RESOURCE_CREATE_FAIL :: 4;
RESOURCE_ACCESS_FAIL :: 5;
TIMEOUT :: 6;
MALLOC_FAIL :: 7;
TLS_ALLOC_FAIL :: 8;
VIRTUAL_MEMORY_BUFFER_FAIL :: 9;
CREATE_THREAD_FAIL :: 10;
OPEN_THREAD_HANDLE_FAIL :: 11;
SOCKET_INVALID_POLL :: 12;
SOCKET_SELECT_FAIL :: 13;
SOCKET_POLL_ERRORS :: 14;
SOCKET_SEND_FAIL :: 15;
SOCKET_RECV_NO_DATA :: 16;
SOCKET_RECV_TIMEOUT :: 17;
SOCKET_RECV_FAILED :: 18;
WEBSOCKET_HANDSHAKE_NOT_GET :: 19;
WEBSOCKET_HANDSHAKE_NO_VERSION :: 20;
WEBSOCKET_HANDSHAKE_BAD_VERSION :: 21;
WEBSOCKET_HANDSHAKE_NO_HOST :: 22;
WEBSOCKET_HANDSHAKE_BAD_HOST :: 23;
WEBSOCKET_HANDSHAKE_NO_KEY :: 24;
WEBSOCKET_HANDSHAKE_BAD_KEY :: 25;
WEBSOCKET_HANDSHAKE_STRING_FAIL :: 26;
WEBSOCKET_DISCONNECTED :: 27;
WEBSOCKET_BAD_FRAME_HEADER :: 28;
WEBSOCKET_BAD_FRAME_HEADER_SIZE :: 29;
WEBSOCKET_BAD_FRAME_HEADER_MASK :: 30;
WEBSOCKET_RECEIVE_TIMEOUT :: 31;
REMOTERY_NOT_CREATED :: 32;
SEND_ON_INCOMPLETE_PROFILE :: 33;
CUDA_DEINITIALIZED :: 34;
CUDA_NOT_INITIALIZED :: 35;
CUDA_INVALID_CONTEXT :: 36;
CUDA_INVALID_VALUE :: 37;
CUDA_INVALID_HANDLE :: 38;
CUDA_OUT_OF_MEMORY :: 39;
ERROR_NOT_READY :: 40;
D3D11_FAILED_TO_CREATE_QUERY :: 41;
OPENGL_ERROR :: 42;
CUDA_UNKNOWN :: 43;
RMT_ERROR_NONE :: NONE;
RMT_ERROR_RECURSIVE_SAMPLE :: RECURSIVE_SAMPLE;
RMT_ERROR_UNKNOWN :: UNKNOWN;
RMT_ERROR_INVALID_INPUT :: INVALID_INPUT;
RMT_ERROR_RESOURCE_CREATE_FAIL :: RESOURCE_CREATE_FAIL;
RMT_ERROR_RESOURCE_ACCESS_FAIL :: RESOURCE_ACCESS_FAIL;
RMT_ERROR_TIMEOUT :: TIMEOUT;
RMT_ERROR_MALLOC_FAIL :: MALLOC_FAIL;
RMT_ERROR_TLS_ALLOC_FAIL :: TLS_ALLOC_FAIL;
RMT_ERROR_VIRTUAL_MEMORY_BUFFER_FAIL :: VIRTUAL_MEMORY_BUFFER_FAIL;
RMT_ERROR_CREATE_THREAD_FAIL :: CREATE_THREAD_FAIL;
RMT_ERROR_OPEN_THREAD_HANDLE_FAIL :: OPEN_THREAD_HANDLE_FAIL;
RMT_ERROR_SOCKET_INVALID_POLL :: SOCKET_INVALID_POLL;
RMT_ERROR_SOCKET_SELECT_FAIL :: SOCKET_SELECT_FAIL;
RMT_ERROR_SOCKET_POLL_ERRORS :: SOCKET_POLL_ERRORS;
RMT_ERROR_SOCKET_SEND_FAIL :: SOCKET_SEND_FAIL;
RMT_ERROR_SOCKET_RECV_NO_DATA :: SOCKET_RECV_NO_DATA;
RMT_ERROR_SOCKET_RECV_TIMEOUT :: SOCKET_RECV_TIMEOUT;
RMT_ERROR_SOCKET_RECV_FAILED :: SOCKET_RECV_FAILED;
RMT_ERROR_WEBSOCKET_HANDSHAKE_NOT_GET :: WEBSOCKET_HANDSHAKE_NOT_GET;
RMT_ERROR_WEBSOCKET_HANDSHAKE_NO_VERSION :: WEBSOCKET_HANDSHAKE_NO_VERSION;
RMT_ERROR_WEBSOCKET_HANDSHAKE_BAD_VERSION :: WEBSOCKET_HANDSHAKE_BAD_VERSION;
RMT_ERROR_WEBSOCKET_HANDSHAKE_NO_HOST :: WEBSOCKET_HANDSHAKE_NO_HOST;
RMT_ERROR_WEBSOCKET_HANDSHAKE_BAD_HOST :: WEBSOCKET_HANDSHAKE_BAD_HOST;
RMT_ERROR_WEBSOCKET_HANDSHAKE_NO_KEY :: WEBSOCKET_HANDSHAKE_NO_KEY;
RMT_ERROR_WEBSOCKET_HANDSHAKE_BAD_KEY :: WEBSOCKET_HANDSHAKE_BAD_KEY;
RMT_ERROR_WEBSOCKET_HANDSHAKE_STRING_FAIL :: WEBSOCKET_HANDSHAKE_STRING_FAIL;
RMT_ERROR_WEBSOCKET_DISCONNECTED :: WEBSOCKET_DISCONNECTED;
RMT_ERROR_WEBSOCKET_BAD_FRAME_HEADER :: WEBSOCKET_BAD_FRAME_HEADER;
RMT_ERROR_WEBSOCKET_BAD_FRAME_HEADER_SIZE :: WEBSOCKET_BAD_FRAME_HEADER_SIZE;
RMT_ERROR_WEBSOCKET_BAD_FRAME_HEADER_MASK :: WEBSOCKET_BAD_FRAME_HEADER_MASK;
RMT_ERROR_WEBSOCKET_RECEIVE_TIMEOUT :: WEBSOCKET_RECEIVE_TIMEOUT;
RMT_ERROR_REMOTERY_NOT_CREATED :: REMOTERY_NOT_CREATED;
RMT_ERROR_SEND_ON_INCOMPLETE_PROFILE :: SEND_ON_INCOMPLETE_PROFILE;
RMT_ERROR_CUDA_DEINITIALIZED :: CUDA_DEINITIALIZED;
RMT_ERROR_CUDA_NOT_INITIALIZED :: CUDA_NOT_INITIALIZED;
RMT_ERROR_CUDA_INVALID_CONTEXT :: CUDA_INVALID_CONTEXT;
RMT_ERROR_CUDA_INVALID_VALUE :: CUDA_INVALID_VALUE;
RMT_ERROR_CUDA_INVALID_HANDLE :: CUDA_INVALID_HANDLE;
RMT_ERROR_CUDA_OUT_OF_MEMORY :: CUDA_OUT_OF_MEMORY;
RMT_ERROR_ERROR_NOT_READY :: ERROR_NOT_READY;
RMT_ERROR_D3D11_FAILED_TO_CREATE_QUERY :: D3D11_FAILED_TO_CREATE_QUERY;
RMT_ERROR_OPENGL_ERROR :: OPENGL_ERROR;
RMT_ERROR_CUDA_UNKNOWN :: CUDA_UNKNOWN;
}InputHandlerPtr ¶
InputHandlerPtr :: #type (text: *u8, _context: *void) -> void #c_call;
Msg_SampleTree ¶
Msg_SampleTree :: struct {}Property ¶
Property :: struct {
// Gets set to RMT_TRUE after a property has been modified, when it gets initialised for the first time
initialised: Bool;
// Runtime description
type: PropertyType;
flags: PropertyFlags;
// Current value
value: PropertyValue;
// Last frame value to see if previous value needs to be updated
lastFrameValue: PropertyValue;
// Previous value only if it's different from the current value, and when it changed
prevValue: PropertyValue;
prevValueFrame: U32;
// Text description
name: *u8;
description: *u8;
// Default value for Reset calls
defaultValue: PropertyValue;
// Parent link specifically placed after default value so that variadic macro can initialise it
parent: *Property;
// Links within the property tree
firstChild: *Property;
lastChild: *Property;
nextSibling: *Property;
// Hash for efficient sending of properties to the viewer
nameHash: U32;
// Unique, persistent ID among all properties
uniqueID: U32;
}PropertyFlags ¶
PropertyFlags :: enum u32 {
NoFlags :: 0;
FrameReset :: 1;
RMT_PropertyFlags_NoFlags :: NoFlags;
RMT_PropertyFlags_FrameReset :: FrameReset;
}PropertyHandlerPtr ¶
PropertyHandlerPtr :: #type (cbk_context: *void, root: *Property) -> void #c_call;
PropertyIterator ¶
PropertyIterator :: struct {
// public
property: *Property;
// private
initial: *Property;
}PropertyType ¶
PropertyType :: enum u32 {
rmtGroup :: 0;
rmtBool :: 1;
rmtS32 :: 2;
rmtU32 :: 3;
rmtF32 :: 4;
rmtS64 :: 5;
rmtU64 :: 6;
rmtF64 :: 7;
RMT_PropertyType_rmtGroup :: rmtGroup;
RMT_PropertyType_rmtBool :: rmtBool;
RMT_PropertyType_rmtS32 :: rmtS32;
RMT_PropertyType_rmtU32 :: rmtU32;
RMT_PropertyType_rmtF32 :: rmtF32;
RMT_PropertyType_rmtS64 :: rmtS64;
RMT_PropertyType_rmtU64 :: rmtU64;
RMT_PropertyType_rmtF64 :: rmtF64;
}PropertyValue ¶
PropertyValue :: union {
Bool_: Bool;
S32_: S32;
U32_: U32;
F32_: F32;
S64_: S64;
U64_: U64;
F64_: F64;
}ReallocPtr ¶
ReallocPtr :: #type (mm_context: *void, ptr: *void, size: U32) -> *void #c_call;
SampleFlags ¶
SampleFlags :: enum u32 {
None :: 0;
Aggregate :: 1;
Recursive :: 2;
Root :: 4;
SendOnClose :: 8;
RMTSF_None :: None;
RMTSF_Aggregate :: Aggregate;
RMTSF_Recursive :: Recursive;
RMTSF_Root :: Root;
RMTSF_SendOnClose :: SendOnClose;
}SampleIterator ¶
SampleIterator :: struct {
// public
sample: *Sample;
// private
initial: *Sample;
}SampleTreeHandlerPtr ¶
SampleTreeHandlerPtr :: #type (cbk_context: *void, sample_tree: *SampleTree) -> void #c_call;
SampleType ¶
SampleType :: enum u32 {
CPU :: 0;
CUDA :: 1;
D3D11 :: 2;
D3D12 :: 3;
OpenGL :: 4;
Metal :: 5;
Vulkan :: 6;
Count :: 7;
RMT_SampleType_CPU :: CPU;
RMT_SampleType_CUDA :: CUDA;
RMT_SampleType_D3D11 :: D3D11;
RMT_SampleType_D3D12 :: D3D12;
RMT_SampleType_OpenGL :: OpenGL;
RMT_SampleType_Metal :: Metal;
RMT_SampleType_Vulkan :: Vulkan;
RMT_SampleType_Count :: Count;
}Settings ¶
Settings :: struct {
// Which port to listen for incoming connections on
port: U16;
// When this server exits it can leave the port open in TIME_WAIT state for a while. This forces
// subsequent server bind attempts to fail when restarting. If you find restarts fail repeatedly
// with bind attempts, set this to true to forcibly reuse the open port.
reuse_open_port: Bool;
// Only allow connections on localhost?
// For dev builds you may want to access your game from other devices but if
// you distribute a game to your players with Remotery active, probably best
// to limit connections to localhost.
limit_connections_to_localhost: Bool;
// Whether to enable runtime thread sampling that discovers which processors a thread is running
// on. This will suspend and resume threads from outside repeatdly and inject code into each
// thread that automatically instruments the processor.
// Default: Enabled
enableThreadSampler: Bool;
// How long to sleep between server updates, hopefully trying to give
// a little CPU back to other threads.
msSleepBetweenServerUpdates: U32;
// Size of the internal message queues Remotery uses
// Will be rounded to page granularity of 64k
messageQueueSizeInBytes: U32;
// If the user continuously pushes to the message queue, the server network
// code won't get a chance to update unless there's an upper-limit on how
// many messages can be consumed per loop.
maxNbMessagesPerUpdate: U32;
// Callback pointers for memory allocation
malloc: MallocPtr;
realloc: ReallocPtr;
free: FreePtr;
mm_context: *void;
// Callback pointer for receiving input from the Remotery console
input_handler: InputHandlerPtr;
// Callback pointer for traversing the sample tree graph
sampletree_handler: SampleTreeHandlerPtr;
sampletree_context: *void;
// Callback pointer for traversing the prpperty graph
snapshot_callback: PropertyHandlerPtr;
snapshot_context: *void;
// Context pointer that gets sent to Remotery console callback function
input_handler_context: *void;
logPath: PStr;
}VulkanBind ¶
VulkanBind :: struct {
// The physical Vulkan device, of type VkPhysicalDevice
physical_device: *void;
// The logical Vulkan device, of type VkDevice
device: *void;
// The queue command buffers are executed on for profiling, of type VkQueue
queue: *void;
}VulkanFunctions ¶
VulkanFunctions :: struct {
// Instance functions
vkGetPhysicalDeviceProperties: *void;
// Device functions
vkQueueSubmit: *void;
vkQueueWaitIdle: *void;
vkCreateQueryPool: *void;
vkDestroyQueryPool: *void;
vkResetQueryPool: *void; // vkResetQueryPool (Vulkan 1.2+ with hostQueryReset) or vkResetQueryPoolEXT (VK_EXT_host_query_reset)
vkGetQueryPoolResults: *void;
vkCmdWriteTimestamp: *void;
vkCreateSemaphore: *void;
vkDestroySemaphore: *void;
vkSignalSemaphore: *void; // vkSignalSemaphore (Vulkan 1.2+ with timelineSemaphore) or vkSignalSemaphoreKHR (VK_KHR_timeline_semaphore)
vkGetSemaphoreCounterValue: *void; // vkGetSemaphoreCounterValue (Vulkan 1.2+ with timelineSemaphore) or vkGetSemaphoreCounterValueKHR (VK_KHR_timeline_semaphore)
vkGetCalibratedTimestampsEXT: *void; // vkGetCalibratedTimestampsKHR (VK_KHR_calibrated_timestamps) or vkGetCalibratedTimestampsEXT (VK_EXT_calibrated_timestamps)
}