/// <summary> /// Show the completed panel /// </summary> /// <param name="animated"></param> private void ShowCompletedPanel(bool animated = true) { var completedPage = serviceProvider.GetRequiredService <TravelCompletedPanel>(); completedPage.Completed += CompletedCompleted; StepFrame.PushPanel(completedPage, animated: animated); }
private void viewToolStripMenuItem_DropDownOpening(object sender, EventArgs e) { StepFrame selectedFrame = ApplicationManager.GetSelectedStepFrame(); bool state = selectedFrame != null; viewToolStripMenuItem.DropDownItems[6].Visible = state; // Separator. viewToolStripMenuItem.DropDownItems[8].Visible = state; // Show legend. viewToolStripMenuItem.DropDownItems[9].Visible = state; // Legend position. viewToolStripMenuItem.DropDownItems[10].Visible = state; // Logarithmic. if (!state) { return; } LegendPossition position = selectedFrame.SelectedChartPosition; foreach (ToolStripMenuItem menuItem in legendPossitionToolStripMenuItem.DropDownItems) { menuItem.Checked = menuItem.Text == position.ToString(); } showLegendToolStripMenuItem.Checked = selectedFrame.SelectedChartLegendIsVisible; logarithmicToolStripMenuItem.Checked = selectedFrame.SelectedChartIsLogarithmic; }
private StepFrame CreateStepFrame(TestMethod method) { StepFrame stepFrame = new StepFrame(); stepFrame.Text = method.ToString(); stepFrame.Dock = DockStyle.Fill; switch (method) { case TestMethod.Write: stepFrame.Icon = Properties.Resources.w_24x24; break; case TestMethod.Read: stepFrame.Icon = Properties.Resources.r_24x24; break; case TestMethod.SecondaryRead: stepFrame.Icon = Properties.Resources.sr_24x24; break; default: break; } // Hide time, CPU, memory and I/O view from the layout. stepFrame.LayoutPanel.ColumnStyles[1] = new ColumnStyle(SizeType.Absolute, 0); stepFrame.LayoutPanel.ColumnStyles[3] = new ColumnStyle(SizeType.Absolute, 0); stepFrame.LayoutPanel.ColumnStyles[4] = new ColumnStyle(SizeType.Absolute, 0); stepFrame.LayoutPanel.ColumnStyles[5] = new ColumnStyle(SizeType.Absolute, 0); return(stepFrame); }
/// <summary> /// Show the capture panel and listen for its completion event /// </summary> /// <param name="animated"></param> private void ShowCapturePanel(bool animated = true) { var capturePage = serviceProvider.GetRequiredService <CapturePanel>(); capturePage.Preferences = preferences; capturePage.Completed += CaptureCompleted; StepFrame.PushPanel(capturePage, animated: animated); }
/// <summary> /// Show the account creation panel /// </summary> /// <param name="animated"></param> private void ShowCreateAccountPanel(bool animated = true) { var accountPanel = serviceProvider.GetRequiredService <CreateAccountPanel>(); accountPanel.Preferences = preferences; accountPanel.Completed += AccountCreationCompleted; StepFrame.PushPanel(accountPanel, animated: animated); }
private void MoveLegend(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; LegendPossition position = (LegendPossition)Enum.Parse(typeof(LegendPossition), item.Text); StepFrame selectedFrame = ApplicationManager.GetSelectedStepFrame(); selectedFrame.SelectedChartPosition = position; foreach (ToolStripMenuItem menuItem in legendPossitionToolStripMenuItem.DropDownItems) { menuItem.Checked = menuItem.Text == item.Text; } }
private void Report(BenchmarkTest benchmark, TestMethod method) { try { Action <string, object, Color> updateChart = null; StepFrame ActiveStepFrame = ApplicationManager.GetCurrentStepFrame(); string databaseName = benchmark.Database.Name; Color databaseColor = benchmark.Database.Color; // Speed chart. updateChart = ActiveStepFrame.AddAverageSpeedToBar; Report(databaseName, databaseColor, updateChart, benchmark.GetSpeed(method)); // Size chart. updateChart = ActiveStepFrame.AddSizeToBar; Report(databaseName, databaseColor, updateChart, benchmark.DatabaseSize / (1024.0 * 1024.0)); // Time chart. updateChart = ActiveStepFrame.AddTimeToBar; Report(databaseName, databaseColor, updateChart, new DateTime(benchmark.GetTime(method).Ticks)); // CPU chart. //updateChart = ActiveStepFrame.AddCpuUsageToBar; //Report(databaseName, databaseColor, updateChart, benchmark.GetAverageProcessorTime(method)); // Memory chart. updateChart = ActiveStepFrame.AddMemoryUsageToBar; Report(databaseName, databaseColor, updateChart, benchmark.GetPeakWorkingSet(method) / (1024.0 * 1024.0)); // I/O chart. //updateChart = ActiveStepFrame.AddIoUsageToBar; //Report(databaseName, databaseColor, updateChart, benchmark.GetAverageIOData(method) / (1024.0 * 1024.0)); } catch (Exception exc) { Logger.Error("Report results failed...", exc); } }
private IDockContent GetContentFromPersistString(string persistString) { if (persistString == typeof(TreeViewFrame).ToString()) { return(TreeView); } if (persistString == typeof(LogFrame).ToString()) { return(LogFrame); } if (persistString == typeof(PropertiesFrame).ToString()) { return(PropertiesFrame); } StepFrame frame = null; if (persistString == typeof(StepFrame).ToString()) { if (Count == 0) { frame = StepFrames[TestMethod.Write]; } else if (Count == 1) { frame = StepFrames[TestMethod.Read]; } else if (Count == 2) { frame = StepFrames[TestMethod.SecondaryRead]; } Count++; } return(frame); }
internal abstract ThreadCommandResult Old_Step(StepMode mode, StepFrame frame);
public abstract CommandResult Step(ThreadingModel model, StepMode mode, StepFrame frame);
void OnStepBackClicked() { StepFrame?.Invoke(-1); }
public override CommandResult Step(ThreadingModel model, StepMode mode, StepFrame frame) { throw new InvalidOperationException (); }
public StepFrame GetActiveFrame() { StepFrame activeFrame = StepFrames.FirstOrDefault(x => x.Value.IsActivated).Value; return(activeFrame); }
internal override ThreadCommandResult Old_Step(StepMode mode, StepFrame frame) { throw new InvalidOperationException(); }
public OperationStep(SingleSteppingEngine sse, StepMode mode, StepFrame frame, CommandResult result) : base(sse, result) { this.StepFrame = frame; this.StepMode = mode; }
void OnStepForwardClicked() { StepFrame?.Invoke(1); }
// <summary> // Check whether @address is inside @frame. // </summary> bool is_in_step_frame(StepFrame frame, TargetAddress address) { if (address.IsNull || (frame == null) || frame.Start.IsNull) return false; if ((address < frame.Start) || (address >= frame.End)) return false; return true; }
// <summary> // Checks whether to do a "method operation". // // This is only used while doing a source stepping operation and ensures // that we don't stop somewhere inside a method's prologue code or // between two source lines. // </summary> Operation check_method_operation(TargetAddress address, Method method, SourceAddress source, Operation operation) { // Do nothing if this is not a source stepping operation. if ((operation == null) || !operation.IsSourceOperation) return null; if (method.WrapperType != WrapperType.None) return new OperationWrapper (this, method, operation.Result); if (method.IsIterator) return new OperationStepIterator (this, method, operation.Result); Language language = method.Module.Language; if (source == null) return null; if ((source.LineOffset > 0) && (source.LineRange > 0)) { // We stopped between two source lines. This normally // happens when returning from a method call; in this // case, we need to continue stepping until we reach the // next source line. StepFrame sframe = new StepFrame ( language, StepMode.SourceLine, null, address - source.LineOffset, address + source.LineRange); return new OperationStep (this, sframe, operation.Result); } LineNumberTable lnt = method.LineNumberTable; if (lnt.HasMethodBounds && (address < lnt.MethodStartAddress)) { StepFrame sframe = new StepFrame ( null, StepMode.Finish, null, method.StartAddress, lnt.MethodStartAddress); return new OperationStep (this, sframe, operation.Result); } else if (method.HasMethodBounds && (address < method.MethodStartAddress)) { // Do not stop inside a method's prologue code, but stop // immediately behind it (on the first instruction of the // method's actual code). StepFrame sframe = new StepFrame ( null, StepMode.Finish, null, method.StartAddress, method.MethodStartAddress); return new OperationStep (this, sframe, operation.Result); } return null; }
internal override ThreadCommandResult Old_Step(StepMode mode, StepFrame frame) { ThreadCommandResult result = new ThreadCommandResult (thread); StartOperation (new OperationStep (this, mode, frame, result)); return result; }
public static void Export(string file, Dictionary <TestMethod, StepFrame> frames, int flowCount, long recordCount, float randomness, ComputerConfiguration computerInfo, ReportType type) { var doc = new Document(PageSize.A4); if (File.Exists(file)) { File.Delete(file); } var fileStream = new FileStream(file, FileMode.OpenOrCreate); PdfWriter.GetInstance(doc, fileStream); doc.Open(); // Add header page. PdfPTable firstPageTable = new PdfPTable(1); firstPageTable.WidthPercentage = 100; PdfPCell title = new PdfPCell(); title.VerticalAlignment = Element.ALIGN_MIDDLE; title.HorizontalAlignment = Element.ALIGN_CENTER; title.MinimumHeight = doc.PageSize.Height - (doc.BottomMargin + doc.TopMargin); title.AddElement(Image.GetInstance((System.Drawing.Image)DatabaseBenchmark.Properties.Resources.logo_01, Color.WHITE)); firstPageTable.AddCell(title); doc.Add(firstPageTable); int chapterCount = 1; Font chapterFont = new Font(Font.TIMES_ROMAN, 16f, Font.TIMES_ROMAN, new Color(System.Drawing.Color.CornflowerBlue)); Chapter benchamrkConfiguration = new Chapter(new Paragraph("Benchmark parameters.", chapterFont), chapterCount++); benchamrkConfiguration.Add(new Chunk("\n")); ExportTestSettings(benchamrkConfiguration, chapterFont, flowCount, recordCount, randomness); ExportComputerSpecification(benchamrkConfiguration, chapterFont, computerInfo); doc.Add(benchamrkConfiguration); foreach (var fr in frames) { StepFrame frame = fr.Value; List <BarChart> barCharts; if (type == ReportType.Summary) { barCharts = frame.GetSummaryBarCharts(); } else { barCharts = frame.GetAllBarCharts(); } string chapterTitle = fr.Key == TestMethod.SecondaryRead ? "Secondary read" : fr.Key.ToString(); Chapter chapter = new Chapter(new Paragraph(chapterTitle, chapterFont), chapterCount++); chapter.Add(new Chunk("\n")); for (int i = 0; i < barCharts.Count; i++) { Image image = Image.GetInstance(barCharts[i].ConvertToByteArray()); image.Alignment = Element.ALIGN_CENTER; if (type == ReportType.Summary) { image.ScaleToFit(doc.PageSize.Width - 20, 271); } else { image.ScalePercent(100); } chapter.Add(image); } if (type == ReportType.Detailed) { PdfPTable table = new PdfPTable(1); table.WidthPercentage = 100; AddCellToTable(table, "Average Speed:", frame.lineChartAverageSpeed.ConvertToByteArray); AddCellToTable(table, "Moment Speed:", frame.lineChartMomentSpeed.ConvertToByteArray); AddCellToTable(table, "Average Memory:", frame.lineChartMomentMemory.ConvertToByteArray); //AddCellToTable(table, "Average CPU:", frame.lineChartAverageCPU.ConvertToByteArray); //AddCellToTable(table, "Average I/O:", frame.lineChartAverageIO.ConvertToByteArray); chapter.Add(table); } doc.Add(chapter); } doc.Close(); foreach (var item in frames) { item.Value.ResetColumnStyle(); } }
public override CommandResult Step(ThreadingModel model, StepMode mode, StepFrame frame) { StartOperation (); return (CommandResult) SendCommand (delegate { Report.Debug (DebugFlags.SSE, "{0} step: {1} {2} {3}", this, model, mode, frame); CommandResult result = process.Debugger.StartOperation (model, this); return ProcessOperation (new OperationStep (this, mode, frame, result)); }); }
public override CommandResult Step(ThreadingModel model, StepMode mode, StepFrame frame) { throw new InvalidOperationException(); }
public void SelectFrame(TestMethod method) { StepFrame frame = StepFrames[method]; frame.Show(Panel); }
protected override void DoExecute() { Report.Debug (DebugFlags.SSE, "{0} step execute: {1}", sse, inferior.CurrentFrame); switch (StepMode) { case StepMode.Run: if (StepFrame != null) sse.do_continue (StepFrame.Until); else sse.do_continue (); break; case StepMode.NativeInstruction: sse.do_step_native (); break; case StepMode.NextInstruction: sse.do_next (); break; case StepMode.SourceLine: if (StepFrame == null) StepFrame = sse.CreateStepFrame (); if (StepFrame == null) sse.do_step (); else Step (true); break; case StepMode.NextLine: // We cannot just set a breakpoint on the next line // since we do not know which way the program's // control flow will go; ie. there may be a jump // instruction before reaching the next line. StepFrame frame = sse.CreateStepFrame (); if (frame == null) sse.do_next (); else { StepFrame = new StepFrame ( null, StepMode.Finish, frame.StackFrame, frame.Start, frame.End); Step (true); } break; case StepMode.SingleInstruction: StepFrame = sse.CreateStepFrame (StepMode.SingleInstruction); Step (true); break; case StepMode.Finish: case StepMode.FinishNative: Step (true); break; default: throw new InvalidOperationException (); } }
internal override ThreadCommandResult Old_Step(StepMode mode, StepFrame frame) { throw new InvalidOperationException (); }
bool check_method_operation(TargetAddress current_frame) { if ((StepMode != StepMode.SourceLine) && (StepMode != StepMode.NextLine)) return false; Method method = sse.Lookup (current_frame); if (method == null) return false; LineNumberTable lnt = method.LineNumberTable; if (lnt.HasMethodBounds && (current_frame >= lnt.MethodEndAddress)) { Report.Debug (DebugFlags.SSE, "{0} reached method epilogue: {1} {2} {3}", sse, current_frame, lnt.MethodEndAddress, method.EndAddress); StepFrame = new StepFrame ( null, StepMode.Finish, null, lnt.MethodEndAddress, method.EndAddress); return true; } return false; }