private void addKibitzerToolStripMenuItem1_Click(object sender, EventArgs e) { LoadEngine objloadengine = new LoadEngine(base.Game, this); objloadengine.IsAddKibitzer = true; objloadengine.ShowDialog(); }
private void lblEngine_Click(object sender, EventArgs e) { if (IsKibitzer) { return; } if (this.EngineAnalysis.Game.GameMode != GameMode.EngineVsEngine) { LoadEngine objLoadEngine = new LoadEngine(this.Game, this.MainForm); if (objLoadEngine.ShowDialog() == DialogResult.OK) { this.MainForm.ChangeMainEngine(objLoadEngine.SelectedEngine); } } }
internal void TestLoad(BatchPayload batchPayload) { if (batchPayload.LoadSize <= 0) { AddLog("no load specified"); return; } if (batchPayload.Requests.Count == 0) { AddLog("no request specified"); return; } if (batchPayload.ThroughputSize <= 0) { batchPayload.ThroughputSize = 1; } var grandResults = new List <KeyValuePair <Payload, LoadResult> >(); var grandReport = new StringBuilder(); grandReport.AppendLine(new string('*', 80)); grandReport.AppendLine(string.Format("task: {0}", batchPayload.Name)); grandReport.AppendLine(string.Format("load: {0}", batchPayload.LoadSize)); grandReport.AppendLine(string.Format("grand started: {0}", DateTime.Now)); grandReport.AppendLine(new string('-', 50)); AddLog(grandReport.ToString()); batchPayload.BatchSizes.ForEach(batchSize => { var load = new Payload { LoadSize = batchPayload.LoadSize, Requests = batchPayload.Requests, Auth = batchPayload.Auth, ConcurrentSize = batchSize, ThroughputSize = batchPayload.ThroughputSize }; AddLog("concurrent: " + load.ConcurrentSize); AddLog("started: " + DateTime.Now.ToString()); AddLog("requests: "); load.Requests.ForEach(r => { AddLog(string.Format("\t{0}", r.Url)); }); var engine = new LoadEngine(load); engine.Progress += (s, e) => { if (e.Completed % e.Load.ThroughputSize == 0) { AddLog(string.Format("current: {0} / {1}", e.Completed, load.LoadSize)); } }; engine.Throughput += (s, e) => { AddLog("throughput:"); AddLog(string.Format("\tavg: {0} ms/hit, {1} hits/s", e.AvgTime, Math.Round(e.HitsPerSecond, 3))); AddLog(string.Format("\ttotal: {0} KB, {1} KB/hit", e.TotalBytes.ToKB(), e.BytesPerHit.ToKB())); }; var result = engine.Run(); grandResults.Add(new KeyValuePair <Payload, LoadResult>(load, result)); var report = new StringBuilder(); report.AppendLine(string.Format("concurrent: {0}", load.ConcurrentSize)); report.AppendLine(string.Format("started: {0}", result.StartedTime.ToString())); report.AppendLine(string.Format("finished: {0}", result.FinishedTime.ToString())); report.AppendLine(string.Format("elapsed: {0}", TimeSpan.FromMilliseconds(result.TotalTime))); report.AppendLine(string.Format("completed: {0}", result.Completed)); report.AppendLine(string.Format("successful: {0}", result.Successful)); report.AppendLine(string.Format("failed: {0}", result.Failed)); report.AppendLine("hits:"); report.AppendLine(string.Format("\tavg: {0} ms/hit, {1} hits/s", result.AvgTime, Math.Round(result.HitsPerSecond, 3))); report.AppendLine(string.Format("\tmin: {0} ms/hit, {1} hits/s", result.MinAvgTime, Math.Round(result.MinHitsPerSecond, 3))); report.AppendLine(string.Format("\tmax: {0} ms/hit, {1} hits/s", result.MaxAvgTime, Math.Round(result.MaxHitsPerSecond, 3))); report.AppendLine(string.Format("\ttotal: {0} KB, {1} KB/hit", result.TotalBytes.ToKB(), result.BytesPerHit.ToKB())); report.AppendLine("requests: "); var successfulRequests = result.Items.Sum(i => i.Requests.Count(r => r.IsSuccessful)); var failedRequests = result.Requests - successfulRequests; report.AppendLine(string.Format("\tcompleted: {0}, successful: {1}, failed: {2}", result.Requests, successfulRequests, failedRequests)); report.AppendLine(string.Format("\tavg: {0} ms/request, {1} requests/s, {2} KB/request", result.AvgRequestTime, Math.Round(result.RequestPerSecond, 3), result.BytesPerRequest.ToKB())); report.AppendLine(new string('-', 50)); AddLog(report.ToString()); }); grandReport = new StringBuilder(); grandReport.AppendLine(string.Format("grand finished: {0}", DateTime.Now)); var totalTime = grandResults.Sum(r => r.Value.TotalTime); grandReport.AppendLine(string.Format("grand elapsed: {0}", TimeSpan.FromMilliseconds(totalTime))); var grandCompleted = grandResults.Sum(r => r.Value.Completed); grandReport.AppendLine(string.Format("grand completed: {0}", grandCompleted)); grandReport.AppendLine(string.Format("grand successful: {0}", grandResults.Sum(r => r.Value.Successful))); grandReport.AppendLine(string.Format("grand failed: {0}", grandResults.Sum(r => r.Value.Failed))); grandReport.AppendLine("grand hits:"); var avgTime = grandResults.Average(r => r.Value.FinishedTime.Subtract(r.Value.StartedTime).TotalMilliseconds / r.Value.Completed); grandReport.AppendLine(string.Format("\tavg: {0} ms/hit, {1} hits/s", Math.Round(avgTime, 1), Math.Round(1000.0 / avgTime, 3))); var minAvgTime = grandResults.Min(r => r.Value.MinAvgTime); var minHitsPerSecond = grandResults.Min(r => r.Value.MinHitsPerSecond); grandReport.AppendLine(string.Format("\tmin: {0} ms/hit, {1} hits/s", minAvgTime, Math.Round(minHitsPerSecond, 3))); var maxAvgTime = grandResults.Max(r => r.Value.MaxAvgTime); var maxHitsPerSecond = grandResults.Max(r => r.Value.MaxHitsPerSecond); grandReport.AppendLine(string.Format("\tmax: {0} ms/hit, {1} hits/s", maxAvgTime, Math.Round(maxHitsPerSecond, 3))); var totalKB = grandResults.Sum(r => r.Value.TotalBytes / 1024); grandReport.AppendLine(string.Format("\ttotal: {0} KB, {1} KB/hit", totalKB, totalKB / grandCompleted)); grandReport.AppendLine("grand requests:"); var grandRequests = grandResults.Sum(r => r.Value.Requests); var grandSuccessfulRequests = grandResults.Sum(r => r.Value.Items.Sum(i => i.Requests.Count(e => e.IsSuccessful))); var grandFailedRequests = grandRequests - grandSuccessfulRequests; grandReport.AppendLine(string.Format("\tcompleted: {0}, successful: {1}, failed: {2}", grandRequests, grandSuccessfulRequests, grandFailedRequests)); var grandAvgRequestTime = totalTime / grandRequests; grandReport.AppendLine(string.Format("\tavg: {0} ms/request, {1} requests/s, {2} KB/request", Math.Round(grandAvgRequestTime, 1), Math.Round(1000.0 / grandAvgRequestTime, 3), totalKB / grandRequests)); grandReport.AppendLine(new string('-', 50)); grandReport.AppendLine("Concurrent Users\tAvg Time(ms)/Hit\tHits/s\tTotal Througput(KB)\tAvg Throughput(KB)"); grandResults.ForEach(r => { grandReport.AppendLine(string.Format("{0}\t{1}\t{2}\t{3}\t{4}KB", r.Key.ConcurrentSize, r.Value.AvgTime, Math.Round(r.Value.HitsPerSecond, 3), r.Value.TotalBytes.ToKB(), r.Value.BytesPerHit.ToKB())); }); AddLog(grandReport.ToString()); }
/// <summary> /// set iamge load engine /// </summary> /// <param name="engine"> /// @return </param> public BulbPlugin SetEngine(LoadEngine engine) { this.engine = engine; return(this); }
public AsyncSongLoader(LoadEngine engine, TagReaderFactory tagReaderFactory) { this.engine = engine; this.tagReaderFactory = tagReaderFactory; }
public AsyncSongLoader(LoadEngine engine, ISongCollector songCollector) { this.engine = engine; this.songCollector = songCollector; }
public AsyncSongLoader(LoadEngine engine) { this.engine = engine; }
public void Run() { if (!_settings.MainDbConnectionInfo.TestConnection()) { Console.Error.WriteLine("Invalid connection info"); return; } _testStartTime = DateTime.Now; _testGuid = Guid.NewGuid(); _backgroundWorkerCTS = new System.Threading.CancellationTokenSource(); _exceptions = new Dictionary <string, int>(); _totalIterations = 0; _activeThreads = 0; _totalTime = 0; _totalCpuTime = 0; _totalElapsedTime = 0; _totalTimeMessages = 0; _totalLogicalReads = 0; _totalReadMessages = 0; _totalExceptions = 0; _totalExpectedIterations = _settings.NumThreads * _settings.NumIterations; var paramConnectionInfo = _settings.ShareDbSettings ? _settings.MainDbConnectionInfo : _settings.ParamDbConnectionInfo; _numThreads = _runParameters.NumberOfThreads ?? _settings.NumThreads; var query = _settings.MainQuery; if (_runParameters.Input != null) { query = File.ReadAllText(_runParameters.Input.FullName, Encoding.UTF8); } var engine = new LoadEngine(_settings.MainDbConnectionInfo.ConnectionString, query, _numThreads, _settings.NumIterations, _settings.ParamQuery, _settings.ParamMappings, paramConnectionInfo.ConnectionString, _settings.CommandTimeout, _settings.CollectIoStats, _settings.CollectTimeStats, _settings.ForceDataRetrieval, _settings.KillQueriesOnCancel, _backgroundWorkerCTS); backgroundWorker1.WorkerReportsProgress = true; backgroundWorker1.WorkerSupportsCancellation = true; backgroundWorker1.DoWork += new DoWorkEventHandler(this.backgroundWorker1_DoWork); backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged); backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted); backgroundWorker1.RunWorkerAsync(engine); //timer.Elapsed += Timer_Elapsed; //timer.AutoReset = true; //timer.Enabled = true; _start = new TimeSpan(DateTime.Now.Ticks); while (backgroundWorker1.IsBusy) { Thread.Sleep(1000); } Thread.Sleep(2000); }