public Handler.PerformanceData.DataTypes.PerformanceStatisticsForPageCollection GetStatisticsForAllPages(DateTime forDate)
        {
            FlushNotProcessedPackets();
            lock (_readerLock) {
                var pages = GetPerPageDistributionDictionary(forDate).Select(p => PerformanceStatisticsForPage.Calculate(p.Value.ToArray(), p.Key)).ToArray();

                var allPages = PerformanceStatisticsForPage.Calculate(GetAllPagesDistribution(forDate).ToArray(), "All Pages");

                return(new PerformanceStatisticsForPageCollection(pages, allPages));
            }
        }
Ejemplo n.º 2
0
        public DataTypes.PerformanceStatisticsForPageCollection GetStatisticsForAllPages(DateTime forDate)
        {
            if (!_getStatisticsForAllPagesCache.ContainsKey(forDate))
            {
                FillCache(forDate);
            }

            var allStats = _getStatisticsForAllPagesCache[forDate];

            return(new PerformanceStatisticsForPageCollection(
                       _perPageCache[forDate].Keys.Select(pp => PerformanceStatisticsForPage.Calculate(_perPageCache[forDate][pp], pp)).ToArray(),
                       PerformanceStatisticsForPage.Calculate(allStats, "All Pages")
                       ));
        }
Ejemplo n.º 3
0
        private PerformanceStatisticsForPageCollection GetRequestsForDate(DateTime forDate)
        {
            using (var connection = new SqlConnection(_connectionString)) {
                var q = connection.CreateCommand();
                q.CommandText = "select Duration,PageId from Requests where Timestamp>=@From and Timestamp<@Till";
                q.Parameters.Add(new SqlParameter("From", forDate));
                q.Parameters.Add(new SqlParameter("Till", forDate.AddDays(1)));

                connection.Open();

                var overall = new List <int>();
                var pages   = new Dictionary <int, List <int> >();

                using (var rdr = q.ExecuteReader()) {
                    while (rdr.Read())
                    {
                        var page = (int)rdr[1];

                        var duration = (int)rdr[0];

                        overall.Add(duration);

                        if (!pages.ContainsKey(page))
                        {
                            pages[page] = new List <int>();
                        }

                        pages[page].Add(duration);
                    }
                }

                var pageIdToNameMap = _pageIdProvider.GetPageNames(pages.Keys);

                return(new PerformanceStatisticsForPageCollection(
                           pages.Keys.Select(p => PerformanceStatisticsForPage.Calculate(pages[p].ToArray(), pageIdToNameMap[p])).ToArray(),
                           //new PerformanceStatisticsForPage[0],
                           PerformanceStatisticsForPage.Calculate(overall.ToArray(), "All pages")
                           ));
            }
        }