Beispiel #1
0
        /// <summary>
        /// Constructor - Build UI
        /// </summary>		
        public Visualizer(string filename)
        {
            //valueTable = new Dictionary<string,List<decimal>>();
            visFileList = new Dictionary<string,VisFileContainer>();

            grapher = new Grapher(this);

            this.SuspendLayout();

            this.Size = new Size(1100,500);
            this.Text = "DRAMVis     University Of Maryland";

            //
            //menu bar at top of the screen
            //
            menuStrip = new MenuStrip();

            file = new ToolStripMenuItem("File");
            about = new ToolStripMenuItem("About");
            menuStrip.Items.Add(file);
            menuStrip.Items.Add(about);

            fileOpen = new ToolStripMenuItem("Open .vis File");
            fileOpen.Click += new System.EventHandler(this.OpenFileButton_Click);
            file.DropDownItems.Add(fileOpen);

            help = new ToolStripMenuItem("Help");
            about.DropDownItems.Add(help);

            //
            //tool strip stuff
            //
            toolStrip = new ToolStrip();

            pointerButton = new ToolStripButton(new Bitmap("../../pointer.png"));
            pointerButton.Click += new EventHandler(this.PointerButton_Click);
            pointerButton.ToolTipText = "Pointer";
            pointerButton.Size = new Size(32,32);
            zoomButton = new ToolStripButton(new Bitmap("../../zoom.png"));
            zoomButton.Click += new EventHandler(this.ZoomButton_Click);
            zoomButton.ToolTipText = "Zoom";
            handButton = new ToolStripButton(new Bitmap("../../pan.png"));
            handButton.Click += new EventHandler(this.HandButton_Click);
            handButton.ToolTipText = "Pan";

            saveGraphButton = new ToolStripButton(new Bitmap("../../savegraph.png"));
            saveGraphButton.ToolTipText = "Save graphs to file";
            saveGraphButton.Click += new EventHandler(this.SaveGraphButton_Click);
            openFileButton = new ToolStripButton(new Bitmap("../../open.png"));
            openFileButton.Click += new EventHandler(this.OpenFileButton_Click);
            openFileButton.ToolTipText = "Open .vis file";
            playButton = new ToolStripButton(new Bitmap("../../play.png"));
            playButton.Click += new EventHandler(this.PlayButton_Click);
            playButton.ToolTipText = "Run simulation";
            playButton.Name = "Play";
            playPlusButton = new ToolStripButton(new Bitmap("../../playplus.png"));
            playPlusButton.Click += new EventHandler(this.PlayButton_Click);
            playPlusButton.ToolTipText = "Run and Add";
            playPlusButton.Name = "PlayPlus";

            ToolStripItem runFor = new ToolStripLabel("Run For:");
            cycleCount = new ToolStripTextBox();
            cycleCount.Size = new Size(70,0);
            cycleCount.Text = "500000";
            ToolStripItem cyclesLabel = new ToolStripLabel("cycles");

            ToolStripItem displayAsLabel = new ToolStripLabel("Display As:");
            displayAs = new ToolStripComboBox();
            displayAs.Items.AddRange(new string[] {"Total","Total Average", "Per Rank","Per Bank"});
            displayAs.SelectedIndex = 0;
            displayAs.SelectedIndexChanged += new EventHandler(this.DataDisplayCombo_IndexChanged);

            toolStrip.Items.AddRange(new ToolStripItem[]{openFileButton, saveGraphButton,
                new ToolStripSeparator(),pointerButton,zoomButton,handButton,
                new ToolStripSeparator(),playButton, playPlusButton,
                new ToolStripSeparator(), runFor, cycleCount, cyclesLabel,
                new ToolStripSeparator(), displayAsLabel,displayAs});

            //
            //control panel tab page
            //
            controlPanel = new TabControl();
            controlPanel.Dock = DockStyle.Fill;
            controlPanel.Alignment = TabAlignment.Bottom;

            //
            //system property page stuff
            //
            systemPropertyPage = new TabPage("System");
            systemPropertyPage.BorderStyle = BorderStyle.Fixed3D;
            systemPropertyPage.Anchor = AnchorStyles.Top;

            TableLayoutPanel systemtlp = new TableLayoutPanel();
            systemtlp.Margin = new Padding(0,0,0,0);
            systemtlp.RowCount = 3;
            systemtlp.ColumnCount = 2;

            //trace
            Label traceLabel = new Label();
            traceLabel.Text = "Trace File";
            traceLabel.TextAlign = ContentAlignment.MiddleCenter;
            traceLabel.Dock = DockStyle.Fill;
            traceLabel.Font = new Font(traceLabel.Font, FontStyle.Bold);
            systemtlp.Controls.Add(traceLabel,0,0);
            systemtlp.SetColumnSpan(traceLabel,2);

            traceSelectionButton = new Button();
            traceSelectionButton.Image = new Bitmap(new Bitmap("../../open.png"), new Size(16,16));
            traceSelectionButton.Click += new EventHandler(this.TraceSelectionButton_Click);
            systemtlp.Controls.Add(traceSelectionButton,0,1);

            traceNameDisplay = new TextBox();
            traceNameDisplay.BorderStyle = BorderStyle.Fixed3D;
            traceNameDisplay.TextAlign = HorizontalAlignment.Center;
            traceNameDisplay.BackColor = Color.White;
            traceNameDisplay.Dock = DockStyle.Fill;
            traceNameDisplay.ReadOnly = true;
            systemtlp.Controls.Add(traceNameDisplay,1,1);

            systemPropertyGrid = new PropertyGrid();
            systemPropertyGrid.Dock = DockStyle.Fill;
            systemPropertyGrid.SelectedObject = systemParameters;

            systemtlp.Controls.Add(systemPropertyGrid,0,2);
            systemtlp.SetColumnSpan(systemPropertyGrid, 2);

            systemtlp.Dock = DockStyle.Fill;
            systemtlp.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute,35));
            systemtlp.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute,185));

            systemPropertyPage.Controls.Add(systemtlp);
            systemPropertyPage.Resize += delegate(object sender, EventArgs e) {
                TabPage x = (TabPage)sender;
                systemPropertyGrid.Height = x.Height-150;
            };
            //
            //Device Property page stuff
            //
            devicePropertyPage = new TabPage("Device");
            devicePropertyPage.BorderStyle = BorderStyle.Fixed3D;

            TableLayoutPanel devicetlp = new TableLayoutPanel();
            devicetlp.RowCount = 3;
            devicetlp.ColumnCount = 1;

            devicePropertyGrid = new PropertyGrid();
            devicePropertyGrid.Dock = DockStyle.Fill;

            Label deviceComboLabel = new Label();
            deviceComboLabel.Text = "Device Name";
            deviceComboLabel.TextAlign = ContentAlignment.MiddleCenter;
            deviceComboLabel.Font = new Font(deviceComboLabel.Font, FontStyle.Bold);
            deviceComboLabel.Dock = DockStyle.Fill;

            deviceComboBox = new ComboBox();
            deviceComboBox.Dock = DockStyle.Fill;
            FillDeviceComboBox();
            deviceComboBox.SelectedIndexChanged += new EventHandler(this.DeviceComboBox_IndexChanged);
            deviceComboBox.SelectedIndex = 0;

            devicetlp.Controls.Add(deviceComboLabel,0,0);
            devicetlp.Controls.Add(deviceComboBox,0,1);
            devicetlp.Controls.Add(devicePropertyGrid,0,2);
            devicetlp.Dock = DockStyle.Fill;
            devicetlp.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute,35));
            devicetlp.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute,185));

            devicePropertyPage.Resize += delegate(object sender, EventArgs e) {
                TabPage x = (TabPage)sender;
                devicePropertyGrid.Height = x.Height-150;
            };
            devicePropertyPage.Controls.Add(devicetlp);

            //
            //previous results page
            //
            TableLayoutPanel resultstlp = new TableLayoutPanel();
            resultstlp.ColumnCount = 1;
            resultstlp.RowCount = 2;

            resultsPage = new TabPage();
            resultsPage.Text = "Results";

            Label resultsLabel = new Label();
            resultsLabel.Text = "Previous Results";
            resultsLabel.TextAlign = ContentAlignment.MiddleCenter;
            resultsLabel.Font = new Font(resultsLabel.Font, FontStyle.Bold);
            resultsLabel.Dock = DockStyle.Fill;
            resultstlp.Controls.Add(resultsLabel, 0, 0);

            resultstlp.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute,222));
            resultstlp.Dock = DockStyle.Fill;
            resultsPage.Controls.Add(resultstlp);

            previousResults = new TreeView();
            previousResults.Dock = DockStyle.Fill;
            previousResults.AfterCheck += new TreeViewEventHandler(this.PreviousResults_AfterCheck);
            previousResults.AfterSelect += new TreeViewEventHandler(this.PreviousResults_AfterSelect);
            previousResults.CheckBoxes = true;

            resultstlp.Controls.Add(previousResults,0,1);

            //add pages to control panel
            controlPanel.Controls.AddRange(new TabPage[]{systemPropertyPage,devicePropertyPage,resultsPage});
            controlPanel.SelectedIndex = 0;

            //
            //main window stuff
            //
            mainWindow = new TabControl();
            mainWindow.Dock = DockStyle.Fill;

            NPlot.Windows.PlotSurface2D plotBandwidth = new NPlot.Windows.PlotSurface2D();
            NPlot.Windows.PlotSurface2D plotLatency = new NPlot.Windows.PlotSurface2D();

            gBandwidth = new LineGrapher(plotBandwidth, "bandwidth", "Bandwidth (GB/s)", "Time (ms)", "Bandwidth (GB/s)");
            gLatency = new LineGrapher(plotLatency, "latency", "Average Latency", "Time (ms)", "Latency (nanoseconds)");

            //click handlers for right click to zoom out behavior

            /*
            plotBandwidth.MouseClick += new MouseEventHandler(TriggerZoomOut);
            plotLatency.MouseClick += new MouseEventHandler(TriggerZoomOut);
            plotLatencyHistogram.MouseClick += new MouseEventHandler(TriggerZoomOut);
            plotPower.MouseClick += new MouseEventHandler(TriggerZoomOut);
            */
            bandwidthPage = new TabPage("Bandwidth");
            bandwidthPage.BackColor = Color.Transparent;
            /*
            bandwidthPage.MouseEnter += (this.mainWindow_MouseEnter);
            bandwidthPage.MouseLeave += (this.mainWindow_MouseLeave);
            */
            latencyPage = new TabPage("Latency");
            latencyPage.BackColor = Color.Transparent;
            /*
            latencyPage.MouseEnter += (this.mainWindow_MouseEnter);
            latencyPage.MouseLeave += (this.mainWindow_MouseLeave);
            */

            latencyHistogramPage = new TabPage("Histogram");
            latencyHistogramPage.BackColor = Color.Transparent;
            /*
            latencyHistogramPage.MouseEnter += (this.mainWindow_MouseEnter);
            latencyHistogramPage.MouseLeave += (this.mainWindow_MouseLeave);
            */

            powerPage = new TabPage("Power");
            powerPage.BackColor = Color.Transparent;
            /*
            powerPage.MouseEnter += (this.mainWindow_MouseEnter);
            powerPage.MouseLeave += (this.mainWindow_MouseLeave);
            */
            mainWindow.MouseEnter += this.mainWindow_MouseEnter;
            mainWindow.MouseLeave += this.mainWindow_MouseLeave;

            gPower = new BarGrapher(powerPage, "power");
            gHistogram = new BarGrapher(latencyHistogramPage, "histogram");

            latencyPage.Controls.Add(plotLatency);
            bandwidthPage.Controls.Add(plotBandwidth);

            mainWindow.TabPages.AddRange(new TabPage[]{bandwidthPage,latencyPage,latencyHistogramPage,powerPage});

            SplitContainer sc = new SplitContainer();
            sc.Dock = DockStyle.Fill;
            sc.Panel1.Controls.Add(controlPanel);
            sc.Panel1.Padding = new Padding(3,3,3,5);
            sc.Panel1MinSize = 250;
            sc.Panel2.Controls.Add(mainWindow);
            sc.Panel2.Padding = new Padding(3,3,3,3);
            sc.Orientation = Orientation.Vertical;

            //add everythign to window
            Controls.AddRange(new Control[] { sc, toolStrip, menuStrip } );

            this.ResumeLayout();

            sc.SplitterDistance = 250;
        }
Beispiel #2
0
        //make a bar graph with the bars starting at 0
        public static BarPlot MakeBarPlot(List <decimal> xAxis, List <decimal> barTops, Color color)
        {
            List <decimal> barBottoms = Grapher.ZeroList(barTops);

            return(MakeBarPlot(xAxis, barTops, barBottoms, color));
        }