The SimpleStats class in the dramsim3 namespace is used to collect, track, and report simulation statistics such as counters, vectored counters, and histograms. It supports both epoch-based (periodic) reporting and final summary reporting.
Key capabilities include:
- Counters: Tracking single integer values using
Increment(name). - Vectored Counters: Tracking integer values across multiple indices (e.g., per-rank or per-bank) using
IncrementVec(name, pos) or IncrementVecBy(name, pos, num). - Histograms: Collecting value distributions using
AddValue(name, value). - Reporting: Printing statistics for the current epoch via
PrintEpochStats() or the entire simulation via PrintFinalStats(). - Lifecycle: Use
Reset() to clear epoch-specific counters, typically when transitioning between simulation phases.
// Example usage of SimpleStats
dramsim3::SimpleStats stats(config, channel_id);
// Increment a standard counter
stats.Increment("total_requests");
// Increment a vectored counter (e.g., per-bank index)
stats.IncrementVec("bank_accesses", bank_index);
// Increment a vectored counter by a specific amount
stats.IncrementVecBy("bank_accesses", bank_index, 5);
// Add a value to a histogram
stats.AddValue("latency_histogram", latency_value);
// Report statistics
stats.PrintEpochStats();
stats.PrintFinalStats();
// Reset epoch-specific data
stats.Reset();