/// <summary>
        /// Creates a collection with the specified number of counters. Each counter in <c>[0, numberOfCounters - 1]</c>
        /// may be accessed with <see cref="AddToCounterInternal"/> or <see cref="GetCounterValueInternal"/>.
        /// </summary>
        internal CounterCollection(ushort numberOfCounters, CounterCollection parent = null)
        {
            Contract.Requires(numberOfCounters > 0);

            // Round up the per-processor 'row' size to cache line size. Since m_counters is row-major,
            // this means that the processor rows are cache-aligned and so processors do not share cache lines.
            int valuesPerProcessor = ((int)numberOfCounters + (ValuesPerCacheLine - 1)) & ~(ValuesPerCacheLine - 1);

            m_counters  = new long[AssumedLogicalProcessorCount, valuesPerProcessor];
            m_durations = new long[AssumedLogicalProcessorCount, valuesPerProcessor];

            m_parent = parent;
        }
Esempio n. 2
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 internal CounterCollection(CounterCollection collectionToClone)
     : this(collectionToClone.m_counters, collectionToClone.m_durations, collectionToClone.m_parent)
 {
 }
Esempio n. 3
0
 private CounterCollection(long[,] counters, long[,] durations, CounterCollection parent)
 {
     m_counters  = (long[, ])counters.Clone();
     m_durations = (long[, ])durations.Clone();
     m_parent    = parent;
 }
Esempio n. 4
0
 /// <nodoc />
 internal Counter(CounterCollection collection, ushort id, CounterType counterType)
 {
     m_collection  = collection;
     m_id          = id;
     m_counterType = counterType;
 }