Mod Profiler Documentation
The Mod Profiler in VAMP provides detailed performance analysis and monitoring of mod methods during runtime.
Overview
The mod profiler system offers:
- Method-level performance tracking
- Thread usage analysis
- Code coverage reporting
- Detailed timing statistics
For Server Admins
Using the Profiler
VAMP's profiler can be used to:
- Monitor mod performance impact
- Identify bottlenecks
- Track thread usage
- Generate detailed performance reports
Performance Reports
The profiler generates reports containing:
- Method execution times
- Call frequency statistics
- Thread utilization data
- Code coverage metrics
Reports are saved in the ModProfiler
directory with filenames following the pattern: {ModName}_Performance.txt
If your server is having lag issues provide the appropriate mod file to the modder so they can identify the source of the lag.
For Modders
Profiling Your Mod
Profile your mod's assembly:
// Profile a specific assembly
Assembly myModAssembly = typeof(MyModClass).Assembly;
ModProfiler.ProfileAssembly(myModAssembly);
// Generate performance report
ModProfiler.DumpStats();
Understanding the Output
Performance reports include:
Coverage Statistics
- Total methods found
- Successfully patched methods
- Methods called during runtime
- Patch success rate
- Execution coverage percentage
Thread Usage
- Main thread vs background thread calls
- Unique thread count
- Per-method thread distribution
Method Statistics
- Average execution time
- Minimum/maximum timings
- Total execution time
- Call count
- Thread-specific metrics
Filtered Methods
The profiler automatically filters out:
- Abstract and generic methods
- Methods without bodies
- Compiler-generated methods
- System type methods
- Property accessors
- Event handlers
Best Practices
- Profile in a test environment before production
- Monitor both average and maximum execution times
- Pay attention to methods running on multiple threads
- Use coverage reports to ensure comprehensive testing
- Watch for methods with unexpectedly high execution times