示例#1
0
        /// <summary>
        /// Retourne une valeur du compteur.
        /// </summary>
        /// <param name="statType">CounterStatType.</param>
        /// <returns>Valeur.</returns>
        double ICounter.GetValue(CounterStatType statType)
        {
            switch (statType)
            {
            case CounterStatType.Last:
                return(_counter.Last);

            case CounterStatType.Min:
                return(_counter.Min);

            case CounterStatType.Max:
                return(_counter.Max);

            case CounterStatType.Total:
                return(_counter.Total);

            case CounterStatType.TotalOfSquares:
                return(_counter.TotalOfSquares);

            case CounterStatType.Hits:
                return(_counter.Hits);

            case CounterStatType.Avg:
                double hits = (_cube == null) ? _counter.Hits : _cube.Hits;
                return(_counter.Total / hits);

            default:
                return(GetTimeValue(statType));
            }
        }
示例#2
0
        /// <summary>
        /// Indique si la statistique gère des infos (min, max).
        /// </summary>
        /// <param name="statType">CounterStatType.</param>
        /// <returns>True si l'info est gérée.</returns>
        public override bool HasInfo(CounterStatType statType)
        {
            switch (statType)
            {
            case CounterStatType.Hits50:
                return(true);

            case CounterStatType.Hits100:
                return(true);

            case CounterStatType.Hits200:
                return(true);

            case CounterStatType.Hits500:
                return(true);

            case CounterStatType.Hits1000:
                return(true);

            case CounterStatType.Hits2000:
                return(true);

            case CounterStatType.Hits5000:
                return(true);

            case CounterStatType.Hits10000:
                return(true);

            case CounterStatType.SubAvg:
                return(true);

            default:
                return(base.HasInfo(statType));
            }
        }
示例#3
0
 /// <summary>
 /// Constructeur.
 /// </summary>
 /// <param name="hyperCube">HyperCube utilisé par le comparateur.</param>
 /// <param name="date">Date à la quelle se fait la comparaison.</param>
 /// <param name="counterDefinitionCode">Compteur à comparer.</param>
 /// <param name="statType">Type de statistique à comparer (min, max, moy, ...).</param>
 /// <param name="level">Période de temps sur laquelle appliquer la comparaison.</param>
 internal HyperCubeComparer(IHyperCube hyperCube, DateTime date, string counterDefinitionCode, CounterStatType statType, TimeLevel level)
 {
     this._counterDefinitionCode = counterDefinitionCode;
     this._date      = date;
     this._hyperCube = hyperCube;
     this._level     = level;
     this._statType  = statType;
 }
示例#4
0
        /// <summary>
        /// Retourne une valeur du compteur.
        /// </summary>
        /// <param name="statType">CounterStatType.</param>
        /// <returns>Valeur.</returns>
        public override double GetValue(CounterStatType statType)
        {
            double value;

            switch (statType)
            {
            case CounterStatType.Hits50:
                value = _hitsCounts50;
                break;

            case CounterStatType.Hits100:
                value = _hitsCounts100;
                break;

            case CounterStatType.Hits200:
                value = _hitsCounts200;
                break;

            case CounterStatType.Hits500:
                value = _hitsCounts500;
                break;

            case CounterStatType.Hits1000:
                value = _hitsCounts1000;
                break;

            case CounterStatType.Hits2000:
                value = _hitsCounts2000;
                break;

            case CounterStatType.Hits5000:
                value = _hitsCounts5000;
                break;

            case CounterStatType.Hits10000:
                value = _hitsCounts10000;
                break;

            case CounterStatType.SubAvg:
                value = (Hits == 0) ? double.NaN : (_subProcessTimes / Hits);
                break;

            default:
                // Sinon les données statistiques sont gérés plus nativement.
                value = base.GetValue(statType);
                break;
            }

            return(value);
        }
示例#5
0
        /// <summary>
        /// Indique si la statistique gère des infos (min, max).
        /// </summary>
        /// <param name="statType">CounterStatType.</param>
        /// <returns>True si l'info est gérée.</returns>
        public virtual bool HasInfo(CounterStatType statType)
        {
            switch (statType)
            {
            case CounterStatType.Min:
                return(true);

            case CounterStatType.Max:
                return(true);

            default:
                return(false);
            }
        }
示例#6
0
        /// <summary>
        /// Retourne le nom de l'événement ayant déclenché la valeur min ou max
        /// (null si non renseigné).
        /// </summary>
        /// <param name="statType">CounterStatType.</param>
        /// <returns>Nom de l'évènement.</returns>
        public string GetInfo(CounterStatType statType)
        {
            switch (statType)
            {
            case CounterStatType.Min:
                return(_minName);

            case CounterStatType.Max:
                return(_maxName);

            default:
                throw new NotSupportedException(string.Format(
                                                    CultureInfo.CurrentCulture,
                                                    SR.ExceptionUnknowType,
                                                    statType));
            }
        }
示例#7
0
        /// <summary>
        /// Retourne une valeur du compteur.
        /// </summary>
        /// <param name="statType">CounterStatType.</param>
        /// <returns>Valeur.</returns>
        public virtual double GetValue(CounterStatType statType)
        {
            double v;

            switch (statType)
            {
            case CounterStatType.Last:
                v = _last;
                break;

            case CounterStatType.Min:
                v = _min;
                break;

            case CounterStatType.Max:
                v = _max;
                break;

            case CounterStatType.Total:
                v = _total;
                break;

            case CounterStatType.TotalOfSquares:
                v = _totalOfSquares;
                break;

            case CounterStatType.Hits:
                v = _hits;
                break;

            case CounterStatType.Avg:
                long hits = (_cube == null) ? _hits : (long)_cube.Hits;
                v = (hits > 0) ? ((double)_total) / hits : double.NaN;
                break;

            default:
                throw new NotSupportedException(string.Format(
                                                    CultureInfo.CurrentCulture,
                                                    SR.ExceptionUnknowType,
                                                    statType));
            }

            return(v);
        }
示例#8
0
        /// <summary>
        /// Indique si la statistique gère des infos (min, max).
        /// </summary>
        /// <param name="statType">CounterStatType.</param>
        /// <returns>True si l'info est gérée.</returns>
        bool ICounter.HasInfo(CounterStatType statType)
        {
            switch (statType)
            {
            case CounterStatType.SubAvg:
            case CounterStatType.Min:
            case CounterStatType.Max:
                return(true);

            case CounterStatType.Hits50:
            case CounterStatType.Hits100:
            case CounterStatType.Hits200:
            case CounterStatType.Hits500:
            case CounterStatType.Hits1000:
            case CounterStatType.Hits2000:
            case CounterStatType.Hits5000:
            case CounterStatType.Hits10000:
            default:
                return(false);
            }
        }
示例#9
0
        /// <summary>
        /// Retourne une valeur du compteur d'un compteur de temps.
        /// </summary>
        /// <param name="statType">CounterStatType.</param>
        /// <returns>Valeur.</returns>
        private double GetTimeValue(CounterStatType statType)
        {
            switch (statType)
            {
            case CounterStatType.Hits50:
                return(this.GetSampleCount(50));

            case CounterStatType.Hits100:
                return(this.GetSampleCount(100));

            case CounterStatType.Hits200:
                return(this.GetSampleCount(200));

            case CounterStatType.Hits500:
                return(this.GetSampleCount(500));

            case CounterStatType.Hits1000:
                return(this.GetSampleCount(1000));

            case CounterStatType.Hits2000:
                return(this.GetSampleCount(2000));

            case CounterStatType.Hits5000:
                return(this.GetSampleCount(5000));

            case CounterStatType.Hits10000:
                return(this.GetSampleCount(10000));

            case CounterStatType.SubAvg:
                return(_counter.SubAvg);

            default:
                throw new NotSupportedException(string.Format(
                                                    CultureInfo.CurrentCulture,
                                                    SR.ExceptionUnknowType,
                                                    statType));
            }
        }
示例#10
0
        /// <summary>
        /// Rend une statistique au format HTML.
        /// </summary>
        /// <param name="hyperCube">Hypercube contenant les données.</param>
        /// <param name="writer">Writer HTML.</param>
        /// <param name="counter">Compteur.</param>
        /// <param name="counterDefinition">Définition du compteur.</param>
        /// <param name="link">Indique si un lien doit être créé pour la selection des graphiques.</param>
        /// <param name="context">Contexte courant de la requête.</param>
        /// <param name="counterStatType">Type de statistique du compteur à rendre.</param>
        private static void StatToHtml(IHyperCube hyperCube, HtmlTextWriter writer, ICounter counter, ICounterDefinition counterDefinition, bool link, Context context, CounterStatType counterStatType)
        {
            writer.Write(HtmlPageRenderer.Indent2);
            writer.Write("<td class=\"monitoring\" align=\"right\" " + GetHtmlStyle(counterDefinition, counter.GetValue(counterStatType)) + '>');
            writer.Write(string.Format(CultureInfo.CurrentCulture, "{0:0.##}", counter.GetValue(counterStatType)));
            writer.WriteLine("</td>");

            if (counter.HasInfo(counterStatType))
            {
                writer.Write(HtmlPageRenderer.Indent2);
                writer.Write("<td class=\"monitoring\">");
                writer.Write(HtmlPageRenderer.GetLink(context.Zoom(hyperCube.Name, counter.GetInfo(counterStatType)), counter.GetInfo(counterStatType), link));
                writer.WriteLine("</td>");
            }
        }
示例#11
0
        /// <summary>
        /// Tri une liste.
        /// </summary>
        /// <param name="hyperCube">Hybercube contenant les éléments de la liste.</param>
        /// <param name="allAxis">Liste des axes.</param>
        /// <param name="date">Date des valeurs à trier.</param>
        /// <param name="counterDefinitionCode">Compteur à trier.</param>
        /// <param name="statType">Type de statistique à trier.</param>
        /// <returns>Liste triée par ordre croissant des valeurs sur les axes.</returns>
        private static List <string> SortAllAxis(IHyperCube hyperCube, ICollection <string> allAxis, DateTime date, string counterDefinitionCode, CounterStatType statType)
        {
            // On crée une nouvelle liste pour pouvoir la trier sans toucher à l'originale.
            List <string> countersList = new List <string>(allAxis);

            countersList.Sort(new HyperCubeComparer(hyperCube, date, counterDefinitionCode, statType, TimeLevel.Hour));
            return(countersList);
        }