Example #1
0
        public static List<Performance> GetTcpFail()
        {
            var account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            var context = new PerformanceDataContext(account.TableEndpoint.ToString(), account.Credentials);
            var data = context.PerfData;
            var timeFrameInMinutes = 30;
            DateTime tf =
            DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(timeFrameInMinutes));

            System.Collections.Generic.List<PerformanceData> selectedData = (from d in
                                                                                 data
                                                                             where
            d.CounterName == @"\TCPv4\Connection Failures"
            &&
            (DateTime.Compare(tf, d.Timestamp) < 0)
                                                                             select
            d).ToList<PerformanceData>();
            var performacelist = new List<Performance>();
            if (selectedData.Count >= 10)
            {
                selectedData = selectedData.GetRange(selectedData.Count - 10, 10);
                foreach (PerformanceData temp in selectedData)
                {
                    performacelist.Add(new Performance(temp));
                }
            }

            return performacelist;
        }
Example #2
0
        public static List<Performance> GetProcessorTime()
        {
            var account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            var context = new PerformanceDataContext(account.TableEndpoint.ToString(), account.Credentials);
            var data = context.PerfData;
            var timeFrameInMinutes = 30;
            DateTime tf =
            DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(timeFrameInMinutes));

            System.Collections.Generic.List<PerformanceData> selectedData = (from d in
                                                                                 data
                                                                             where
            d.CounterName == @"\Processor(_Total)\% Processor Time"
            &&
            (DateTime.Compare(tf, d.Timestamp) < 0)
                                                                             select
            d).ToList<PerformanceData>();

            //            List<Double> CPUList = new List<Double>();
            var performacelist = new List<Performance>();
            if (selectedData.Count >= 10)
            {
                selectedData = selectedData.GetRange(selectedData.Count - 10, 10);
                foreach (PerformanceData temp in selectedData)
                    performacelist.Add(new Performance(temp));
            }

            return performacelist;
            /*      foreach(PerformanceData temp in selectedData)
                  {
                      CPUList.Add(temp.CounterValue);
                      Trace.WriteLine(temp.CounterValue);
                  }

                  return selectedData;
             /*

                 List<double> AvgCPU = (from d in selectedData
                                        where d.CounterName == @"\Processor(_Total)\% Processor Time"
                                        select d.CounterValue);
             ;

             if (AvgCPU.Count >= 10)
             return AvgCPU.GetRange(AvgCPU.Count - 10, AvgCPU.Count - 1);
             else
             return AvgCPU;
              *
              */
        }