예제 #1
0
        public void Add(NamedMethodSignature signature)
        {
            // if (signature.Name != Name)
            //     throw new InvalidOperationException();

            var c = new Count(0);

            c = Counts.GetOrAdd(signature, c);
            Interlocked.Increment(ref c.Value);
            Interlocked.Increment(ref _Count);
        }
예제 #2
0
        public int GetCountOf(NamedMethodSignature signature)
        {
            Count result;

            if (Counts.TryGetValue(signature, out result))
            {
                return(result.Value);
            }

            return(0);
        }
예제 #3
0
        public void Add(NamedMethodSignature signature)
        {
            // if (signature.Name != Name)
            //     throw new InvalidOperationException();

            Count c;

            lock (Counts) {
                if (!Counts.TryGetValue(signature, out c))
                {
                    Counts.Add(signature, c = new Count());
                }
            }

            Interlocked.Increment(ref c.Value);
            Interlocked.Increment(ref _Count);
        }