/// <summary> /// Adds the specified amount to the count of the provided index. Also increments the <see cref="HistogramBase.TotalCount"/> by the same amount. /// </summary> /// <param name="index">The index to increment.</param> /// <param name="addend">The amount to increment by.</param> protected override void AddToCountAtIndex(int index, long addend) { long criticalValue = _wrp.WriterCriticalSectionEnter(); try { _counts.AddAndGet(index, addend); Interlocked.Add(ref _totalCount, addend); } finally { _wrp.WriterCriticalSectionExit(criticalValue); } }