예제 #1
0
        async Task IStatistics.UpdateStats(string StatStorName, Dictionary <int, RequestStats> Data)
        {
            try
            {
                ActorId StoreId = StatStorName.ToActorId();
                Dictionary <int, RequestStats> Stored = await StoreId.LoadGeneric <Dictionary <int, RequestStats> >();

                if (Stored == null)
                {
                    Stored = new Dictionary <int, RequestStats>();
                }
                if (Data != null)
                {
                    foreach (int k in Data.Keys)
                    {
                        if (!Stored.ContainsKey(k))
                        {
                            Stored.Add(k, new RequestStats(k));
                        }
                        Stored[k].CompressedSize += Data[k].CompressedSize;
                        Stored[k].NumCalls       += Data[k].NumCalls;
                        Stored[k].TotalTime      += Data[k].TotalTime;
                        Stored[k].TotalSize      += Data[k].TotalSize;
                    }
                    await Stored.SaveGeneric(StoreId);
                }
            }
            catch (Exception E)
            {
                this.Log(E);
                throw (E);
            }
        }
예제 #2
0
        async Task <string> IStatistics.GetStatisticsJSon(string StatStorName)
        {
            try
            {
                ActorId StoreId = StatStorName.ToActorId();
                Dictionary <int, RequestStats> Stored = await StoreId.LoadGeneric <Dictionary <int, RequestStats> >();

                List <RequestStats> toReturn = new List <RequestStats>();
                foreach (int k in Stored.Keys)
                {
                    toReturn.Add(Stored[k]);
                }
                return(toReturn.Serialize());
            }
            catch (Exception E)
            {
                this.Log(E);
                throw (E);
            }
        }