LogoLogo
  • Welcome
  • FAQ
  • GPU compatibility
  • Introduction
    • Getting Started
    • Rendering Meshes
    • Rendering Volumetric Data
    • Slice and Crop Volume Renderings
    • Attributes API
    • Node transformations
    • Bounding Boxes
  • Controls & Input Handling
    • Custom Controls
    • Gamepads
  • Advanced Topics
    • Custom Rendering Pipelines
    • Instancing
    • Rendering on Distributed Machines
    • Profiling
    • Volume Shaders and Uniforms
    • Network
Powered by GitBook
On this page
  • Using Remotery
  • Using a 3rd-party Profiler

Was this helpful?

Export as PDF
  1. Advanced Topics

Profiling

Curious what piece of code is slowing you down?

PreviousRendering on Distributed MachinesNextVolume Shaders and Uniforms

Last updated 2 years ago

Was this helpful?

Using Remotery

scenery includes support for the . Remotery is a simple profiler that can be used from a browser, either on the same machine, or remotely. Here's the series of steps required to profile a scenery-based application:

Clone the Remotery repository and open vis/index.html in a browser. This is the client that connects to the application and visualises profiling results.

In scenery, set up profiling by either handing the (SceneryBase-derived) application the scenery.Profiler=true system property on startup, or adding the a new Remotery instance to the Hub:

val profiler = Remotery()
hub.add(profiler)
final Profiler profiler = new Remotery();
hub.add(profiler);

A certain piece of code can then be wrapped in begin()and end() blocks of Remotery. The profiler object itself can be queried from the Hub, if available in that routine:

val profiler = hub.get<Profiler>()
profiler?.begin("MyProfilingPoint")
// do stuff
profiler?.end()
final Profiler profiler = hub.get<Profiler>();
if(profiler == null) {
    System.out.err("Could not get profiler :(");
    System.exit(1);
}

profiler.begin("MyMarker");
// do stuff
profiler.end();

When connecting to the Remotery instance on the web browser, you'll see the profiling results, which are updated in real-time:

Using a 3rd-party Profiler

To profile scenery, a 3rd-party profiler of choice can be used as well. Good candidates are IntelliJ's integrated profiler and Java Flight Recorder. Since Oracle has changed the licensing terms of the JDK recently, we advise to use OpenJDK, and an open-source build of the Java Flight Recorder, which can be used from Java 11 onwards. A good tutorial how to set that up can be found .

here
Remotery profiler
Example profiling results from VulkanRenderer when running TexturedCubeExample.