/// <summary>
 /// Safely write a value to a HistogramCounter using the the current time.
 /// If the counter is null no operation will be performed.
 /// </summary>
 /// <param name="counter"></param>
 /// <param name="value"></param>
 /// <param name="dims"></param>
 public static void SafeAddValue(this HistogramCounter counter, long value, DimensionSpecification dims)
 {
     if (counter != null)
     {
         counter.AddValue(value, dims, DateTime.Now);
     }
 }
예제 #2
0
        public async Task <HistogramCounter> CreateHistogramCounter(string name, DimensionSet dimensions)
        {
            CheckCreateCounter(name, dimensions);
            var path    = this.CreateDirectoryForDataSet(name);
            var dataSet =
                new DataSet <InternalHistogram>(name, path, dimensions, this);

            if (path != null)
            {
                await Task.Factory.StartNew(dataSet.LoadStoredData);
            }

            var counter = new HistogramCounter(dataSet);

            this.AddCounter(counter);
            return(counter);
        }