示例#1
0
 private void addInstrumentCode_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     if (StackUsageCalculator.AddInstrumentation(mDTE))
     {
         ATServiceProvider.DialogService.ShowDialog(
             null,
             "Instrumenting code has been added to your project as a new source file." + Environment.NewLine + "Please recompile your project to enable.",
             "Stack Checker - Instrumenting Code Added",
             DialogButtonSet.Ok, DialogIcon.Information);
     }
 }
示例#2
0
        void UpdateStackUsageInfo()
        {
            ITarget2 target = mTargetService.GetLaunchedTarget();

            if (target == null)
            {
                return;
            }

            Dispatcher.Invoke(new Action(
                                  () =>
            {
                stackUsageProgress.IsIndeterminate = true;
                deviceName.Text      = target.Device.Name;
                deviceName.FontStyle = FontStyles.Normal;
                stackUsageVal.Text   = "(Calculating...)";
            }));

            ulong currentUsage, maxUsage;

            if (StackUsageCalculator.GetStackUsage(target, out currentUsage, out maxUsage))
            {
                Dispatcher.Invoke(new Action(
                                      () =>
                {
                    stackUsageProgress.Maximum         = maxUsage;
                    stackUsageProgress.Value           = currentUsage;
                    stackUsageProgress.IsIndeterminate = false;
                    stackUsageVal.FontStyle            = FontStyles.Normal;
                    stackUsageVal.Text = string.Format("{0}/{1} ({2}%)",
                                                       stackUsageProgress.Value.ToString(), stackUsageProgress.Maximum.ToString(),
                                                       Math.Min(100, Math.Ceiling((100.0 * stackUsageProgress.Value) / stackUsageProgress.Maximum)));
                }));
            }
            else
            {
                Dispatcher.Invoke(new Action(
                                      () =>
                {
                    stackUsageProgress.IsIndeterminate = false;
                    stackUsageVal.Text = "(Unsupported Device)";
                }));
            }
        }
示例#3
0
        private void refreshUsage_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if ((mStackCalcThread != null) && mStackCalcThread.IsAlive)
            {
                return;
            }

            UpdateUI();

            if (StackUsageCalculator.HasInstrumentation(mDTE) == false)
            {
                deviceName.Text    = "(Missing Instrumentation)";
                stackUsageVal.Text = "(Missing Instrumentation)";
            }
            else if (mDTE.Debugger.CurrentMode == dbgDebugMode.dbgBreakMode)
            {
                mStackCalcThread = new System.Threading.Thread(UpdateStackUsageInfo);
                mStackCalcThread.Start();
            }
        }