Ejemplo n.º 1
0
 public void UpdateNumMsgsReceived(IMessage <T> message)
 {
     if (message != null)
     {
         _numMsgsReceived.Increment();
         _numBytesReceived.Add(message.Data.Length);
     }
 }
 public void StripedLongAdder()
 {
     _stripedLongAdder.Increment();
     _stripedLongAdder.Decrement();
     _stripedLongAdder.GetAndReset();
     _stripedLongAdder.NonVolatileGetValue();
     _stripedLongAdder.Increment();
     _stripedLongAdder.Decrement();
 }
Ejemplo n.º 3
0
 public void IncrementNumAcksReceived(long latencyNs)
 {
     _numAcksReceived.Increment();
     lock (Latency)
     {
         //var current = Latency.Length + 1;
         Latency.Add(TimeSpan.FromTicks(latencyNs).TotalMilliseconds);
     }
 }
Ejemplo n.º 4
0
        private static void ValueAdderIncrement()
        {
            var atomicLong = new AtomicLong(0L);
            BenchmarkRunner.Run("AtomicLong.Increment", () => atomicLong.Increment());

            var threadLocalAdder = new ThreadLocalLongAdder(0L);
            BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());

            var strippedLongAdder = new StripedLongAdder(0L);
            BenchmarkRunner.Run("StripedLongAdder.Increment", () => strippedLongAdder.Increment());
        }
Ejemplo n.º 5
0
        private static void ValueAdderIncrement()
        {
            var atomicLong = new AtomicLong(0L);

            BenchmarkRunner.Run("AtomicLong.Increment", () => atomicLong.Increment());

            var threadLocalAdder = new ThreadLocalLongAdder(0L);

            BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());

            var strippedLongAdder = new StripedLongAdder(0L);

            BenchmarkRunner.Run("StripedLongAdder.Increment", () => strippedLongAdder.Increment());
        }
        /// <inheritdoc />
        public void Update(long value)
        {
            StripedLongAdder bucketCounter = null;

            foreach (var kvp in _buckets)
            {
                if (kvp.Key < value)
                {
                    break;
                }

                bucketCounter = kvp.Value;
            }


            bucketCounter.Increment();
            _sum.Add(value);
            _counter.Increment();
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            AtomicLong[] data = new AtomicLong[0];

            BenchmarkRunner.DefaultMaxThreads   = 8;
            BenchmarkRunner.DefaultTotalSeconds = 5;

            var strippedLongAdder = new StripedLongAdder(0L);
            var threadLocalAdder  = new ThreadLocalLongAdder(0L);

            //BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());
            //var sz = ThreadLocalLongAdder.GetEstimatedFootprintInBytes(threadLocalAdder);

            BenchmarkRunner.Run("StripedLongAdder.Increment", () => strippedLongAdder.Increment());


            //BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());

            //BenchmarkRunner.Run("NoOp", () => { });

            ValueAdderIncrement();
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            AtomicLong[] data = new AtomicLong[0];

            BenchmarkRunner.DefaultMaxThreads = 8;
            BenchmarkRunner.DefaultTotalSeconds = 5;

            var strippedLongAdder = new StripedLongAdder(0L);
            var threadLocalAdder = new ThreadLocalLongAdder(0L);

            //BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());
            //var sz = ThreadLocalLongAdder.GetEstimatedFootprintInBytes(threadLocalAdder);

            BenchmarkRunner.Run("StripedLongAdder.Increment", () => strippedLongAdder.Increment());


            //BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());

            //BenchmarkRunner.Run("NoOp", () => { });

            ValueAdderIncrement();
        }
Ejemplo n.º 9
0
 public void Increment()
 {
     _num.Increment(1);
 }
Ejemplo n.º 10
0
 /// <inheritdoc />
 public long StartRecording()
 {
     _activeSessionsCounter.Increment();
     return(_clock.Nanoseconds);
 }
Ejemplo n.º 11
0
 public void Can_be_incremented()
 {
     _num.Increment();
     _num.GetValue().Should().Be(1L);
 }
Ejemplo n.º 12
0
 internal void IncrementUsageTracker()
 {
     usageCounter.Increment();
 }
Ejemplo n.º 13
0
 protected override void incrementTotalCount()
 {
     totalCount.Increment();
 }
Ejemplo n.º 14
0
 /// <inheritdoc />
 public void Increment()
 {
     _counter.Increment();
 }
Ejemplo n.º 15
0
 public void IncrementSendFailed()
 {
     _numSendFailed.Increment();
 }
Ejemplo n.º 16
0
 public void IncrementNumBatchReceiveFailed()
 {
     _numBatchReceiveFailed.Increment();
 }
Ejemplo n.º 17
0
 public void IncrementNumAcksFailed()
 {
     _numAcksFailed.Increment();
 }