示例#1
0
        /// <summary>
        /// Ajoute une nouvelle valeur.
        /// </summary>
        /// <param name="process">Processus.</param>
        internal void AddValue(CounterProcess process)
        {
            this.IsModified = true;

            string info;

            if ("global".Equals(_key.Axis))
            {
                info = process.Name;
            }
            else
            {
                info = Convert.ToString(process.Date, DateFormatSecond);
            }

            _lastMilliSeconds = process.Date.Ticks / 10000;
            if (_firstMilliSeconds == -1)
            {
                _firstMilliSeconds = _lastMilliSeconds;
            }

            _elapsedTimeCounter.AddValue(process, info);

            if (_key.Level.IsExtended)
            {
                Dictionary <string, long> counters = process.Counters;
                foreach (string code in counters.Keys)
                {
                    CounterHit counter;
                    lock (_extendedMap) {
                        if (!_extendedMap.TryGetValue(code, out counter))
                        {
                            counter = new CounterHit(this);
                            _extendedMap.Add(code, counter);
                        }
                    }

                    counter.AddValue(counters[code], info);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Ajoute tous les compteurs à la collection.
        /// </summary>
        /// <param name="moduleKey">Clef de module.</param>
        /// <param name="counterDataList">Listes des compteurs.</param>
        void ICube.ExportCounters(object moduleKey, ICollection <CounterData> counterDataList)
        {
            if (counterDataList == null)
            {
                throw new ArgumentNullException("counterDataList");
            }

            counterDataList.Add(this.TimeData);

            if (_extendedMap == null)
            {
                return;
            }

            foreach (string code in _extendedMap.Keys)
            {
                CounterHit  counter = _extendedMap[code];
                CounterData data    = new CounterData();
                data.CounterCode  = code;
                data.CounterLabel = Analytics.Instance.DefinitionRepository.ValueOf(code).Label;
                InitCounterData(counter, data, _key, _databaseName);
                counterDataList.Add(data);
            }
        }