Example #1
0
        public TimerValueSource ToValueSource()
        {
            var rateUnit     = TimeUnitExtensions.FromUnit(this.RateUnit);
            var durationUnit = TimeUnitExtensions.FromUnit(this.DurationUnit);

            var rateValue      = new MeterValue(this.Count, this.Rate.MeanRate, this.Rate.OneMinuteRate, this.Rate.FiveMinuteRate, this.Rate.FifteenMinuteRate, rateUnit);
            var histogramValue = new HistogramValue(this.Count,
                                                    this.Histogram.LastValue, this.Histogram.LastUserValue,
                                                    this.Histogram.Max, this.Histogram.MaxUserValue, this.Histogram.Mean,
                                                    this.Histogram.Min, this.Histogram.MinUserValue, this.Histogram.StdDev, this.Histogram.Median,
                                                    this.Histogram.Percentile75, this.Histogram.Percentile95, this.Histogram.Percentile98,
                                                    this.Histogram.Percentile99, this.Histogram.Percentile999, this.Histogram.SampleSize);

            var timerValue = new TimerValue(rateValue, histogramValue, this.ActiveSessions, durationUnit);

            return(new TimerValueSource(this.Name, ConstantValue.Provider(timerValue), this.Unit, rateUnit, durationUnit, this.Tags));
        }
Example #2
0
 public virtual void ReadFrom(XElement xE)
 {
     Impressions = null;
     TimeUnit    = null;
     Level       = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "impressions")
         {
             Impressions = long.Parse(xItem.Value);
         }
         else if (localName == "timeUnit")
         {
             TimeUnit = TimeUnitExtensions.Parse(xItem.Value);
         }
         else if (localName == "level")
         {
             Level = LevelExtensions.Parse(xItem.Value);
         }
     }
 }