コード例 #1
0
ファイル: AutoTest.cs プロジェクト: FionaQi/MyOJSolutions
        public void StartSingleTest(string filepath, int index, int totalTestSeconds = 10000, int recordInterval = 500)
        {
            testConfig config      = testConfigSet[index];
            int        recordTimes = totalTestSeconds / recordInterval;

            if (Directory.Exists(filepath) == false)
            {// if dir not exist, create it!
                Directory.CreateDirectory(filepath);
            }
            TextWriter fwrite = File.CreateText(filepath + config.GenerateFileName(index.ToString()));
            //!!!!
            HydraClientBenchmark clientBenchmark = new HydraClientBenchmark(config.maxOutgoing, new KeyValueStreams(this.streamConfig));

            clientBenchmark.Start();
            Thread.Sleep(3000); //record after 3 second
            for (int i = 0; i < recordTimes; i++)
            {
                clientBenchmark.DumpToFile(fwrite);
                REPORTER("{0}/{1}", i + 1, recordTimes);
                Thread.Sleep(recordInterval); //get every second
            }
            fwrite.Close();
            clientBenchmark.KillAllThread();
        }
コード例 #2
0
ファイル: AutoTest.cs プロジェクト: FionaQi/MyOJSolutions
 public void StartSingleTest(string filepath, int index, int totalTestSeconds = 10000, int recordInterval = 500)
 {
     testConfig config = testConfigSet[index];
     int recordTimes = totalTestSeconds / recordInterval;
     if (Directory.Exists(filepath) == false)
     {// if dir not exist, create it!
         Directory.CreateDirectory(filepath);
     }
     TextWriter fwrite = File.CreateText(filepath + config.GenerateFileName(index.ToString()));
     //!!!!
     HydraClientBenchmark clientBenchmark = new HydraClientBenchmark(config.maxOutgoing, new KeyValueStreams(this.streamConfig));
     clientBenchmark.Start();
     Thread.Sleep(3000); //record after 3 second
     for (int i = 0; i < recordTimes; i++)
     {
         clientBenchmark.DumpToFile(fwrite);
         REPORTER("{0}/{1}", i + 1, recordTimes);
         Thread.Sleep(recordInterval); //get every second
     }
     fwrite.Close();
     clientBenchmark.KillAllThread();
 }
コード例 #3
0
 public override void Run(RuntimeContext context, IChannel channel)
 {
     HydraClientBenchmark clientBenchmark = new HydraClientBenchmark(TESTCONFIG.maxOutgoing);
     clientBenchmark.Start(TESTCONFIG.threadNum);
     while (true)
     {
         Observer observer = clientBenchmark.Get();
         counters.AssignFromObserver(observer);
         InstrumentationHelper.Debug(
             "report:",
             "success[-]: [counters: {0},{1},{2},{3},{4},{5},{6}]",
             observer.sendRate, observer.successRate, observer.failSendRate, observer.failResponseRate,
             observer.expiredRate, observer.keyNotFoundRate, observer.latency
             );
         Thread.Sleep(1000);
     }
 }