private void UpdatePc() { float total = (float)m_total; int numCumulative = 0; for (int i = 0, c = m_buckets.Count; i < c; ++i) { StreamingTimeBucket sb = m_buckets[i] as StreamingTimeBucket; numCumulative += sb.Num; sb.NumPc = Math.Min(100.0f, 100.0f * sb.Num / total); sb.NumPcCumulative = Math.Min(100.0f, 100.0f * (numCumulative / total)); } }
public void AddInterval(double length) { ++m_total; TimeSpan ivts = new TimeSpan((long)(length * 1000.0 * 1000.0 * 10.0)); int bucketIdx = m_ranges.MappedBinarySearchIndex(ivts, (x) => x.Min, (a, b) => a < b); StreamingTimeBucket bucket = (StreamingTimeBucket)m_buckets[bucketIdx]; ++bucket.Num; bucket.NumPc = Math.Min(100.0f, 100.0f * (bucket.Num / (float)m_total)); UpdatePc(); }