コード例 #1
0
        /// <summary>
        /// Retrive Performance counter data
        /// </summary>
        /// <param name="counterFullName">Perfomance counter specifier full name</param>
        /// <param name="roleInstanceName">Deployment id</param>
        /// <param name="startPeriod">Start sample date time</param>
        /// <param name="endPeriod">End sample date time</param>
        /// <returns></returns>
        public IEnumerable <PerformanceData> GetPerformanceCounters(String counterFullName, String roleInstanceName, DateTime startPeriod, DateTime endPeriod)
        {
            //create context for WAD table
            WADPerformanceTable context = new WADPerformanceTable(_accountStorage.TableEndpoint.ToString(), _accountStorage.Credentials);

            //query for pefomance counters
            CloudTableQuery <PerformanceData> query = (from row in context.Queryable
                                                       where row.CounterName == counterFullName &&
                                                       row.EventTickCount >= startPeriod.Ticks &&
                                                       row.EventTickCount <= endPeriod.Ticks &&
                                                       row.RoleInstance.Equals(roleInstanceName)
                                                       select row).AsTableServiceQuery();

            List <PerformanceData> selectedData;

            try
            {
                selectedData = query.Execute().ToList();
            }
            catch (Exception exception)
            {
                //TODO: log
                throw;
            }
            return(selectedData);
        }
コード例 #2
0
        /// <summary>
        /// Retrive Performance counter data
        /// </summary>
        /// <param name="counterFullName">Perfomance counter specifier full name</param>
        /// <param name="roleInstanceName">Deployment id</param>
        /// <param name="startPeriod">Start sample date time</param>
        /// <param name="endPeriod">End sample date time</param>
        /// <returns></returns>
        public IEnumerable<PerformanceData> GetPerformanceCounters(String counterFullName, String roleInstanceName, DateTime startPeriod, DateTime endPeriod)
        {
            //create context for WAD table
            WADPerformanceTable context = new WADPerformanceTable(_accountStorage.TableEndpoint.ToString(), _accountStorage.Credentials);

            //query for pefomance counters
            CloudTableQuery<PerformanceData> query = (from row in context.Queryable
                                                      where row.CounterName == counterFullName
                                                         && row.EventTickCount >= startPeriod.Ticks
                                                         && row.EventTickCount <= endPeriod.Ticks
                                                         && row.RoleInstance.Equals(roleInstanceName)
                                                      select row).AsTableServiceQuery();

            List<PerformanceData> selectedData;
            try
            {
                selectedData = query.Execute().ToList();
            }
            catch (Exception exception)
            {
                //TODO: log
                throw;
            }
            return selectedData;
        }