CORE: updated remotery

master
Martin Gerhardy 2017-07-05 22:26:10 +02:00
parent 4eba014e7b
commit c57e680f0c
7 changed files with 610 additions and 138 deletions

View File

@ -207,6 +207,14 @@ define UPDATE_HG
endef
updatelibs:
$(call UPDATE_GIT,remotery,https://github.com/Celtoys/Remotery)
cp $(UPDATEDIR)/remotery.sync/lib/Remotery.[ch] src/modules/core/trace
rm -rf tools/remotery
mkdir tools/remotery
cp -r $(UPDATEDIR)/remotery.sync/vis/* tools/remotery/
cp $(UPDATEDIR)/remotery.sync/LICENSE tools/remotery
cp $(UPDATEDIR)/remotery.sync/readme.md tools/remotery
sed -i 's/[ \t]*$$//g' src/modules/core/trace/Remotery.[ch]
$(call UPDATE_GIT,microprofile,https://github.com/jonasmr/microprofile.git)
cp $(UPDATEDIR)/microprofile.sync/microprofile*.[ch]* src/modules/core/trace
sed -i 's/\r//g' src/modules/core/trace/microprofile*

View File

@ -22,7 +22,6 @@
#define MICROPROFILE_EMABLED 0
#if MICROPROFILE_EMABLED
#define MICROPROFILE_IMPL
#define MICROPROFILE_GPU_TIMERS 0
#if MICROPROFILE_GPU_TIMERS
#define MICROPROFILE_GPU_TIMERS_GL 1

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,11 @@ documented just below this comment.
#define RMT_USE_OPENGL 0
#endif
// Allow Metal profiling
#ifndef RMT_USE_METAL
#define RMT_USE_METAL 0
#endif
// Initially use POSIX thread names to name threads instead of Thread0, 1, ...
#ifndef RMT_USE_POSIX_THREADNAMES
#define RMT_USE_POSIX_THREADNAMES 0
@ -85,7 +90,7 @@ documented just below this comment.
// Platform identification
#if defined(_WINDOWS) || defined(_WIN32)
#define RMT_PLATFORM_WINDOWS
#elif defined(__linux__)
#elif defined(__linux__) || defined(__FreeBSD__)
#define RMT_PLATFORM_LINUX
#define RMT_PLATFORM_POSIX
#elif defined(__APPLE__)
@ -129,9 +134,14 @@ documented just below this comment.
#define IFDEF_RMT_USE_D3D11(t, f) f
#endif
#if RMT_ENABLED && RMT_USE_OPENGL
#define IFDEF_RMT_USE_OPENGL(t, f) t
#define IFDEF_RMT_USE_OPENGL(t, f) t
#else
#define IFDEF_RMT_USE_OPENGL(t, f) f
#define IFDEF_RMT_USE_OPENGL(t, f) f
#endif
#if RMT_ENABLED && RMT_USE_METAL
#define IFDEF_RMT_USE_METAL(t, f) t
#else
#define IFDEF_RMT_USE_METAL(t, f) f
#endif
@ -237,7 +247,7 @@ typedef enum rmtError
RMT_ERROR_D3D11_FAILED_TO_CREATE_QUERY, // Failed to create query for sample
// OpenGL error messages
RMT_ERROR_OPENGL_ERROR, // Generic OpenGL error, no real need to expose more detail since app will probably have an OpenGL error callback registered
RMT_ERROR_OPENGL_ERROR, // Generic OpenGL error, no need to expose detail since app will need an OpenGL error callback registered
RMT_ERROR_CUDA_UNKNOWN,
} rmtError;
@ -424,6 +434,26 @@ typedef struct rmtCUDABind
RMT_OPTIONAL(RMT_USE_OPENGL, _rmt_EndOpenGLSample())
#define rmt_BindMetal(command_buffer) \
RMT_OPTIONAL(RMT_USE_METAL, _rmt_BindMetal(command_buffer));
#define rmt_UnbindMetal() \
RMT_OPTIONAL(RMT_USE_METAL, _rmt_UnbindMetal());
#define rmt_BeginMetalSample(name) \
RMT_OPTIONAL(RMT_USE_METAL, { \
static rmtU32 rmt_sample_hash_##name = 0; \
_rmt_BeginMetalSample(#name, &rmt_sample_hash_##name); \
})
#define rmt_BeginMetalSampleDynamic(namestr) \
RMT_OPTIONAL(RMT_USE_METAL, _rmt_BeginMetalSample(namestr, NULL))
#define rmt_EndMetalSample() \
RMT_OPTIONAL(RMT_USE_METAL, _rmt_EndMetalSample())
/*
------------------------------------------------------------------------------------------------------------------------
@ -485,6 +515,17 @@ struct rmt_EndOpenGLSampleOnScopeExit
};
#endif
#if RMT_USE_METAL
extern "C" RMT_API void _rmt_EndMetalSample(void);
struct rmt_EndMetalSampleOnScopeExit
{
~rmt_EndMetalSampleOnScopeExit()
{
_rmt_EndMetalSample();
}
};
#endif
#endif
@ -502,6 +543,9 @@ struct rmt_EndOpenGLSampleOnScopeExit
#define rmt_ScopedOpenGLSample(name) \
RMT_OPTIONAL(RMT_USE_OPENGL, rmt_BeginOpenGLSample(name)); \
RMT_OPTIONAL(RMT_USE_OPENGL, rmt_EndOpenGLSampleOnScopeExit rmt_ScopedOpenGLSample##name);
#define rmt_ScopedMetalSample(name) \
RMT_OPTIONAL(RMT_USE_METAL, rmt_BeginMetalSample(name)); \
RMT_OPTIONAL(RMT_USE_METAL, rmt_EndMetalSampleOnScopeExit rmt_ScopedMetalSample##name);
#endif
@ -553,10 +597,23 @@ RMT_API void _rmt_BeginOpenGLSample(rmtPStr name, rmtU32* hash_cache);
RMT_API void _rmt_EndOpenGLSample(void);
#endif
#if RMT_USE_METAL
RMT_API void _rmt_BeginMetalSample(rmtPStr name, rmtU32* hash_cache);
RMT_API void _rmt_EndMetalSample(void);
#endif
#ifdef __cplusplus
}
#endif
#if RMT_USE_METAL
#ifdef __OBJC__
RMT_API void _rmt_BindMetal(id command_buffer);
RMT_API void _rmt_UnbindMetal();
#endif
#endif
#endif // RMT_ENABLED

View File

@ -20,12 +20,37 @@ Settings = (function()
Remotery = (function()
{
// crack the url and get the parameter we want
var getUrlParameter = function getUrlParameter( search_param)
{
var page_url = decodeURIComponent( window.location.search.substring(1) ),
url_vars = page_url.split('&'),
param_name,
i;
for (i = 0; i < url_vars.length; i++)
{
param_name = url_vars[i].split('=');
if (param_name[0] === search_param)
{
return param_name[1] === undefined ? true : param_name[1];
}
}
};
function Remotery()
{
this.WindowManager = new WM.WindowManager();
this.Settings = new Settings();
this.ConnectionAddress = LocalStore.Get("App", "Global", "ConnectionAddress", "ws://127.0.0.1:17815/rmt");
// "addr" param is ip:port and will override the local store version if passed in the URL
var addr = getUrlParameter( "addr" );
if ( addr != null )
this.ConnectionAddress = "ws://" + addr + "/rmt";
else
this.ConnectionAddress = LocalStore.Get("App", "Global", "ConnectionAddress", "ws://127.0.0.1:17815/rmt");
this.Server = new WebSocketConnection();
this.Server.AddConnectHandler(Bind(OnConnect, this));

View File

@ -444,6 +444,8 @@
.GridBody
{
overflow-x: hidden;
overflow-y: scroll;
}
.GridRow

View File

@ -1,6 +1,9 @@
Remotery
--------
[![Build Status](https://travis-ci.org/Celtoys/Remotery.svg?branch=master)](https://travis-ci.org/Celtoys/Remotery)
[![Build status](https://ci.appveyor.com/api/projects/status/d1o8620mws9ihbsd?svg=true)](https://ci.appveyor.com/project/Celtoys/remotery)
A realtime CPU/GPU profiler hosted in a single C file with a viewer that runs in a web browser.
![screenshot](screenshot.png?raw=true)
@ -23,7 +26,7 @@ Compiling
directories to add Remotery/lib path. The required library ws2_32.lib should be picked
up through the use of the #pragma comment(lib, "ws2_32.lib") directive in Remotery.c.
* Mac OS X (XCode) - simply add lib/Remotery.c and lib/Remotery.h to your program.
* Mac OS X (XCode) - simply add lib/Remotery.c, lib/Remotery.h and lib/Remotery.mm to your program.
* Linux (GCC) - add the source in lib folder. Compilation of the code requires -pthreads for
library linkage. For example to compile the same run: cc lib/Remotery.c sample/sample.c
@ -37,7 +40,8 @@ You can define some extra macros to modify what features are compiled into Remot
RMT_USE_TINYCRT 0 Used by the Celtoys TinyCRT library (not released yet)
RMT_USE_CUDA 0 Assuming CUDA headers/libs are setup, allow CUDA profiling
RMT_USE_D3D11 0 Assuming Direct3D 11 headers/libs are setup, allow D3D11 GPU profiling
RMT_USE_OPENGL 0 Allow OpenGL GPU profiling (standalone except you must link to OpenGL which you already do if you use it)
RMT_USE_OPENGL 0 Allow OpenGL GPU profiling (dynamically links OpenGL libraries on available platforms)
RMT_USE_METAL 0 Allow Metal profiling of command buffers
Basic Use
@ -176,6 +180,24 @@ your OpenGL device and context, ensure you notify Remotery before shutting down
rmt_UnbindOpenGL();
Sampling Metal GPU activity
---------------------------
Remotery can sample Metal command buffers issued to the GPU from multiple threads. As the Metal API does not
support finer grained profiling, samples will return only the timing of the bound command buffer, irrespective
of how many you issue. As such, make sure you bind and sample the command buffer for each call site:
rmt_BindMetal(mtl_command_buffer);
rmt_ScopedMetalSample(command_buffer_name);
The C API supports begin/end also:
rmt_BindMetal(mtl_command_buffer);
rmt_BeginMetalSample(command_buffer_name);
...
rmt_EndMetalSample();
Applying Configuration Settings
-------------------------------