public ICSharpCode.SharpDevelop.Gui.IViewContent CreateContentForFile(OpenedFile file)
        {
            ProfilingDataSQLiteProvider provider;

            try {
                provider = ProfilingDataSQLiteProvider.FromFile(file.FileName);
            } catch (IncompatibleDatabaseException e) {
                if (e.ActualVersion == new Version(1, 0))
                {
                    if (MessageService.AskQuestion("Upgrade DB?"))
                    {
                        using (AsynchronousWaitDialog.ShowWaitDialog("Upgrading database...")) {
                            provider = ProfilingDataSQLiteProvider.UpgradeFromOldVersion(file.FileName);
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    MessageService.ShowErrorFormatted("${res:AddIns.Profiler.DatabaseTooNewError}", e.ActualVersion.ToString(), e.ExpectedVersion.ToString());
                    return(null);
                }
            }
            return(new WpfViewer(file, provider));
        }
Пример #2
0
        public SQLiteQueryProvider(ProfilingDataSQLiteProvider sqliteProvider, int startDataSetID, int endDataSetID)
        {
            if (sqliteProvider == null)
            {
                throw new ArgumentNullException("sqliteProvider");
            }
            this.sqliteProvider = sqliteProvider;

            this.StartDataSet = FindDataSetById(startDataSetID);
            this.EndDataSet   = FindDataSetById(endDataSetID);
        }
Пример #3
0
        /// <summary>
        /// Creates a new WpfViewer object
        /// </summary>
        public WpfViewer(OpenedFile file, ProfilingDataSQLiteProvider provider)
        {
            // HACK : OpenedFile architecture does not allow to keep files open
            //        but it is necessary for the ProfilerView to keep the session file open.
            //        We don't want to load all session data into memory.
            // this.Files.Add(file);

            this.file        = file;
            this.provider    = provider;
            this.TabPageText = Path.GetFileName(file.FileName);
            this.TitleName   = this.TabPageText;
            dataView         = new ProfilerView(this.provider);

            // HACK : The file is not recognised by the FileService for closing if it is deleted while open.
            //        (reason see above comment)
            FileService.FileRemoving += FileServiceFileRemoving;
        }
        private void btnLoadSession_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter     = "SharpDevelop Profiling Session|*.sdps|All files|*.*";
            dlg.DefaultExt = ".sdps";
            if (!(dlg.ShowDialog() ?? false))
            {
                return;
            }
            if (this.provider != null)
            {
                this.provider.Close();
            }
            this.provider              = ProfilingDataSQLiteProvider.FromFile(dlg.FileName);
            this.treeView.Provider     = this.provider;
            this.treeView.CurrentQuery = "from t in Threads select t";
            treeView.SetRange(0, this.provider.DataSets.Count);
            this.timeLine.IsEnabled = true;
            //this.timeLine.ValuesList.Clear();
            //this.timeLine.ValuesList.AddRange(provider.DataSets.Select(i => i.CpuUsage));
        }
Пример #5
0
        /// <summary>
        /// Creates a new WpfViewer object
        /// </summary>
        public WpfViewer(OpenedFile file)
        {
            // HACK : OpenedFile architecture does not allow to keep files open
            //        but it is necessary for the ProfilerView to keep the session file open.
            //        We don't want to load all session data into memory.
            // this.Files.Add(file);

            // HACK : The file is not recognised by the FileService for closing if it is deleted while open.
            //        (reason see above comment)
            FileService.FileRemoving += FileServiceFileRemoving;

            this.file        = file;
            this.provider    = ProfilingDataSQLiteProvider.FromFile(file.FileName);
            this.TabPageText = Path.GetFileName(file.FileName);
            this.TitleName   = this.TabPageText;
            this.host        = new SharpDevelopElementHost(dataView = new ProfilerView(this.provider));
            // HACK : Make host.Child visible
            WorkbenchSingleton.SafeThreadAsyncCall(
                () => {
                this.host.Dock = DockStyle.None;
                this.host.Dock = DockStyle.Fill;
            }
                );
        }
Пример #6
0
        public void FixtureSetUp()
        {
            if (File.Exists(databaseFileName))
            {
                File.Delete(databaseFileName);
            }
            NameMapping method0 = new NameMapping(0, "r0", "m0", new List <string>());
            NameMapping method1 = new NameMapping(1, "r1", "m1", new List <string>());
            NameMapping method2 = new NameMapping(2, "r2", "m2", new List <string>());

            using (var writer = new ProfilingDataSQLiteWriter(databaseFileName)) {
                writer.ProcessorFrequency = 2000;                 // MHz
                writer.WriteMappings(new[] { method0, method1, method2 });
                CallTreeNodeStub dataSet;
                dataSet = new CallTreeNodeStub {
                    NameMappingValue = method0,
                    AddChildren      =
                    {
                        new CallTreeNodeStub {
                            NameMappingValue    = method1,
                            RawCallCountValue   = 10,
                            CpuCyclesSpentValue = 500 * k
                        }
                    }
                };
                writer.WriteDataSet(new DataSetStub {
                    IsFirst = true, RootNode = dataSet
                });
                dataSet = new CallTreeNodeStub {
                    NameMappingValue     = method0,
                    IsActiveAtStartValue = true,
                    AddChildren          =
                    {
                        new CallTreeNodeStub {
                            NameMappingValue     = method1,
                            RawCallCountValue    = 0,
                            IsActiveAtStartValue = true,
                            CpuCyclesSpentValue  = 200 * k
                        },
                        new CallTreeNodeStub {
                            NameMappingValue    = method2,
                            RawCallCountValue   = 1,
                            CpuCyclesSpentValue = 300 * k
                        }
                    }
                };
                writer.WriteDataSet(new DataSetStub {
                    IsFirst = false, RootNode = dataSet
                });
                dataSet = new CallTreeNodeStub {
                    NameMappingValue     = method0,
                    IsActiveAtStartValue = true,
                    AddChildren          =
                    {
                        new CallTreeNodeStub         {
                            NameMappingValue     = method2,
                            RawCallCountValue    = 0,
                            IsActiveAtStartValue = true,
                            CpuCyclesSpentValue  = 50 * k,
                            AddChildren          =
                            {
                                new CallTreeNodeStub {
                                    NameMappingValue    = method1,
                                    RawCallCountValue   = 5,
                                    CpuCyclesSpentValue = 1 * k
                                }
                            }
                        }
                    }
                };
                writer.WriteDataSet(new DataSetStub {
                    IsFirst = false, RootNode = dataSet
                });
                writer.Close();
            }
            provider = ProfilingDataSQLiteProvider.UpgradeFromOldVersion(databaseFileName);
        }
		public SQLiteQueryProvider(ProfilingDataSQLiteProvider sqliteProvider, int startDataSetID, int endDataSetID)
		{
			if (sqliteProvider == null)
				throw new ArgumentNullException("sqliteProvider");
			this.sqliteProvider = sqliteProvider;
			
			this.StartDataSet = FindDataSetById(startDataSetID);
			this.EndDataSet = FindDataSetById(endDataSetID);
		}