示例#1
0
        /// <summary>
        /// Retourne un cube.
        /// </summary>
        /// <param name="key">Clef.</param>
        /// <returns>Cube.</returns>
        internal Cube GetCube(CubeKey key)
        {
            Cube cube;

            _datas.TryGetValue(key, out cube);
            return(cube);
        }
示例#2
0
        /// <summary>
        /// Retourne cube qui peut être null.
        /// </summary>
        /// <param name="key">CubeKey.</param>
        /// <returns>CounterCube.</returns>
        ICube IHyperCube.GetCube(CubeKey key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            HyperCubeRamCounters counters = GetCounters(key.Axis);

            return((counters == null) ? null : counters.GetCube(key));
        }
示例#3
0
        /// <summary>
        /// Test l'égalité de deux objets.
        /// </summary>
        /// <param name="obj">Objet à tester.</param>
        /// <returns>True si les deux objets sont égaux.</returns>
        public override bool Equals(object obj)
        {
            CubeKey cube = obj as CubeKey;

            if (cube != null)
            {
                return(cube._axis.Equals(_axis) &&
                       cube._level.Equals(_level) &&
                       cube._dateKey.Equals(_dateKey));
            }

            return(false);
        }
示例#4
0
 /// <summary>
 /// Initialise les données à partir d'un compteur.
 /// </summary>
 /// <param name="counter">Compteur.</param>
 /// <param name="data">Objet de données.</param>
 /// <param name="key">Clef du cube.</param>
 /// <param name="databaseName">Nom de la base de données.</param>
 internal static void InitCounterData(ICounter counter, CounterData data, CubeKey key, string databaseName)
 {
     data.Axis           = key.Axis;
     data.DatabaseName   = databaseName;
     data.Hits           = counter.GetValue(CounterStatType.Hits);
     data.Last           = counter.GetValue(CounterStatType.Last);
     data.Level          = (key.Level == TimeLevel.Minute) ? "MIN" : "HEU";
     data.Max            = counter.GetValue(CounterStatType.Max);
     data.MaxName        = counter.GetInfo(CounterStatType.Max);
     data.Min            = counter.GetValue(CounterStatType.Min);
     data.MinName        = counter.GetInfo(CounterStatType.Min);
     data.StartDate      = key.DateKey;
     data.Total          = counter.GetValue(CounterStatType.Total);
     data.TotalOfSquares = counter.GetValue(CounterStatType.TotalOfSquares);
 }
示例#5
0
        /// <summary>
        /// Constructeur.
        /// </summary>
        /// <param name="key">Clé du cube.</param>
        /// <param name="databaseName">Nom de la base de données.</param>
        internal Cube(CubeKey key, string databaseName)
        {
            this._databaseName = databaseName;
            this._key          = key;

            _elapsedTimeCounter = new CounterTime();

            // Etendu signifie que les statistiques sont collectées et agrégées aussi par compteur.
            if (_key.Level.IsExtended)
            {
                _extendedMap = new Dictionary <string, CounterHit>();
            }
            else
            {
                _extendedMap = null;
            }
        }
示例#6
0
        /// <summary>
        /// Ajoute une valeur au store.
        /// </summary>
        /// <param name="process">Processus.</param>
        internal void AddValue(CounterProcess process)
        {
            CubeKey key = new CubeKey(process.Date, _axis, _level);

            lock (this) {
                Cube cube = GetCube(key);
                if (cube == null)
                {
                    cube = new Cube(key, _databaseName);
                    _datas.Add(key, cube);
                    _keyList.AddLast(key);
                    if (_datas.Count > _maxValueCount)
                    {
                        CubeKey firstKey = _keyList.First.Value;
                        _keyList.RemoveFirst();
                        _datas.Remove(firstKey);
                    }
                }

                cube.AddValue(process);
            }
        }
示例#7
0
 /// <summary>
 /// Retourne le cube pour une clef.
 /// </summary>
 /// <param name="key">Clef.</param>
 /// <returns>Cube.</returns>
 internal Cube GetCube(CubeKey key)
 {
     return(GetCounterDataStore(key.Level).GetCube(key));
 }