예제 #1
0
 public void Bind()
 {
     DataFileNameTextBox.Init(mAct.GetOrCreateInputParam(ActCreatePDFChart.Fields.DataFileName), ActInputValue.Fields.Value);
     GingerCore.General.ObjFieldBinding(ParamsComboBox.ComboBox, ComboBox.SelectedValueProperty, mAct, ActCreatePDFChart.Fields.ParamName);
     GingerCore.General.ObjFieldBinding(ParamsComboBox.ComboBox, ComboBox.ItemsSourceProperty, mAct, ActCreatePDFChart.Fields.ParamList);
     DataFileNameTextBox.ValueTextBox.TextChanged += ValueTextBox_TextChanged;
     mAct.ParamList = SetParamsCombo();
 }
예제 #2
0
        public RunCommandDialog(CommandLineArgs args, MainWindow mainWindow, bool isCollect = false, Action continuation = null)
        {
            Owner = mainWindow;
            if (mainWindow.CollectWindow != null)
            {
                throw new ApplicationException("Collection Dialog already open.");
            }

            m_continuation = continuation;
            Closing       += delegate(object sender, CancelEventArgs e)
            {
                mainWindow.CollectWindow = null;
            };

            App.CommandProcessor.LaunchPerfViewElevatedIfNeeded(isCollect ? "GuiCollect" : "GuiRun", args);

            InitializeComponent();

            var osVersion = Environment.OSVersion.Version.Major + Environment.OSVersion.Version.Minor / 10.0;

            if (osVersion < 6.2)        // CPU Counters only supported on Windows 8 and above
            {
                CpuCountersListButton.IsEnabled = false;
                CpuCountersTextBox.IsEnabled    = false;
            }

            if (args.DataFile == null)
            {
                args.DataFile = "PerfViewData.etl";
            }
            else if (!args.DataFile.EndsWith(".etl", StringComparison.OrdinalIgnoreCase))
            {
                if (args.DataFile.EndsWith(".etl.zip", StringComparison.OrdinalIgnoreCase))
                {
                    args.DataFile = args.DataFile.Substring(0, args.DataFile.Length - 4);       // Strip off the .zip.
                }
                else
                {
                    args.DataFile = "PerfViewData.etl";
                }
            }
            mainWindow.StatusBar.Log("Collection Dialog open.");

            m_args       = args;
            m_isCollect  = isCollect;
            m_mainWindow = mainWindow;

            CurrentDirTextBox.Text = Environment.CurrentDirectory;

            // Initialize the CommandToRun history if available.
            var commandToRunHistory = App.ConfigData["CommandToRunHistory"];

            if (commandToRunHistory != null)
            {
                CommandToRunTextBox.SetHistory(commandToRunHistory.Split(';'));
            }

            if (args.CommandLine != null)
            {
                CommandToRunTextBox.Text = args.CommandLine;
            }

            DataFileNameTextBox.Text   = args.DataFile;
            RundownTimeoutTextBox.Text = args.RundownTimeout.ToString();
            SampleIntervalTextBox.Text = args.CpuSampleMSec.ToString();
            MaxCollectTextBox.Text     = args.MaxCollectSec == 0 ? "" : args.MaxCollectSec.ToString();
            StopTriggerTextBox.Text    = args.StopOnPerfCounter == null ? "" : string.Join(",", args.StopOnPerfCounter);
            CircularTextBox.Text       = args.CircularMB.ToString();

            ZipCheckBox.IsChecked   = args.Zip;
            MergeCheckBox.IsChecked = args.Merge;

            // We are not running from the command line
            if (CommandProcessor.IsGuiCollection(args))
            {
                // Then get the values from previous runs if present.
                if (!ZipCheckBox.IsChecked.HasValue)
                {
                    string configZip;
                    if (App.ConfigData.TryGetValue("Zip", out configZip))
                    {
                        ZipCheckBox.IsChecked = string.Compare(configZip, "true", true) == 0;
                    }
                }
                if (!MergeCheckBox.IsChecked.HasValue)
                {
                    string configMerge;
                    if (App.ConfigData.TryGetValue("Merge", out configMerge))
                    {
                        MergeCheckBox.IsChecked = string.Compare(configMerge, "true", true) == 0;
                    }
                }
            }

            NoNGenRundownCheckBox.IsChecked = args.NoNGenRundown;

            if (args.CpuCounters != null)
            {
                CpuCountersTextBox.Text = string.Join(" ", args.CpuCounters);
            }

            // TODO give better feedback about what happens when conflicts happen.
            if (args.ClrEvents != ClrTraceEventParser.Keywords.None)
            {
                ClrCheckBox.IsChecked = true;
            }

            if (args.TplEvents != TplEtwProviderTraceEventParser.Keywords.None)
            {
                TplCaptureCheckBox.IsChecked = true;
            }

            var kernelBase = (KernelTraceEventParser.Keywords)(KernelTraceEventParser.Keywords.Default - KernelTraceEventParser.Keywords.Profile);

            if ((args.KernelEvents & kernelBase) == kernelBase)
            {
                KernelBaseCheckBox.IsChecked = true;
            }
            if ((args.KernelEvents & KernelTraceEventParser.Keywords.Profile) != 0)
            {
                CpuSamplesCheckBox.IsChecked = true;
            }

            if (args.GCOnly)
            {
                GCOnlyCheckBox.IsChecked = true;
            }
            if (args.GCCollectOnly)
            {
                GCCollectOnlyCheckBox.IsChecked = true;
            }
            if (args.DotNetAlloc)
            {
                DotNetAllocCheckBox.IsChecked = true;
            }
            if (args.DotNetAllocSampled)
            {
                DotNetAllocSampledCheckBox.IsChecked = true;
            }
            if (args.DotNetCalls)
            {
                DotNetCallsCheckBox.IsChecked = true;
            }
            if (args.JITInlining)
            {
                JITInliningCheckBox.IsChecked = true;
            }
            if ((args.ClrEvents & ClrTraceEventParser.Keywords.GCSampledObjectAllocationHigh) != 0)
            {
                ETWDotNetAllocSampledCheckBox.IsChecked = true;
            }
            if (args.NetworkCapture)
            {
                NetCaptureCheckBox.IsChecked = true;
            }
            if (args.NetMonCapture)
            {
                NetMonCheckBox.IsChecked = true;
            }

            if (args.DumpHeap)
            {
                HeapSnapshotCheckBox.IsChecked = true;
            }

            if (args.OSHeapExe != null)
            {
                OSHeapExeTextBox.Text = args.OSHeapExe;
            }
            if (args.OSHeapProcess != 0)
            {
                OSHeapProcessTextBox.Text = args.OSHeapProcess.ToString();
            }

            if ((args.KernelEvents & (KernelTraceEventParser.Keywords.ContextSwitch | KernelTraceEventParser.Keywords.Dispatcher)) != 0)
            {
                ThreadTimeCheckbox.IsChecked = true;
            }
            if ((args.KernelEvents & KernelTraceEventParser.Keywords.Memory) != 0)
            {
                MemoryCheckBox.IsChecked = true;
            }
            if ((args.KernelEvents & KernelTraceEventParser.Keywords.Registry) != 0)
            {
                RegistryCheckBox.IsChecked = true;
            }
            if ((args.KernelEvents & KernelTraceEventParser.Keywords.FileIOInit) != 0)
            {
                FileIOCheckBox.IsChecked = true;
            }
            if ((args.KernelEvents & KernelTraceEventParser.Keywords.VirtualAlloc) != 0)
            {
                VirtualAllocCheckBox.IsChecked = true;
            }
            if ((args.KernelEvents & KernelTraceEventParser.Keywords.ReferenceSet) != 0)
            {
                RefSetCheckBox.IsChecked = true;
            }
            if ((args.KernelEvents & KernelTraceEventParser.Keywords.Handle) != 0)
            {
                HandleCheckBox.IsChecked = true;
            }

            // Initialize history of additional providers
            var additionalProvidersHistory = App.ConfigData["AdditionalProvidersHistory"];

            if (additionalProvidersHistory != null)
            {
                AdditionalProvidersTextBox.SetHistory(additionalProvidersHistory.Split(';'));
            }

            if (args.Providers != null)
            {
                var str = "";
                foreach (var provider in args.Providers)
                {
                    if (string.Compare(provider, "Microsoft-Windows-IIS", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        IISCheckBox.IsChecked = true;
                    }
                    if (string.Compare(provider, "ClrStress", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        StressCheckBox.IsChecked = true;
                    }
                    else if (string.Compare(provider, "Microsoft-Windows-Kernel-Memory") == 0)
                    {
                        MemInfoCheckBox.IsChecked = true;
                    }
                    else
                    {
                        if (str.Length != 0)
                        {
                            str += ",";
                        }
                        str += provider;
                    }
                }
                AdditionalProvidersTextBox.Text = str;
            }

            if (args.Message != null)
            {
                MarkTextBox.Text = args.Message;
            }
            else
            {
                MarkTextBox.Text = "Mark 1";
            }

            // TODO the defaults are wrong if you switch from run to collect and back
            if (isCollect)
            {
                Title = "Collecting data over a user specified interval";
                CommandToRunTextBox.Text        = "** Machine Wide **";
                CommandToRunTextBox.IsEnabled   = false;
                RundownCheckBox.IsChecked       = !args.NoRundown;
                RundownTimeoutTextBox.IsEnabled = !args.NoRundown;
                if (args.CircularMB == 0)
                {
                    CircularTextBox.Text = "500";
                }

                OKButton.Content   = "Start Collection";
                StatusTextBox.Text = "Press Start Collection to Start.";
                DataFileNameTextBox.Focus();
            }
            else
            {
                CommandToRunTextBox.Focus();
            }
        }
예제 #3
0
 public void Bind()
 {
     DataFileNameTextBox.Init(mAct.GetOrCreateInputParam(ActCreatePDFChart.Fields.DataFileName), ActInputValue.Fields.Value);
     ParamsComboBox.Init(mAct.GetOrCreateInputParam(ActCreatePDFChart.Fields.ParamName), SetParamsCombo(), true);
 }