Wiki 9Minecraft Sampler Mod 1.12.2, Wiki
Sampler Mod 1.12.2, Wiki › Configuration

Sampler Mod 1.12.2, — Configuration

Command Reference

Sampler uses a command-driven interface. Commands are split into /sampler for server-side/single-player logic and /csampler for client-side rendering logic.

Core Diagnostic Commands

Command Description
/sampler tps Displays precise average and maximum tick times. Average should be ~50ms; max should stay below 500ms.
/sampler memory Shows heap usage and Garbage Collection statistics, including "ppm of uptime" (should be under 30,000).
/sampler counts [dim] Lists the number of ticking game objects (entities, tile entities) in the specified dimension.
/sampler report Generates a comprehensive summary report of the current state of the server.

Profiling Commands

These commands are used to generate .nps files for analysis in external tools like VisualVM.

Command Description
/sampler trigger Starts a 1-minute sampling run, often used to capture intermittent lag spikes.
/sampler start Manually begins a profiling session.
/sampler stop Ends the current profiling session.
/sampler export Saves the collected profile data to a .nps file in the server/client root directory.

Investigation Tools

Command Description
/sampler find <class> [--chunkCounts] Locates specific entities or tile entities by their class name. Using --chunkCounts provides a list of chunks with the highest density of that object.
/sampler tesr Highlights Tile Entity Special Renderers in the world to identify blocks that are expensive to render.
/sampler renderupdates Highlights the sources of chunk updates to find blocks causing excessive re-rendering.

Mechanics and Configuration

Sampler operates by taking periodic "snapshots" of the JVM stack traces. By default, it samples every 10ms. This frequency can be adjusted in the sampler.cfg file, though the default is recommended for a balance of accuracy and low overhead.

Key Mechanics

  • Sampling vs. Profiling: Unlike standard profilers that instrument every method call (which causes massive lag), Sampler simply "looks" at what the CPU is doing at set intervals. This allows it to be used on live production servers without disrupting gameplay.
  • Trigger System: The /sampler trigger command is specifically designed to catch "lag spikes." It continuously records data in a circular buffer and only saves the last minute of data when a spike is detected or the command is finalized.