Ejemplo n.º 1
0
 private static void Show(ServerCounters counters)
 {
     Console.WriteLine("CA: " + counters.Interactive.CompletedAsynchronously);
     Console.WriteLine("FA: " + counters.Interactive.FailedAsynchronously);
     Console.WriteLine("CS: " + counters.Interactive.CompletedSynchronously);
     Console.WriteLine();
 }
Ejemplo n.º 2
0
        private void InitializeTos(IPerformanceCounterTo nativeCounters)
        {
            ServerCounters.Clear();
            ResourceCounters.Clear();
            var performanceCountersByMachines = nativeCounters.GetServerCountersTo();

            foreach (var performanceCountersByMachine in performanceCountersByMachines)
            {
                RegisterPropertyChanged(performanceCountersByMachine);
                ServerCounters.Add(performanceCountersByMachine);
            }
            var performanceCountersByResources = nativeCounters.GetResourceCountersTo();

            foreach (var performanceCountersByResource in performanceCountersByResources)
            {
                RegisterPropertyChanged(performanceCountersByResource);
                ResourceCounters.Add(performanceCountersByResource);
            }
            ResourceCounters.Add(CreateNewCounter());
            SetItem(nativeCounters);
        }
        /// <summary>
        /// Gets the number of redis commands sent and received, and sets the count to 0 so the next time
        ///     we will not see double counts
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void GetConnectionsMessagesSent(object sender, ElapsedEventArgs e)
        {
            bool logCount = RedisConnectionConfig.LogConnectionActionsCountDel != null;

            if (logCount)
            {
                foreach (string connName in RedisConnectionWrapper.RedisConnections.Keys.ToList())
                {
                    try
                    {
                        ConnectionMultiplexer conn;
                        if (RedisConnectionWrapper.RedisConnections.TryGetValue(connName, out conn))
                        {
                            long priorPeriodCount = 0;
                            if (RedisConnectionWrapper.RedisStats.ContainsKey(connName))
                            {
                                priorPeriodCount = RedisConnectionWrapper.RedisStats[connName];
                            }

                            ServerCounters counts   = conn.GetCounters();
                            long           curCount = counts.Interactive.OperationCount;

                            // log the sent commands
                            RedisConnectionConfig.LogConnectionActionsCountDel(
                                connName,
                                curCount - priorPeriodCount);

                            RedisConnectionWrapper.RedisStats[connName] = curCount;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }