public async Task <Possible <CacheSessionStatistics[], Failure> > GetStatisticsAsync(Guid activityId)
        {
            using (var eventing = new GetStatisticsActivity(CompositingCache.EventSource, activityId, this))
            {
                eventing.Start();

                List <CacheSessionStatistics> stats = new List <CacheSessionStatistics>();

                // TODO:  We should have our own to report out too...
                // Make sure to ETW them too (but only our own and only upon first generation)
                // and add them to the list of stats
                var maybeStats = await m_casSession.GetStatisticsAsync();

                if (!maybeStats.Succeeded)
                {
                    return(eventing.StopFailure(maybeStats.Failure));
                }

                stats.AddRange(maybeStats.Result);

                maybeStats = await m_metadataSession.GetStatisticsAsync();

                if (!maybeStats.Succeeded)
                {
                    return(eventing.StopFailure(maybeStats.Failure));
                }

                stats.AddRange(maybeStats.Result);

                eventing.Stop();
                return(stats.ToArray());
            }
        }
Ejemplo n.º 2
0
        public Task <Possible <CacheSessionStatistics[], Failure> > GetStatisticsAsync(Guid activityId)
        {
            using (var eventing = new GetStatisticsActivity(BasicFilesystemCache.EventSource, activityId, this))
            {
                eventing.Start();

                CacheSessionStatistics[] result = new CacheSessionStatistics[1];
                result[0] = new CacheSessionStatistics(CacheId, m_cache.GetType().FullName, m_finalStats.Value);

                eventing.Stop();
                return(Task.FromResult(new Possible <CacheSessionStatistics[], Failure>(result)));
            }
        }