Example #1
0
        public void HighlightGraph(VisFileContainer v)
        {
            //unhighlight everyone
            foreach (IDrawable d in canvas.Drawables)
            {
                if (d is MyLinePlot)
                {
                    MyLinePlot l = (MyLinePlot)d;
                    l.Pen.Width     = 1.0f;
                    l.Pen.Color     = l.OriginalColor;
                    l.isHighlighted = false;
                }
            }

            // if we wanted to unhighlight, that's all we need to do
            if (v == null)
            {
                canvas.Refresh();
                return;
            }
            int start;
            int end;

            getRangeForDrawMode(v, this.drawMode, out start, out end);

            //iterate over a copy since we can't change the collection while its being iterated
            foreach (IDrawable d in new ArrayList(canvas.Drawables))
            {
                if (d is MyLinePlot)
                {
                    for (int i = start; i < end; i++)
                    {
                        MyLinePlot l       = (MyLinePlot)d;
                        string     keyName = v.filepath + i;
                        if (l.Name.Equals(keyName))
                        {
                            l.Pen.Width     = 2.0f;
                            l.Pen.Color     = l.OriginalColor;
                            l.isHighlighted = true;
                            // remove/add to force the line graph to be on top
                            canvas.Remove(l, false);
                            canvas.Add(l);
                        }
                        else
                        {
                            // only unhiglight a plot that we haven't previously highlighted
                            if (!l.isHighlighted)
                            {
                                l.Pen.Width = 1.0f;
                                l.Pen.Color = Color.DarkGray;
                            }
                        }
                    }
                    // highlight a matching plot
                }
            }


            canvas.Refresh();
        }
Example #2
0
        public static MyLinePlot MakeLinePlot(List <decimal> x_values, List <decimal> y_values, Color color)
        {
            MyLinePlot returnPlot = new MyLinePlot(x_values, y_values, color);

            returnPlot.Pen = new Pen(color, 1.0f);
            return(returnPlot);
        }
Example #3
0
        public void AddToCanvas(VisFileContainer v)
        {
            Console.WriteLine("ADD CALLED");
            int start, end;

            getRangeForDrawMode(v, this.drawMode, out start, out end);
            for (int i = start; i < end; i++)
            {
//				Console.WriteLine("Adding "+i);
                MyLinePlot linePlot = v.plotTable[y_key][i];
                {
                    linePlot.Name = v.filepath + i;
                    canvas.Add(linePlot);
                }

                if (!containers.Contains(v))
                {
                    containers.Add(v);
                }
            }
            //	p("NumDrawn="+this.itemsDrawn);

            if (true || isClear)
            {
                canvas.XAxis1.Label = x_label;
                canvas.YAxis1.Label = y_label;

                canvas.YAxis1.LabelOffsetAbsolute = true;
                canvas.YAxis1.LabelOffset         = 40;
                canvas.XAxis1.HideTickText        = false;
                isClear = false;
            }
            canvas.Refresh();
        }
Example #4
0
        private static MyLinePlot ComputeAveragePower(VisFileContainer v)
        {
            Dictionary <string, List <decimal> > valueTable = v.valueTable;
            uint       rank = v.systemParameters.NUM_RANKS - 1;
            MyLinePlot line = LineGrapher.MakeLinePlot(valueTable["x_axis"], Grapher.GenerateRunningAverage(valueTable["refresh_top_" + rank]), Color.Red);

            line.Label = "Average Power";
            line.Pen   = new Pen(Color.Red, 2.0f);
            return(line);
        }
Example #5
0
        public void RemoveFromCanvas(VisFileContainer v)
        {
            int  start;
            int  end;
            bool needUnhighlight = false;

            getRangeForDrawMode(v, this.drawMode, out start, out end);

            ArrayList DrawablesCopy = new ArrayList(canvas.Drawables);

            foreach (IDrawable d in DrawablesCopy)
            {
                if (d is MyLinePlot)
                {
                    for (int i = start; i < end; i++)
                    {
                        MyLinePlot l       = (MyLinePlot)d;
                        string     keyName = v.filepath + i;
                        if (keyName.Equals(l.Name))
                        {
                            if (l.isHighlighted)
                            {
                                needUnhighlight = true;
                            }
//							Console.WriteLine("REMOVING="+l.Name);
                            canvas.Remove(l, true);
                        }
                    }
                }
            }
            if (needUnhighlight)
            {
                this.HighlightGraph(null);
            }
            canvas.Refresh();
            containers.Remove(v);
        }
Example #6
0
 public static MyLinePlot MakeLinePlot(List<decimal> x_values, List<decimal> y_values, Color color)
 {
     MyLinePlot returnPlot = new MyLinePlot(x_values, y_values, color);
     returnPlot.Pen = new Pen(color, 1.0f);
     return returnPlot;
 }
Example #7
0
        private void MakeGraphsFromValueTable()
        {
            int    numValues = valueTable["x_axis"].Count;
            string keyName;
            //yes, this is a cheapo way to get unique colors, but who cares

            Color lineColor = Grapher.GetColorRange((uint)filepath.GetHashCode(), 0, 1);;

            // Per Bank Data is in the list from 0 ... NUM_BANKS*NUM_RANKS
            for (int r = 0; r < systemParameters.NUM_RANKS; r++)
            {
                for (int b = 0; b < deviceParameters.NUM_BANKS; b++)
                {
                    if (r == 0 && b == 0)
                    {
                        plotTable.Add("latency", new List <MyLinePlot>());
                        plotTable.Add("bandwidth", new List <MyLinePlot>());
                    }
                    lineColor = Grapher.GetColorRange((uint)filepath.GetHashCode(), (uint)r, systemParameters.NUM_RANKS);
                    keyName   = "l_" + r + "_" + b;
                    MyLinePlot linePlot = LineGrapher.MakeLinePlot(valueTable["x_axis"], valueTable[keyName], lineColor);
                    plotTable["latency"].Add(linePlot);
                    keyName  = "b_" + r + "_" + b;
                    linePlot = LineGrapher.MakeLinePlot(valueTable["x_axis"], valueTable[keyName], lineColor);
                    plotTable["bandwidth"].Add(linePlot);
                }
            }

            // Per Rank data is in BANKS*RANKS ... BANKS*RANKS+RANKS

            List <decimal> bandwidthGrandTotal = Grapher.ZeroList(numValues);
            List <decimal> latencyGrandTotal   = Grapher.ZeroList(numValues);
            List <decimal> totalCounts         = Grapher.ZeroList(numValues);

            // generate per rank and total graphs
            for (int r = 0; r < systemParameters.NUM_RANKS; r++)
            {
                List <decimal> latencyRankTotal   = Grapher.ZeroList(numValues);
                List <decimal> bandwidthRankTotal = Grapher.ZeroList(numValues);
                List <decimal> counts             = Grapher.ZeroList(numValues);
                // sum the latencies and bandwidths into grand totals and per rank totals
                for (int b = 0; b < deviceParameters.NUM_BANKS; b++)
                {
                    keyName = "b_" + r + "_" + b;
                    Grapher.SumLists(bandwidthRankTotal, valueTable[keyName]);
                    Grapher.SumLists(bandwidthGrandTotal, valueTable[keyName]);

                    keyName = "l_" + r + "_" + b;
                    Grapher.CountNonZero(valueTable[keyName], counts);
                    Grapher.CountNonZero(valueTable[keyName], totalCounts);
                    Grapher.SumLists(latencyRankTotal, valueTable[keyName]);
                    Grapher.SumLists(latencyGrandTotal, valueTable[keyName]);
                }
                // take the totals of all the latencies and generate a per-rank average since it doesn't really make sense
                // to sum latencies across banks
                for (int i = 0; i < latencyRankTotal.Count; i++)
                {
/*
 *                  if (counts[i] > deviceParameters.NUM_BANKS)
 *                                      {
 *                                              Console.WriteLine("COUNTS = "+counts[i]);
 *                                      }
 *                                      if (counts[i] == 0)
 *                                      {
 *                                              Console.WriteLine("ZERO COUNT");
 *                                              latencyRankTotal[i] = latencyRankTotal[i];
 *                                      }
 *                                      else
 *                                      {
 *                                              latencyRankTotal[i] = latencyRankTotal[i]/counts[i];
 *                                      }
 */
                    latencyRankTotal[i] = latencyRankTotal[i] / deviceParameters.NUM_BANKS;
                }

                plotTable["latency"].Add(LineGrapher.MakeLinePlot(valueTable["x_axis"], new List <decimal>(latencyRankTotal), lineColor));
                plotTable["bandwidth"].Add(LineGrapher.MakeLinePlot(valueTable["x_axis"], new List <decimal>(bandwidthRankTotal), lineColor));

                // clear these lists before the next iteration (to keep from accumulating)
                bandwidthRankTotal.Clear();
                latencyRankTotal.Clear();
                counts.Clear();
            }


            for (int i = 0; i < latencyGrandTotal.Count; i++)
            {
                latencyGrandTotal[i] = latencyGrandTotal[i] / (deviceParameters.NUM_BANKS * systemParameters.NUM_RANKS);
            }

            // last 2 indices are the total/avg
            plotTable["latency"].Add(LineGrapher.MakeLinePlot(valueTable["x_axis"], latencyGrandTotal, Color.Green));
//			plotTable["latency"].Add(LineGrapher.MakeLinePlot(valueTable["x_axis"], Grapher.GenerateRunningAverage(latencyGrandTotal), lineColor));

            plotTable["bandwidth"].Add(LineGrapher.MakeLinePlot(valueTable["x_axis"], bandwidthGrandTotal, Color.Green));
//			plotTable["bandwidth"].Add(LineGrapher.MakeLinePlot(valueTable["x_axis"], Grapher.GenerateRunningAverage(bandwidthGrandTotal), lineColor));

            //Console.WriteLine("finished recomputing");

            //Draw the Power and Histogram plots
            barPlotTable.Add("power", BarGrapher.PowerGraph(this));
            barPlotTable.Add("histogram", BarGrapher.HistogramPlot(this));
        }