Exemple #1
0
        private void Connections_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (CommandConnection item in e.NewItems)
                {
                    switch (item.Type)
                    {
                    case CommandConnectionType.Opened:
                    {
                        if (item.ConnectionId == null)
                        {
                            continue;
                        }

                        if (isConnectionDataPointAdded(item))
                        {
                            continue;
                        }

                        AddDataPoint(item.ApplicationIdentity, item.ConnectionId.Value, 0);
                        PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
                        CallbacksManagerBase.UpdateAppIdentityNotificationsCount(item);
                    }
                    break;
                    }
                }
                break;
            }
        }
Exemple #2
0
        private void Command_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (Command item in e.NewItems)
                {
                    var xValue = item.HttpInfo.HttpContextCurrentId;
                    if (xValue == null)
                    {
                        continue;
                    }

                    var pointInfo = FindDataPointInfo(item.ApplicationIdentity, xValue.Value);
                    if (pointInfo.Index == -1)
                    {
                        AddDataPoint(item.ApplicationIdentity, xValue.Value, 1);
                        PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
                        CallbacksManagerBase.UpdateAppIdentityNotificationsCount(item);
                    }
                    else
                    {
                        var newY = pointInfo.Point.Y + 1;
                        pointInfo.LineSeries.Points[pointInfo.Index] = new DataPoint(pointInfo.Point.X, newY);

                        UpdateYMax(newY);
                    }
                    HaveNewPoints = true;
                }
                break;
            }
        }
        public ChartsViewModelBase(ProfilerPluginBase pluginContext)
            : base(pluginContext)
        {
            if (Designer.IsInDesignModeStatic)
                return;

            CallbacksManagerBase = new CallbacksManagerBase(PluginContext, GuiModelData);
            GuiModelData.PropertyChanged += GuiModelData_PropertyChanged;
            CustomTooltipProvider = new CustomTooltipProvider { GetCustomTooltip = GetCustomTooltip };
        }
Exemple #4
0
        public MainViewModel(ProfilerPluginBase pluginContext)
            : base(pluginContext)
        {
            if (Designer.IsInDesignModeStatic)
                return;

            setActions();
            setGuiModel();
            _callbacksManager = new CallbacksManagerBase(PluginContext, GuiModelData);
            setEvenets();
        }
Exemple #5
0
        protected override void ShowNearestSelectedPointCommands(AppIdentity identity, LineSeries lineSeries, OxyMouseDownEventArgs args)
        {
            GuiModelData.SelectedApplicationIdentity = identity;

            var indexOfNearestPoint = (int)Math.Round(args.HitTestResult.Index);
            var point        = lineSeries.Points[indexOfNearestPoint];
            var connectionId = (int)point.X;

            CallbacksManagerBase.ShowAllCommandsWithSameConnectionId(connectionId);

            SelectedPointInfo = GetSelectedPointInfo(lineSeries, point);
        }
Exemple #6
0
        public MainViewModel(ProfilerPluginBase pluginContext)
            : base(pluginContext)
        {
            if (Designer.IsInDesignModeStatic)
            {
                return;
            }

            setActions();
            setGuiModel();
            _callbacksManager = new CallbacksManagerBase(PluginContext, GuiModelData);
            setEvenets();
        }
Exemple #7
0
        public ChartsViewModelBase(ProfilerPluginBase pluginContext)
            : base(pluginContext)
        {
            if (Designer.IsInDesignModeStatic)
            {
                return;
            }

            CallbacksManagerBase          = new CallbacksManagerBase(PluginContext, GuiModelData);
            GuiModelData.PropertyChanged += GuiModelData_PropertyChanged;
            CustomTooltipProvider         = new CustomTooltipProvider {
                GetCustomTooltip = GetCustomTooltip
            };
        }
Exemple #8
0
        private void CommandResults_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (CommandResult item in e.NewItems)
                {
                    if (item.CommandId != null && item.RowsReturned != null)
                    {
                        AddDataPoint(item.ApplicationIdentity, item.CommandId.Value,
                                     item.RowsReturned.Value);

                        PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
                        CallbacksManagerBase.UpdateAppIdentityNotificationsCount(item);
                    }
                }
                break;
            }
        }
Exemple #9
0
        private void showCommands(int requestId)
        {
            if (GuiModelData.SelectedApplicationIdentity == null)
            {
                return;
            }

            GuiModelData.RelatedCommands.Clear();
            GuiModelData.RelatedStackTraces.Clear();

            var commands = PluginContext.ProfilerData.Commands
                           .Where(command => command.HttpInfo.HttpContextCurrentId == requestId &&
                                  command.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity))
                           .OrderBy(command => command.AtDateTime)
                           .ToList();

            GuiModelData.RelatedCommands = new ObservableCollection <Command>(commands);

            CallbacksManagerBase.ActivateRelatedStackTraces();
        }
Exemple #10
0
        private void Results_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (CommandResult item in e.NewItems)
                {
                    if (item.CommandId == null)
                    {
                        continue;
                    }

                    var command = PluginContext.ProfilerData.Commands
                                  .FirstOrDefault(x => x.CommandId == item.CommandId &&
                                                  x.ApplicationIdentity.Equals(item.ApplicationIdentity));

                    if (command == null)
                    {
                        continue;
                    }

                    if (command.CommandCpuUsage == null)
                    {
                        command.CommandCpuUsage =
                            item.AppDomainSnapshot.TotalProcessorTime -
                            command.AppDomainSnapshot.TotalProcessorTime;
                    }

                    AddDataPoint(item.ApplicationIdentity,
                                 item.CommandId.Value, command.CommandCpuUsage.Value);

                    PluginContext.NotifyPluginsHost(NotificationType.Update, 1);
                    CallbacksManagerBase.UpdateAppIdentityNotificationsCount(item);
                }
                break;
            }
        }