예제 #1
0
        /// <summary>
        /// 取得Redis Memory資訊
        /// </summary>
        /// <returns></returns>
        public MemoryChart GetMemoryInfo(List <RedisInfo> list)
        {
            var result = new MemoryChart();

            result.Title     = "Memory Usage";
            result.XAxisName = "Time";
            result.XAxisList = new List <string>
            {
                //"00:00", "04:00", "08:00", "12:00", "16:00", "20:00"
            };
            result.YAxisName = "Kilo Byte";
            result.YAxisList = new List <string>
            {
                "300", "600", "900", "1200", "1500"
            };
            //result.DataList = new List<decimal>
            //{
            //    1200, 1400, 1008, 1411, 1026, 1288, 1300, 800, 1100, 1000, 1118, 1322
            //};

            result.DataList = new List <decimal>();
            decimal accumulationBytes = 0;

            foreach (var info in list)
            {
                decimal usedBytes = Convert.ToDecimal(info.Memory.used_memory);
                decimal bytes     = (usedBytes - accumulationBytes) / 1000; //Byte轉成Kb
                result.DataList.Add(bytes);
                result.XAxisList.Add(info.CollectTime.ToString("HH:mm"));
            }

            return(result);
        }
 public void SetActiveSession(IMemoryProfilingSession session)
 {
     _session = session;
     HeapChart.SetContent(session.HeapStatistics);
     MemoryChart.SetContent(session.ManagedMemoryStatistics, session.UnmanagedMemoryStatistics);
     DataTypeAllocationStatisticsGrid.SetInputSource(session.DataTypeAllocationStatistics);
     DataTypeMemoryStatisticsGrid.SetInputSource(session.DataTypeMemoryStatistics, DisplayValueChanged);
 }