Runtime Stats Viewer

The Runtime Stats tab displays memory usage, garbage collection metrics, and system information for your running application. The interactive memory chart shows heap, stack, runtime, and idle memory over time, making it easy to spot memory leaks or unusual patterns at a glance. Current statistics like goroutine count, heap objects, and GC cycles update every second, while the system information panel shows details like your Go version, CPU cores, and process uptime. It's the dashboard for understanding what's happening under the hood—from checking if memory usage looks normal to confirming your GOMAXPROCS setting or seeing how long your app has been running.

Getting Started

When you select the Runtime Stats tab for a running application, the viewer automatically begins collecting and displaying performance metrics. The interface shows current statistics, historical trends through interactive charts, and detailed system information about your application's runtime environment.

Core Features

Real-Time Performance Monitoring

The Runtime Stats Viewer provides live monitoring with automatic updates:

  • Live Updates: Statistics update every second automatically (indicated by the green auto-refresh light)
  • Current Metrics: See the most recent values for all runtime statistics
  • Timestamp Indicators: Green dots show when statistics were last updated
  • Auto-Refresh Control: Toggle automatic updates on/off as needed
  • Historical Data: Maintains up to 10 minutes of historical data for trend analysis

Memory Usage Visualization

Interactive Memory Breakdown Chart

A visual breakdown of your application's memory usage:

  • Heap Memory (Blue): Memory currently allocated and in use by your application
  • Stack Memory (Green): Memory used by goroutine stacks
  • Runtime Memory (Yellow): Memory used by the Go runtime system
  • Idle Memory (Gray): Allocated but unused memory that can be reused

Historical Memory Trends

An area chart showing memory usage over time:

  • Stacked Areas: Shows how different memory types change over time
  • Interactive Tooltips: Hover to see exact values at any point in time
  • Time-based X-axis: Shows timestamps with 30-second intervals
  • Smart Scaling: Automatically adjusts to show relevant time ranges
  • Live Updates: Chart extends in real-time as new data arrives

Current Statistics Grid

Current Metrics

Real-time statistics about your application's current state:

Uptime

  • Shows how long the application has been running
  • Green indicator dot when the application is currently running
  • Displays time in human-readable format (e.g., "2m 30s", "1h 15m")

Goroutine Count

  • Number of active goroutines (excluding Outrig SDK goroutines)
  • Helps identify potential goroutine leaks
  • Each goroutine represents a lightweight thread

Total Process Memory

  • Total memory obtained from the operating system
  • Includes all memory used by the Go runtime
  • Formatted in appropriate units (KB, MB, GB)

Heap Memory

  • Current memory allocated for application data
  • Represents active memory being used by your data structures
  • Key indicator of application memory usage

Heap Objects

  • Number of live objects currently in memory
  • Calculated as total allocated minus freed objects
  • Helps understand object allocation patterns

Lifetime Statistics

Cumulative statistics since application start:

Lifetime Heap Objects

  • Total number of objects allocated over the application's lifetime
  • Includes objects that have been freed
  • Counter only increases, showing allocation activity

Lifetime Allocation

  • Cumulative bytes allocated since the process started
  • Includes memory that has been freed and reused
  • Indicates total allocation activity

GC Cycles

  • Number of completed garbage collection cycles
  • Frequent GC cycles may indicate memory pressure
  • Helps understand garbage collection patterns

Application Information Panel

Detailed information about your application's runtime environment:

System Information

  • Process ID: The operating system process identifier
  • Working Directory: Current working directory of the application
  • GOMAXPROCS: Maximum number of OS threads that can execute Go code
  • CPU Cores: Number of CPU cores available to the system
  • Platform: Operating system and architecture (e.g., "linux/amd64")
  • Go Version: Version of Go used to build the application

Application Details

  • Module Name: Go module name from go.mod
  • Executable: Path to the application executable
  • Outrig SDK Version: Version of the Outrig SDK being used

Auto-Refresh and Manual Control

Auto-Refresh (Green Light)

  • Enabled by Default: Statistics update automatically every second
  • Visual Indicator: Green light shows auto-refresh is active
  • Toggle Control: Click to enable/disable automatic updates
  • Smart Updates: Only updates when the application is running
  • Historical Data: Maintains rolling window of recent statistics

Manual Refresh

  • Refresh Button: Force an immediate update of all statistics
  • Data Collection: Fetches the latest runtime information from the application
  • Error Recovery: Use manual refresh if auto-refresh encounters issues

Understanding Memory Statistics

Memory Categories

Heap Memory

  • Memory allocated for your application's data structures
  • Includes variables, slices, maps, and other Go objects
  • Managed by the garbage collector
  • Key metric for understanding application memory usage

Stack Memory

  • Memory used by goroutine stacks
  • Each goroutine has its own stack that grows and shrinks
  • Typically small per goroutine but can add up with many goroutines
  • Not managed by the garbage collector

Runtime Memory

  • Memory used by the Go runtime system itself
  • Includes memory spans, mcache, garbage collector overhead
  • Necessary overhead for Go's runtime management
  • Broken down into detailed components in tooltips

Idle Memory

  • Memory allocated from the OS but not currently in use
  • Can be reused by the application without requesting more from the OS
  • Represents available memory within the process
  • Helps understand memory efficiency

Memory Metrics Interpretation

High Heap Usage: May indicate memory-intensive operations or potential memory leaks Frequent GC Cycles: Could suggest memory pressure or allocation patterns that need optimization Growing Idle Memory: Might indicate the application had high memory usage that has since decreased Stable Memory Patterns: Generally indicate healthy, predictable memory usage

Performance Analysis Workflows

Memory Leak Detection

  1. Monitor heap memory trends over time
  2. Look for continuously increasing heap usage
  3. Check if heap objects count keeps growing
  4. Compare with application activity levels
  5. Use GC cycle frequency as an indicator

Performance Optimization

  1. Monitor memory allocation patterns
  2. Look for spikes in heap usage during specific operations
  3. Check goroutine count for potential leaks
  4. Analyze GC frequency and timing
  5. Compare memory usage across different application states

Resource Monitoring

  1. Track total process memory usage
  2. Monitor goroutine count trends
  3. Watch for memory pressure indicators
  4. Check system resource utilization
  5. Identify resource usage patterns

Debugging Workflows

  1. Use historical charts to identify when issues started
  2. Correlate memory spikes with application events
  3. Monitor recovery patterns after high usage
  4. Track long-term trends and growth patterns
  5. Compare metrics before and after code changes

Chart Interaction and Features

Memory Area Chart

  • Hover Tooltips: See exact values at any point in time
  • Stacked Display: Shows how different memory types contribute to total usage
  • Time Navigation: Scroll through historical data
  • Smart Scaling: Automatically adjusts time range based on available data
  • Live Updates: Chart extends in real-time for running applications

Memory Breakdown Chart

  • Interactive Segments: Hover over segments for detailed information
  • Color-Coded Categories: Each memory type has a distinct color
  • Percentage Display: Shows relative proportion of each memory type
  • Detailed Tooltips: Includes descriptions and breakdown of runtime memory

Tips for Effective Monitoring

Regular Monitoring

  • Check runtime stats periodically during development
  • Monitor memory trends during load testing
  • Watch for unusual patterns or spikes
  • Track performance across different application states

Performance Baselines

  • Establish baseline memory usage for your application
  • Monitor changes after code deployments
  • Track performance improvements over time
  • Compare metrics across different environments

Troubleshooting

  • Use historical charts to identify when issues began
  • Correlate memory usage with application logs
  • Monitor recovery patterns after high usage periods
  • Track the effectiveness of performance optimizations

The Runtime Stats Viewer provides essential insights into your Go application's performance characteristics, helping you understand resource usage patterns, identify potential issues, and optimize your application's runtime behavior.