Beispiel #1
0
        private static void StartReporting(GuildService serv)
        {
            if (!FeatureMatrix.IsEnable("ServiceReporter"))
            {
                return;
            }
            int num = ServiceReporterSettings.Get("GuildService.Interval", 60);

            ServiceReporter.Instance.Initialize("GuildService");
            ServiceReporter.Instance.AddGathering("Stat", new ServiceReporter.GatheringDelegate <int>(serv.OnGatheringStat));
            ServiceReporter.Instance.Start(num * 1000);
        }
Beispiel #2
0
        public static void StartReporting(DSService serv)
        {
            if (!FeatureMatrix.IsEnable("ServiceReporter"))
            {
                return;
            }
            ServiceReporter.Instance.Initialize("DSService");
            int num = ServiceReporterSettings.Get("DSService.FPS.Interval", 60);

            ServiceReporter.Instance.AddSubject("FPS", null, num * 1000);
            ServiceReporter.Instance.AddGathering("Stat", new ServiceReporter.GatheringDelegate <int>(serv.OnGatheringStat));
            ServiceReporter.Instance.AddGathering("FPS", new ServiceReporter.GatheringDelegate <int>(serv.OnGatheringFPS));
            int num2 = ServiceReporterSettings.Get("DSService.Interval", 60);

            ServiceReporter.Instance.Start(num2 * 1000);
        }
Beispiel #3
0
 public void Initialize(string serviceName)
 {
     try
     {
         this.ServiceName                     = serviceName;
         this.GameCode                        = FeatureMatrix.GameCode;
         this.ServerCode                      = FeatureMatrix.ServerCode;
         this.RowNumber                       = 0;
         this.MachineIP                       = this.GetMachineIP();
         this.Proc                            = Process.GetCurrentProcess();
         this.ProcessID                       = this.Proc.Id;
         this.CpuUsage                        = new CpuUsage();
         this.FileWatcher.Path                = Directory.GetCurrentDirectory();
         this.FileWatcher.Filter              = "ServiceCore.dll.config";
         this.FileWatcher.NotifyFilter        = (NotifyFilters.LastWrite | NotifyFilters.LastAccess);
         this.FileWatcher.Changed            += this.SettingChanged;
         this.FileWatcher.EnableRaisingEvents = true;
         ((Hierarchy)LogManager.GetRepository()).Root.AddAppender(this);
         int interval  = ServiceReporterSettings.GetInterval(this.ServiceName + ".Perf", 60);
         int interval2 = ServiceReporterSettings.GetInterval(this.ServiceName + ".Log", 60);
         this.AddPerfSubject("Perf", interval * 1000, new ServiceReporter.GatheringDelegate <int>(this.OnGathringPerf));
         this.AddLogSubject("Log", interval2 * 1000, new ServiceReporter.GatheringDelegate <int>(this.OnGatheringLog));
         int interval3 = ServiceReporterSettings.GetInterval(this.ServiceName + ".Stat", 60);
         this.AddSubject("Stat", null, interval3 * 1000);
         int interval4 = ServiceReporterSettings.GetInterval("ProfileScope", 3600);
         this.AddProfileScopeSubject("ProfileScope", interval4 * 1000, new ServiceReporter.GatheringDelegate <double>(this.OnGatheringProfileScope));
         this.InitTime = DateTime.Now;
         if (!Directory.Exists("csv"))
         {
             Directory.CreateDirectory("csv");
         }
         this.WritePreds();
     }
     catch (Exception ex)
     {
         Log <ServiceReporter> .Logger.Error("ServiceReporter.Initialize() FAILED!", ex);
     }
 }
Beispiel #4
0
        private void SettingChanged(object sender, FileSystemEventArgs e)
        {
            try
            {
                Log <ServiceReporter> .Logger.Info("ServiceReporter.SettingChanged()");

                ConfigurationManager.RefreshSection("ServiceReporterSettings");
                foreach (ServiceReporter.SubjectEntry subjectEntry in this.Subjects)
                {
                    int num = ServiceReporterSettings.GetInterval(this.ServiceName + subjectEntry.SubjName, subjectEntry.GatheringInterval) * 1000;
                    num = Math.Max(num, 1000);
                    subjectEntry.GatheringInterval = num;
                }
                this.Stop();
                int num2 = ServiceReporterSettings.GetInterval(this.ServiceName, 60) * 1000;
                if (num2 > 1)
                {
                    this.Start(num2);
                }
            }
            catch (Exception)
            {
            }
        }