Beispiel #1
0
        partial void CompareDiagramSelect_Activated(NSObject sender)
        {
            var    s = sender as NSPopUpButton;
            double newMax;

            switch (s.TitleOfSelectedItem)
            {
            case "Потерянное время ЦПУ":
                if (plotView.Model.Title == "Потерянное время")
                {
                    return;
                }
                plotView.Model = PlotMaker.LostTimeComparePlot();
                newMax         = plotView.Model.GetAxis("Time").ActualMaximum;
                ((IntervalCompareOutlineDelegate)CompareIntervalTree.Delegate).maxTimeLost = newMax;
                Console.WriteLine("CPU NewMax = " + newMax);
                plotView.Model = PlotMaker.LostTimeComparePlot((int)CompareIntervalTree.SelectedRow, newMax);
                break;

            case "Сравнение ГПУ":
                if (plotView.Model.Title == "ГПУ")
                {
                    return;
                }
                plotView.Model = PlotMaker.GPUComparePlot();
                newMax         = plotView.Model.GetAxis("Time").ActualMaximum;
                ((IntervalCompareOutlineDelegate)CompareIntervalTree.Delegate).maxTimeGPU = newMax;
                plotView.Model = PlotMaker.GPUComparePlot((int)CompareIntervalTree.SelectedRow, newMax);
                break;
            }
        }
Beispiel #2
0
        partial void CompareStat(NSObject sender)
        {
            var SelectedRowsArray = StatTableView.SelectedRows.ToArray();

            if (SelectedRowsArray.Length < 2)
            {
                Alert.MessageText = "Пожалуйста, выберите " +
                                    "2 или более записи для сравнения.";
                Alert.RunModal();
                return;
            }
            plotView.Model = null;
            CompareList.Clear();
            var StatDirs = ((StatTableDataSource)StatTableView.DataSource).StatDirs;

            try {
                foreach (var i in SelectedRowsArray)
                {
                    CompareList.Add(new Stat(StatDirs[(int)i].ReadJson(),
                                             Path.GetDirectoryName(StatDirs[(int)i].path)));
                }
            } catch (Exception e)
            {
                Console.WriteLine("Got one!\n" + e);
                CompareList.Clear();
                foreach (var i in SelectedRowsArray)
                {
                    CompareList.Add(new Stat(StatDirs[(int)i].ReadJson(),
                                             Path.GetDirectoryName(StatDirs[(int)i].path)));
                }
            }
            CompareList.BuildIntervalsList();

            //---  Hide label and set plot  ---//
            ChooseLabel.Hidden            = true;
            CompareSort.Enabled           = true;
            CompareDiagramSelect.Enabled  = true;
            IntervalCompareButton.Enabled = true;
            plotView.Model     = PlotMaker.LostTimeComparePlot();
            plotCompareMaxTime = plotView.Model.GetAxis("Time").ActualMaximum;
            ((IntervalCompareOutlineDelegate)CompareIntervalTree.Delegate).maxTimeLost = plotCompareMaxTime;

            //---  Set CompareIntervalTree  ---//
            CompareSplitView.SetPositionOfDivider(CompareSplitView.Frame.Width - 300, 0);
            ((IntervalOutlineDataSource)CompareIntervalTree.DataSource).Intervals.Clear();
            ((IntervalOutlineDataSource)CompareIntervalTree.DataSource).Intervals
            .Add(CompareList.List[0].Interval);
            CompareIntervalTree.ReloadData();
            CompareIntervalTree.ExpandItem(CompareIntervalTree.ItemAtRow(0), true);
            CompareIntervalTree.SelectRow(0, false);
            CompareSplitView.SetPositionOfDivider(CompareSplitView.Frame.Width, 0);
            IntervalCompareButton.State = NSCellStateValue.Off;

            //--- Switch tab  ---//
            TabView.SelectAt(2);
        }
Beispiel #3
0
        public void InterView_SelectionDidChange(object sender, EventArgs e)
        {
            var item = InterView.ItemAtRow(InterView.SelectedRow) as Interval;

            InterText.Value         = item.Text;
            InterTreePlotView.Model = PlotMaker.ProcLostTimePlot(LoadedStat, this, item.Row, plotStatMaxTime);
            if (SelectedProc >= 0)
            {
                SelectProcessor(SelectedProc, item.Row);
            }
        }
        public override void SelectionDidChange(NSNotification notification)
        {
            switch (plotView.Model.Title)
            {
            case "Потерянное время":
                plotView.Model = PlotMaker
                                 .LostTimeComparePlot(((Interval)outlineView.ItemAtRow(outlineView.SelectedRow)).Row,
                                                      maxTimeLost);
                break;

            case "ГПУ":
                plotView.Model = PlotMaker
                                 .GPUComparePlot(((Interval)outlineView.ItemAtRow(outlineView.SelectedRow)).Row,
                                                 maxTimeGPU);
                break;
            }
        }
Beispiel #5
0
        public void SetDataToInterView(Stat stat, int row = 0)
        {
            LoadedStat                = stat;
            LoadStatLabel.Hidden      = false;
            LoadStatLabel.StringValue = stat.GetInfoForStatDir();
            LoadStatLabel.SetFrameSize(LoadStatLabel.FittingSize);
            InitInterTree();
            InterTreePlotView.Model = PlotMaker.ProcLostTimePlot(LoadedStat, this, 0, plotStatMaxTime);
            plotStatMaxTime         = InterTreePlotView.Model.GetAxis("Time").ActualMaximum;
            InterText.Value         = "";
            var intervals = ((IntervalOutlineDataSource)InterView.DataSource).Intervals;

            intervals.Clear();
            intervals.Add(stat.Interval);
            InterView.ReloadData();
            InterView.ExpandItem(InterView.ItemAtRow(0), true);
            InterView.SelectRow(row, false);
        }
Beispiel #6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Do any additional setup after loading the view.
            GPUScrollView.DocumentView = GPUStackView;
            LoadStatList();
            InitDataInterView();
            InitInterTree();
            InterTreeSplitView.SetPositionOfDivider(0, 0);
            InterTreeSegmentController.SetSelected(false, 0);

            //---  Init alerts  ---//
            Alert = new NSAlert();

            RemoveAlert             = new NSAlert();
            NoButtonTag             = RemoveAlert.AddButton("Нет").Tag;
            YesButtonTag            = RemoveAlert.AddButton("Да").Tag;
            RemoveAlert.MessageText = "Вы уверены, что хотите " +
                                      "удалить выбранные статистики выполнения?";

            CompareList    = new StatCompareList();
            plotView.Model = new OxyPlot.PlotModel();

            //---  Init help button  ---//
            NSButton helpIntervalCompare = new NSButton
            {
                BezelStyle = NSBezelStyle.HelpButton,
                Title      = "",
                BezelColor = NSColor.White
            };

            helpIntervalCompare.SetButtonType(NSButtonType.MomentaryPushIn);
            helpIntervalCompare.SetFrameSize(helpIntervalCompare.FittingSize);
            helpIntervalCompare.SetFrameOrigin(new CGPoint(TableHeader.Frame.Width
                                                           - helpIntervalCompare.FittingSize.Width, 2));
            helpIntervalCompare.AutoresizingMask = NSViewResizingMask.MinXMargin;

            //---  Init help popover  ---//
            var helpWindowController = storyboard
                                       .InstantiateControllerWithIdentifier("Popover") as NSWindowController;
            var helpViewController = helpWindowController
                                     .ContentViewController as PopoverController;

            helpPopover = new NSPopover
            {
                ContentSize           = new CGSize(200, 180),
                Behavior              = NSPopoverBehavior.Transient,
                Animates              = true,
                ContentViewController = helpViewController
            };
            helpIntervalCompare.Activated += (object sender, EventArgs e)
                                             => helpPopover.Show(new CGRect(helpIntervalCompare.Frame.Location, new CGSize(200, 180)),
                                                                 TableHeader, NSRectEdge.MaxYEdge);

            TableHeader.AddSubview(helpIntervalCompare);

            //---  Init Compare Controls  ---//
            CompareSort.Enabled           = false;
            IntervalCompareButton.Enabled = false;
            CompareDiagramSelect.Enabled  = false;
            CompareSort.RemoveAllItems();
            string[] CompareItems = { "Кол-во процессоров", "Потерянное время",
                                      "Время выполнения",   "Коэф. эффективности" };
            CompareSort.AddItems(CompareItems);

            CompareSort.Activated += (object sender, EventArgs e)
                                     =>
            {
                // TODO: Мб, для этого есть нормальное решение?
                var selectedRow = (int)CompareIntervalTree.SelectedRow;
                CompareList.Sort(CompareSort.TitleOfSelectedItem, selectedRow);
                switch (plotView.Model.Title)
                {
                case "Потерянное время":
                    plotView.Model = PlotMaker.LostTimeComparePlot(selectedRow,
                                                                   plotView.Model.GetAxis("Time").ActualMaximum);
                    break;

                case "ГПУ":
                    plotView.Model = PlotMaker.GPUComparePlot(selectedRow,
                                                              plotView.Model.GetAxis("Time").ActualMaximum);
                    break;
                }
                CompareIntervalTree.ReloadData();
                CompareIntervalTree.SelectRow(selectedRow, false);
            };

            CompareIntervalTree.IntercellSpacing = new CGSize(10, 0);
            var dataSource = new IntervalOutlineDataSource();

            CompareIntervalTree.DataSource = dataSource;
            CompareIntervalTree.Delegate   = new IntervalCompareOutlineDelegate(CompareIntervalTree, plotView);

            IntervalCompareButton.Activated += IntervalCompareButton_Activated;
        }