예제 #1
0
        public override Task OnActivateAsync()
        {
            this.State = new StatsState();

            Logger.OrleansLogger = this.GetLogger();
            Logger.LogVerbose(this.GetLogger(), "StatsGrain", "OnActivate", "Enter");

            this.State.SiloSentMsgs = new Dictionary <string, Dictionary <string, long> >();
            this.State.SiloRecvMsgs = new Dictionary <string, Dictionary <string, long> >();

            this.State.SiloActivations   = new Dictionary <string, Dictionary <string, long> >();
            this.State.SiloDeactivations = new Dictionary <string, Dictionary <string, long> >();

            this.State.GrainClasses   = new HashSet <string>();
            this.State.SiloClientMsgs = new Dictionary <string, long>();

            this.operationCounter    = new Dictionary <string, long>();
            this.messages            = 0;
            this.clientMessages      = 0;
            this.updatesCounter      = 0;
            this.worklistSizeCounter = 0;
            this.latencyInfo         = new LatencyInfo
            {
                AccumulattedTimeDifference = 0,
                MaxLatency    = 0,
                MaxLatencyMsg = ""
            };

            Logger.LogVerbose(this.GetLogger(), "StatsGrain", "OnActivate", "Exit");
            return(Task.CompletedTask);
        }
예제 #2
0
        public async Task ResetStats()
        {
            await this.ClearStateAsync();

            this.State.SiloSentMsgs.Clear();
            this.State.SiloRecvMsgs.Clear();
            this.State.SiloActivations.Clear();
            this.State.SiloDeactivations.Clear();
            this.State.SiloClientMsgs.Clear();
            this.operationCounter.Clear();
            this.State.GrainClasses.Clear();
            this.messages       = 0;
            this.clientMessages = 0;
            this.memoryUsage    = 0;
            this.operationCounter.Clear();
            this.updatesCounter = 0;

            this.latencyInfo = new LatencyInfo()
            {
                AccumulattedTimeDifference = 0,
                MaxLatency    = 0,
                MaxLatencyMsg = ""
            };
            await this.WriteStateAsync();
        }