Exemplo n.º 1
0
        private void increaseNumRequest()
        {
            if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir))
            {
                Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir);
            }
            int num_request =
                SaverLoader.ReadFromBinaryFile <int>(AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir + Constant.number_request_file);

            num_request += 1;
            SaverLoader.WriteToBinaryFile <int>(
                AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir + Constant.number_request_file, num_request);
        }
Exemplo n.º 2
0
        private void appendEvolutionTime(int seconds)
        {
            if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir))
            {
                Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir);
            }

            IDictionary <DateTime, int> evolution = SaverLoader.ReadFromBinaryFile <IDictionary <DateTime, int> >(
                AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir + Constant.request_time_evolution_file);

            if (evolution == null)
            {
                evolution = new Dictionary <DateTime, int>();
                evolution.Add(DateTime.Now, seconds);
            }
            else
            {
                evolution.Add(DateTime.Now, seconds);
            }
            SaverLoader.WriteToBinaryFile <IDictionary <DateTime, int> >(
                AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir + Constant.request_time_evolution_file, evolution);
        }
Exemplo n.º 3
0
        private void computeMeanRequestTime(int seconds)
        {
            if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir))
            {
                Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir);
            }

            Tuple <int, int> time = SaverLoader.ReadFromBinaryFile <Tuple <int, int> >(
                AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir + Constant.mean_request_time_file);

            if (time == null)
            {
                time = new Tuple <int, int>(1, seconds);
            }
            else
            {
                time = new Tuple <int, int>(time.Item1 + 1, (time.Item2 + seconds) / time.Item1);
            }

            SaverLoader.WriteToBinaryFile <Tuple <int, int> >(
                AppDomain.CurrentDomain.BaseDirectory + Constant.monitoring_dir + Constant.mean_request_time_file, time);
        }