From 250e9b13561529925d84920891537367025407aa Mon Sep 17 00:00:00 2001 From: Tobias Ibounig Date: Thu, 27 Jun 2013 23:40:37 +0200 Subject: [PATCH] Cleanup of Profiler - Removed unused using - Removed redundant 'this.' - Removed redundant 'private' modifier - Removed redundant namespace usings - Removed redundant default initializations (= null) --- .../Profiler/Controller/Data/CallTreeNode.cs | 28 ++-- .../Controller/Data/IProfilingDataSet.cs | 2 - .../Controller/Data/IProfilingDataWriter.cs | 2 - .../Data/IncompatibleDatabaseException.cs | 4 +- .../Profiler/Controller/Data/Linq/AllCalls.cs | 8 +- .../Profiler/Controller/Data/Linq/Filter.cs | 2 - .../Profiler/Controller/Data/Linq/Limit.cs | 6 - .../Controller/Data/Linq/MergeByName.cs | 5 - .../Linq/OptimizeQueryExpressionVisitor.cs | 4 +- .../Controller/Data/Linq/QueryNode.cs | 3 - .../Data/Linq/SQLiteQueryProvider.cs | 4 +- .../Profiler/Controller/Data/Linq/Sort.cs | 3 - .../Controller/Data/Linq/SqlQueryContext.cs | 6 +- .../Data/PerformanceCounterDescriptor.cs | 6 +- .../Controller/Data/ProfilingDataProvider.cs | 1 - .../Data/ProfilingDataSQLiteProvider.cs | 33 ++--- .../Data/ProfilingDataSQLiteWriter.cs | 40 +++--- .../Controller/Data/SQLiteCallTreeNode.cs | 41 +++--- .../Controller/Data/TempFileDatabase.cs | 67 +++++---- .../Data/UnitTestRootCallTreeNode.cs | 8 +- .../Controller/Data/UnitTestWriter.cs | 20 +-- .../Controller/Data/UnmanagedCallTreeNode.cs | 23 ++-- .../Data/UnmanagedProfilingDataSet.cs | 6 +- .../Profiler/Controller/ExtensionMethods.cs | 2 - .../Controller/Interprocess/AtomicBoolean.cs | 4 +- .../Interprocess/MemoryMappedFile.cs | 12 +- .../Interprocess/UnmanagedCircularBuffer.cs | 4 +- .../Analysis/Profiler/Controller/Profiler.cs | 128 +++++++++--------- .../Profiler/Controller/ProfilerOptions.cs | 3 +- .../Controller/Properties/AssemblyInfo.cs | 1 - .../Profiler/Controller/Queries/NodePath.cs | 2 +- .../Profiler/Controller/Queries/QueryBase.cs | 5 +- .../Controller/Queries/QueryCompiler.cs | 13 +- .../Analysis/Profiler/Controller/structs.cs | 3 +- .../AddIn/Src/Commands/CopySelectedData.cs | 3 - .../AddIn/Src/Commands/DomMenuCommand.cs | 2 - .../AddIn/Src/Commands/FindCallsOfSelected.cs | 5 - .../AddIn/Src/Commands/FindReferences.cs | 2 - .../AddIn/Src/Commands/GoToDefinition.cs | 1 - .../AddIn/Src/Commands/ProfileExecutable.cs | 3 +- .../AddIn/Src/Commands/ProfileProject.cs | 1 - .../AddIn/Src/Commands/ProfilerMenuCommand.cs | 3 +- .../Commands/RunTestWithProfilerCommand.cs | 2 - .../Frontend/AddIn/Src/Commands/SetAsRoot.cs | 5 - .../AddIn/Src/Commands/ShowFunctions.cs | 5 - .../Src/Dialogs/ProfileExecutableForm.xaml.cs | 5 +- .../Src/Dialogs/ProfilerControlWindow.xaml.cs | 18 +-- .../Profiler/Frontend/AddIn/Src/Extensions.cs | 1 - .../AddIn/Src/OptionPanels/General.cs | 7 - .../AddIn/Src/OptionPanels/OptionWrapper.cs | 1 - .../Frontend/AddIn/Src/ProfilerRunner.cs | 8 +- .../AddIn/Src/Views/ComparisonView.xaml.cs | 7 - .../AddIn/Src/Views/ProfilerView.xaml.cs | 20 +-- .../Frontend/AddIn/Src/Views/WpfViewer.cs | 13 +- .../Controls/CallTreeNodeViewModel.cs | 34 ++--- .../Frontend/Controls/CompareView.xaml.cs | 7 - .../Frontend/Controls/CustomGridView.cs | 5 +- .../Controls/ExtendedTimeLineControl.xaml.cs | 48 +++---- .../Profiler/Frontend/Controls/HSVColor.cs | 32 ++--- .../Frontend/Controls/HierarchyList.cs | 1 - .../Profiler/Frontend/Controls/PercentBar.cs | 9 +- .../Profiler/Frontend/Controls/PiePiece.cs | 8 +- .../Frontend/Controls/QueryView.xaml.cs | 59 ++++---- .../Frontend/Controls/RangeEventArgs.cs | 3 +- .../Frontend/Controls/RingDiagramControl.cs | 35 +++-- .../Profiler/Frontend/Controls/SingleTask.cs | 14 +- .../Profiler/Frontend/Controls/Task.cs | 2 +- .../Frontend/Controls/TimeLineControl.cs | 97 +++++++------ .../Frontend/Controls/TreeListView.cs | 20 +-- .../Profiler/Frontend/Controls/WaitBar.cs | 1 - .../Analysis/Profiler/X64Converter/Program.cs | 16 +-- .../X64Converter/Properties/AssemblyInfo.cs | 1 - 72 files changed, 427 insertions(+), 576 deletions(-) diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/CallTreeNode.cs b/src/AddIns/Analysis/Profiler/Controller/Data/CallTreeNode.cs index 4a984995f1..0bb070c9c6 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/CallTreeNode.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/CallTreeNode.cs @@ -52,7 +52,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public virtual int CallCount { get { - return this.RawCallCount + (this.IsActiveAtStart ? 1 : 0); + return RawCallCount + (IsActiveAtStart ? 1 : 0); } } @@ -61,7 +61,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public virtual bool IsUserCode { get { - return this.NameMapping.Id > 0; + return NameMapping.Id > 0; } } @@ -89,7 +89,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public string Name { get { - NameMapping name = this.NameMapping; + NameMapping name = NameMapping; return name != null ? name.Name : null; } } @@ -99,7 +99,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public string ReturnType { get { - NameMapping name = this.NameMapping; + NameMapping name = NameMapping; return name != null ? name.ReturnType : null; } } @@ -108,7 +108,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// Determines whether this node is a thread node. /// public virtual bool IsThread { - get { return this.Name.StartsWith("Thread#", StringComparison.Ordinal); } + get { return Name.StartsWith("Thread#", StringComparison.Ordinal); } } /// @@ -116,7 +116,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public virtual bool HasChildren { get { - return this.Children.Any(); + return Children.Any(); } } @@ -125,7 +125,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public IList Parameters { get { - NameMapping name = this.NameMapping; + NameMapping name = NameMapping; return name != null ? name.Parameters : NameMapping.EmptyParameterList; } } @@ -183,7 +183,7 @@ namespace ICSharpCode.Profiler.Controller.Data try { if (includeSelf) yield return this; // Descendants is reflexive - stack.Push(this.Children.GetEnumerator()); + stack.Push(Children.GetEnumerator()); while (stack.Count > 0) { IEnumerator e = stack.Peek(); if (e.MoveNext()) { @@ -220,7 +220,7 @@ namespace ICSharpCode.Profiler.Controller.Data IEnumerable GetAncestors(bool includeSelf) { - CallTreeNode n = includeSelf ? this : this.Parent; + CallTreeNode n = includeSelf ? this : Parent; while (n != null) { yield return n; n = n.Parent; @@ -256,11 +256,11 @@ namespace ICSharpCode.Profiler.Controller.Data public virtual IEnumerable GetPath() { bool hasItems = false; - foreach (CallTreeNode caller in this.Callers) { + foreach (CallTreeNode caller in Callers) { Debug.Print("caller: " + caller); foreach (NodePath p in caller.GetPath()) { hasItems = true; - yield return p.Append(this.NameMapping.Id); + yield return p.Append(NameMapping.Id); } } @@ -277,9 +277,9 @@ namespace ICSharpCode.Profiler.Controller.Data if (relativeTo.Equals(this)) yield return NodePath.Empty; else { - foreach (CallTreeNode caller in this.Callers) { + foreach (CallTreeNode caller in Callers) { foreach (NodePath p in caller.GetPathRelativeTo(relativeTo)) - yield return p.Append(this.NameMapping.Id); + yield return p.Append(NameMapping.Id); } } } @@ -301,7 +301,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public override string ToString() { - return "[" + GetType().Name + " " + this.NameMapping.Id + " " + this.NameMapping.Name + "]"; + return "[" + GetType().Name + " " + NameMapping.Id + " " + NameMapping.Name + "]"; } } } diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/IProfilingDataSet.cs b/src/AddIns/Analysis/Profiler/Controller/Data/IProfilingDataSet.cs index 16df7b35a5..f6e311c9cf 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/IProfilingDataSet.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/IProfilingDataSet.cs @@ -2,8 +2,6 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; namespace ICSharpCode.Profiler.Controller.Data { diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/IProfilingDataWriter.cs b/src/AddIns/Analysis/Profiler/Controller/Data/IProfilingDataWriter.cs index 68db3a0433..932faa9301 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/IProfilingDataWriter.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/IProfilingDataWriter.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; namespace ICSharpCode.Profiler.Controller.Data { diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/IncompatibleDatabaseException.cs b/src/AddIns/Analysis/Profiler/Controller/Data/IncompatibleDatabaseException.cs index 98c45ead08..ffcec9cca5 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/IncompatibleDatabaseException.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/IncompatibleDatabaseException.cs @@ -54,8 +54,8 @@ namespace ICSharpCode.Profiler.Controller.Data { base.GetObjectData(info, context); if (info != null) { - info.AddValue("ExpectedVersion", this.ExpectedVersion, typeof(Version)); - info.AddValue("ActualVersion", this.ActualVersion, typeof(Version)); + info.AddValue("ExpectedVersion", ExpectedVersion, typeof(Version)); + info.AddValue("ActualVersion", ActualVersion, typeof(Version)); } } } diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/AllCalls.cs b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/AllCalls.cs index ae3f7e32e7..7e3fc9ffc7 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/AllCalls.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/AllCalls.cs @@ -2,14 +2,8 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Globalization; -using System.IO; using System.Linq; using System.Linq.Expressions; -using System.Reflection; using System.Text; namespace ICSharpCode.Profiler.Controller.Data.Linq @@ -23,7 +17,7 @@ namespace ICSharpCode.Profiler.Controller.Data.Linq { public static readonly AllCalls Instance = new AllCalls(); - private AllCalls() : base(null) + AllCalls() : base(null) { } diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Filter.cs b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Filter.cs index f73ed092d1..a810bb7226 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Filter.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Filter.cs @@ -2,14 +2,12 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; -using System.Reflection; using System.Text; namespace ICSharpCode.Profiler.Controller.Data.Linq diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Limit.cs b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Limit.cs index 0ff7f59b7e..000ff4b074 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Limit.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Limit.cs @@ -2,14 +2,8 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Globalization; -using System.IO; using System.Linq; using System.Linq.Expressions; -using System.Reflection; using System.Text; namespace ICSharpCode.Profiler.Controller.Data.Linq diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/MergeByName.cs b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/MergeByName.cs index 192245dad9..d50ce49516 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/MergeByName.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/MergeByName.cs @@ -2,14 +2,9 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Diagnostics; -using System.Globalization; -using System.IO; using System.Linq; using System.Linq.Expressions; -using System.Reflection; using System.Text; namespace ICSharpCode.Profiler.Controller.Data.Linq diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/OptimizeQueryExpressionVisitor.cs b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/OptimizeQueryExpressionVisitor.cs index c312a44e1c..d192f8d9fa 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/OptimizeQueryExpressionVisitor.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/OptimizeQueryExpressionVisitor.cs @@ -16,7 +16,7 @@ namespace ICSharpCode.Profiler.Controller.Data.Linq /// Nodes returned from 'Visit' can be assumed to be fully optimized (they won't contain any of the patterns /// described in the SQLiteQueryProvider optimization documentation). /// - sealed class OptimizeQueryExpressionVisitor : System.Linq.Expressions.ExpressionVisitor + sealed class OptimizeQueryExpressionVisitor : ExpressionVisitor { QueryNode Visit(QueryNode queryNode) { @@ -181,7 +181,7 @@ namespace ICSharpCode.Profiler.Controller.Data.Linq } - sealed class IsConditionSafeVisitor : System.Linq.Expressions.ExpressionVisitor + sealed class IsConditionSafeVisitor : ExpressionVisitor { public static bool Test(Expression ex, params MemberInfo[] safeMembers) { diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/QueryNode.cs b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/QueryNode.cs index 77229973cb..3251b9f86f 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/QueryNode.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/QueryNode.cs @@ -3,10 +3,7 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Diagnostics; -using System.Globalization; -using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/SQLiteQueryProvider.cs b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/SQLiteQueryProvider.cs index fa436204c7..c5574d4ea9 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/SQLiteQueryProvider.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/SQLiteQueryProvider.cs @@ -252,7 +252,7 @@ namespace ICSharpCode.Profiler.Controller.Data.Linq } #region Convert Expression Tree To Query AST - sealed class ConvertToQueryAstVisitor : System.Linq.Expressions.ExpressionVisitor + sealed class ConvertToQueryAstVisitor : ExpressionVisitor { readonly QueryExecutionOptions options; @@ -573,7 +573,7 @@ namespace ICSharpCode.Profiler.Controller.Data.Linq #endregion #region ExecuteAllQueriesVisitor - sealed class ExecuteAllQueriesVisitor : System.Linq.Expressions.ExpressionVisitor + sealed class ExecuteAllQueriesVisitor : ExpressionVisitor { readonly SQLiteQueryProvider sqliteProvider; readonly QueryExecutionOptions options; diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Sort.cs b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Sort.cs index 699ad65b08..6d4c039119 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Sort.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/Sort.cs @@ -4,12 +4,9 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; -using System.Reflection; using System.Text; namespace ICSharpCode.Profiler.Controller.Data.Linq diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/SqlQueryContext.cs b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/SqlQueryContext.cs index e4f9ea4ee0..54501693fb 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/Linq/SqlQueryContext.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/Linq/SqlQueryContext.cs @@ -31,9 +31,9 @@ namespace ICSharpCode.Profiler.Controller.Data.Linq public void SetCurrent(CallTreeNodeSqlNameSet nameSet, SqlTableType table, bool hasIDList) { - this.CurrentNameSet = nameSet; - this.CurrentTable = table; - this.HasIDList = hasIDList; + CurrentNameSet = nameSet; + CurrentTable = table; + HasIDList = hasIDList; } SQLiteQueryProvider provider; diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/PerformanceCounterDescriptor.cs b/src/AddIns/Analysis/Profiler/Controller/Data/PerformanceCounterDescriptor.cs index a4589b464d..ea136b8da8 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/PerformanceCounterDescriptor.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/PerformanceCounterDescriptor.cs @@ -130,7 +130,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public void Reset() { - this.Values.Clear(); + Values.Clear(); } /// @@ -155,14 +155,14 @@ namespace ICSharpCode.Profiler.Controller.Data return; } try { - this.Values.Add(counter.NextValue()); + Values.Add(counter.NextValue()); #if DEBUG } catch (Exception e) { Console.WriteLine(e.ToString()); #else } catch (Exception) { #endif - this.Values.Add(defaultValue); + Values.Add(defaultValue); } } diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataProvider.cs b/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataProvider.cs index dbc93a6af9..e236eb53de 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataProvider.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataProvider.cs @@ -2,7 +2,6 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs b/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs index be9d32c330..330b974faa 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs @@ -1,18 +1,15 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.Profiler.Controller.Data.Linq; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Data.SQLite; -using System.Diagnostics; using System.Globalization; -using System.IO; using System.Linq; using System.Linq.Expressions; using System.Threading; -using ICSharpCode.Profiler.Interprocess; +using ICSharpCode.Profiler.Controller.Data.Linq; namespace ICSharpCode.Profiler.Controller.Data { @@ -142,7 +139,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public override void Close() { - this.Dispose(); + Dispose(); } /// @@ -182,7 +179,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public override ReadOnlyCollection DataSets { get { - if (this.dataSets == null) { + if (dataSets == null) { List list = new List(); SQLiteCommand cmd; @@ -202,10 +199,10 @@ namespace ICSharpCode.Profiler.Controller.Data } } - this.dataSets = new ReadOnlyCollection(list); + dataSets = new ReadOnlyCollection(list); } - return this.dataSets; + return dataSets; } } @@ -227,7 +224,7 @@ namespace ICSharpCode.Profiler.Controller.Data public CallTreeNode RootNode { get { - return this.provider.GetRoot(ID, ID); + return provider.GetRoot(ID, ID); } } @@ -246,7 +243,7 @@ namespace ICSharpCode.Profiler.Controller.Data rwLock.EnterWriteLock(); try { if (!isDisposed) - this.connection.Close(); + connection.Close(); isDisposed = true; } finally { @@ -330,17 +327,17 @@ namespace ICSharpCode.Profiler.Controller.Data throw new ProfilerException("processorfrequency was not found!"); } - return this.processorFrequency; + return processorFrequency; } } /// public override IQueryable GetFunctions(int startIndex, int endIndex) { - if (startIndex < 0 || startIndex >= this.DataSets.Count) + if (startIndex < 0 || startIndex >= DataSets.Count) throw new ArgumentOutOfRangeException("startIndex", startIndex, "Value must be between 0 and " + endIndex); - if (endIndex < startIndex || endIndex >= this.DataSets.Count) - throw new ArgumentOutOfRangeException("endIndex", endIndex, "Value must be between " + startIndex + " and " + (this.DataSets.Count - 1)); + if (endIndex < startIndex || endIndex >= DataSets.Count) + throw new ArgumentOutOfRangeException("endIndex", endIndex, "Value must be between " + startIndex + " and " + (DataSets.Count - 1)); SQLiteQueryProvider queryProvider = new SQLiteQueryProvider(this, startIndex, endIndex); @@ -478,15 +475,15 @@ namespace ICSharpCode.Profiler.Controller.Data LockObject LockAndCreateCommand(out SQLiteCommand cmd) { - this.rwLock.EnterReadLock(); + rwLock.EnterReadLock(); if (isDisposed) { - this.rwLock.ExitReadLock(); + rwLock.ExitReadLock(); throw new ObjectDisposedException("ProfilingDataSQLiteProvider", "The provider was already closed!"); } - cmd = this.connection.CreateCommand(); - return new LockObject(cmd, this.rwLock); + cmd = connection.CreateCommand(); + return new LockObject(cmd, rwLock); } struct LockObject : IDisposable diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataSQLiteWriter.cs b/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataSQLiteWriter.cs index 0a62869430..c76248f5aa 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataSQLiteWriter.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/ProfilingDataSQLiteWriter.cs @@ -3,15 +3,11 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Data.SQLite; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; -using ICSharpCode.Profiler.Interprocess; -using System.Threading; namespace ICSharpCode.Profiler.Controller.Data { @@ -60,13 +56,13 @@ namespace ICSharpCode.Profiler.Controller.Data if (isDisposed) return; - using (SQLiteCommand cmd = this.connection.CreateCommand()) { + using (SQLiteCommand cmd = connection.CreateCommand()) { // create index at the end (after inserting data), this is faster cmd.CommandText = CallsAndFunctionsIndexDefs; cmd.ExecuteNonQuery(); } - this.Dispose(); + Dispose(); } /// @@ -75,11 +71,11 @@ namespace ICSharpCode.Profiler.Controller.Data /// public int ProcessorFrequency { get { - return this.processorFrequency; + return processorFrequency; } set { processorFrequency = value; - ProfilingDataSQLiteProvider.SetProperty(this.connection.CreateCommand(), "processorfrequency", value.ToString(CultureInfo.InvariantCulture)); + ProfilingDataSQLiteProvider.SetProperty(connection.CreateCommand(), "processorfrequency", value.ToString(CultureInfo.InvariantCulture)); } } @@ -91,8 +87,8 @@ namespace ICSharpCode.Profiler.Controller.Data if (dataSet == null) throw new ArgumentNullException("dataSet"); - using (SQLiteTransaction transaction = this.connection.BeginTransaction()) { - SQLiteCommand cmd = this.connection.CreateCommand(); + using (SQLiteTransaction transaction = connection.BeginTransaction()) { + SQLiteCommand cmd = connection.CreateCommand(); if (dataSetCount == -1) dataSetCount = 0; @@ -106,7 +102,7 @@ namespace ICSharpCode.Profiler.Controller.Data int dataSetStartId = functionInfoCount; - using (SQLiteCommand loopCommand = this.connection.CreateCommand()) { + using (SQLiteCommand loopCommand = connection.CreateCommand()) { CallTreeNode node = dataSet.RootNode; loopCommand.CommandText = "INSERT INTO Calls(id, endid, parentid, nameid, cpucyclesspent, cpucyclesspentself, isactiveatstart, callcount)" + @@ -125,7 +121,7 @@ namespace ICSharpCode.Profiler.Controller.Data InsertCalls(loopCommand, node, -1, dataParams); } - using (SQLiteCommand functionsCommand = this.connection.CreateCommand()) { + using (SQLiteCommand functionsCommand = connection.CreateCommand()) { functionsCommand.CommandText = string.Format(@" INSERT INTO Functions SELECT {0}, nameid, SUM(cpucyclesspent), SUM(cpucyclesspentself), SUM(isactiveatstart), SUM(callcount), MAX(id != endid) @@ -201,7 +197,7 @@ namespace ICSharpCode.Profiler.Controller.Data // NameMapping.Id <-> FunctionData.NameId 1:N // FunctionData.ParentId <-> FunctionData.Id 1:N - SQLiteCommand cmd = this.connection.CreateCommand(); + SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = CallsAndFunctionsTableDefs + @" @@ -276,8 +272,8 @@ namespace ICSharpCode.Profiler.Controller.Data /// public void WriteMappings(IEnumerable mappings) { - using (SQLiteTransaction trans = this.connection.BeginTransaction()) { - using (SQLiteCommand cmd = this.connection.CreateCommand()) { + using (SQLiteTransaction trans = connection.BeginTransaction()) { + using (SQLiteCommand cmd = connection.CreateCommand()) { SQLiteParameter idParam = new SQLiteParameter("id"); SQLiteParameter retTParam = new SQLiteParameter("returntype"); SQLiteParameter nameParam = new SQLiteParameter("name"); @@ -307,7 +303,7 @@ namespace ICSharpCode.Profiler.Controller.Data public void Dispose() { if (!isDisposed) - this.connection.Close(); + connection.Close(); isDisposed = true; } @@ -315,9 +311,9 @@ namespace ICSharpCode.Profiler.Controller.Data /// public void WritePerformanceCounterData(IEnumerable counters) { - using (SQLiteTransaction trans = this.connection.BeginTransaction()) { - using (SQLiteCommand cmd = this.connection.CreateCommand()) { - using (SQLiteCommand cmd2 = this.connection.CreateCommand()) { + using (SQLiteTransaction trans = connection.BeginTransaction()) { + using (SQLiteCommand cmd = connection.CreateCommand()) { + using (SQLiteCommand cmd2 = connection.CreateCommand()) { SQLiteParameter idParam = new SQLiteParameter("id"); SQLiteParameter nameParam = new SQLiteParameter("name"); @@ -368,8 +364,8 @@ namespace ICSharpCode.Profiler.Controller.Data /// public void WriteEventData(IEnumerable events) { - using (SQLiteTransaction trans = this.connection.BeginTransaction()) { - using (SQLiteCommand cmd = this.connection.CreateCommand()) { + using (SQLiteTransaction trans = connection.BeginTransaction()) { + using (SQLiteCommand cmd = connection.CreateCommand()) { SQLiteParameter dataSetParam = new SQLiteParameter("datasetid"); SQLiteParameter eventTypeParam = new SQLiteParameter("eventtype"); SQLiteParameter nameIdParam = new SQLiteParameter("nameid"); @@ -395,7 +391,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public int DataSetCount { - get { return this.dataSetCount; } + get { return dataSetCount; } } } } diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/SQLiteCallTreeNode.cs b/src/AddIns/Analysis/Profiler/Controller/Data/SQLiteCallTreeNode.cs index 9ded14edd7..2cf6868540 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/SQLiteCallTreeNode.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/SQLiteCallTreeNode.cs @@ -1,14 +1,11 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.Profiler.Controller.Data.Linq; using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Data.SQLite; -using System.Globalization; using System.Linq; using System.Linq.Expressions; +using ICSharpCode.Profiler.Controller.Data.Linq; namespace ICSharpCode.Profiler.Controller.Data { @@ -44,15 +41,15 @@ namespace ICSharpCode.Profiler.Controller.Data /// internal int[] IdList { get { - int[] tmp = this.ids; + int[] tmp = ids; if (tmp == null) { tmp = provider.LoadIDListForFunction(nameId); - this.ids = tmp; + ids = tmp; } return tmp; } set { - this.ids = value; + ids = value; } } @@ -64,14 +61,14 @@ namespace ICSharpCode.Profiler.Controller.Data if (nameId == 0) return new NameMapping(0, null, "Merged node", null); - return this.provider.GetMapping(nameId); + return provider.GetMapping(nameId); } } /// public override int RawCallCount { get { - return this.callCount; + return callCount; } } @@ -80,12 +77,12 @@ namespace ICSharpCode.Profiler.Controller.Data /// public override long CpuCyclesSpent { get{ - return this.cpuCyclesSpent; + return cpuCyclesSpent; } } public override long CpuCyclesSpentSelf { - get { return this.cpuCyclesSpentSelf; } + get { return cpuCyclesSpentSelf; } } /// @@ -93,7 +90,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public override CallTreeNode Parent { get { - return this.parent; + return parent; } } @@ -110,7 +107,7 @@ namespace ICSharpCode.Profiler.Controller.Data if (!hasChildren) return EmptyQueryable; - List ids = this.IdList.ToList(); + List ids = IdList.ToList(); Expression> filterLambda = c => ids.Contains(c.ParentID); return provider.CreateQuery(new MergeByName(new Filter(AllCalls.Instance, filterLambda))); } @@ -121,13 +118,13 @@ namespace ICSharpCode.Profiler.Controller.Data /// public override double TimeSpent { get { - return CpuCyclesSpent / (1000.0 * this.provider.ProcessorFrequency); + return CpuCyclesSpent / (1000.0 * provider.ProcessorFrequency); } } public override double TimeSpentSelf { get { - return CpuCyclesSpentSelf / (1000.0 * this.provider.ProcessorFrequency); + return CpuCyclesSpentSelf / (1000.0 * provider.ProcessorFrequency); } } @@ -151,7 +148,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// A new CallTreeNode. public override CallTreeNode Merge(IEnumerable nodes) { - SQLiteCallTreeNode mergedNode = new SQLiteCallTreeNode(0, null, this.provider); + SQLiteCallTreeNode mergedNode = new SQLiteCallTreeNode(0, null, provider); List mergedIds = new List(); bool initialised = false; @@ -179,12 +176,12 @@ namespace ICSharpCode.Profiler.Controller.Data get { // parent is not null => this node was created by a // 'Children' call => all our IDs come from that parent - if (this.parent != null) - return (new CallTreeNode[] { this.parent }).AsQueryable(); + if (parent != null) + return (new CallTreeNode[] { parent }).AsQueryable(); List parentIDList = provider.RunSQLIDList( "SELECT parentid FROM Calls " - + "WHERE id IN(" + string.Join(",", this.IdList.Select(s => s.ToString()).ToArray()) + @")"); + + "WHERE id IN(" + string.Join(",", IdList.Select(s => s.ToString()).ToArray()) + @")"); Expression> filterLambda = c => parentIDList.Contains(c.ID); return provider.CreateQuery(new MergeByName(new Filter(AllCalls.Instance, filterLambda))); @@ -196,7 +193,7 @@ namespace ICSharpCode.Profiler.Controller.Data SQLiteCallTreeNode node = other as SQLiteCallTreeNode; if (node != null) { - int[] a = this.IdList; + int[] a = IdList; int[] b = node.IdList; if (a.Length != b.Length) return false; @@ -219,7 +216,7 @@ namespace ICSharpCode.Profiler.Controller.Data int hash = 0; unchecked { - foreach (int i in this.IdList) { + foreach (int i in IdList) { hash = hash * hashPrime + i; } } @@ -228,7 +225,7 @@ namespace ICSharpCode.Profiler.Controller.Data } public override bool HasChildren { - get { return this.hasChildren; } + get { return hasChildren; } } } } diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/TempFileDatabase.cs b/src/AddIns/Analysis/Profiler/Controller/Data/TempFileDatabase.cs index 0c824d3def..d62567ec3c 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/TempFileDatabase.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/TempFileDatabase.cs @@ -7,7 +7,6 @@ using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Runtime.InteropServices; -using System.Threading; using ICSharpCode.Profiler.Interprocess; @@ -77,7 +76,7 @@ namespace ICSharpCode.Profiler.Controller.Data public override int ProcessorFrequency { get { - return this.database.processorFrequency; + return database.processorFrequency; } } @@ -95,13 +94,13 @@ namespace ICSharpCode.Profiler.Controller.Data { if (nameId == 0) return new NameMapping(0); - return this.database.nameMappings[nameId]; + return database.nameMappings[nameId]; } public override void Dispose() { base.Dispose(); - this.view.Dispose(); + view.Dispose(); } } @@ -117,10 +116,10 @@ namespace ICSharpCode.Profiler.Controller.Data public int ProcessorFrequency { get { - return this.database.processorFrequency; + return database.processorFrequency; } set { - this.database.processorFrequency = value; + database.processorFrequency = value; } } @@ -131,7 +130,7 @@ namespace ICSharpCode.Profiler.Controller.Data throw new InvalidOperationException("TempFileDatabase cannot write DataSets other than UnmanagedProfilingDataSet!"); database.AddDataset((byte *)uDataSet.StartPtr.ToPointer(), uDataSet.Length, uDataSet.NativeStartPosition, uDataSet.NativeRootFuncInfoPosition, uDataSet.IsFirst); - this.database.is64Bit = uDataSet.Is64Bit; + database.is64Bit = uDataSet.Is64Bit; } public void Close() @@ -144,21 +143,21 @@ namespace ICSharpCode.Profiler.Controller.Data public void WriteMappings(IEnumerable mappings) { foreach (NameMapping nm in mappings) - this.database.nameMappings.Add(nm.Id, nm); + database.nameMappings.Add(nm.Id, nm); } public void WritePerformanceCounterData(IEnumerable counters) { - this.database.counters.AddRange(counters); + database.counters.AddRange(counters); } public void WriteEventData(IEnumerable events) { - this.database.events.AddRange(events); + database.events.AddRange(events); } public int DataSetCount { - get { return this.database.DataSetCount; } + get { return database.DataSetCount; } } } #endregion @@ -181,23 +180,23 @@ namespace ICSharpCode.Profiler.Controller.Data { byte[] data = new byte[length]; Marshal.Copy(new IntPtr(ptr), data, 0, (int)length); - if (this.currentWrite != null) - this.file.EndWrite(this.currentWrite); - this.streamInfos.Add(new StreamInfo { NativeStartPosition = nativeStartPosition, NativeRootFuncInfoStartPosition = nativeRootFuncInfoStartPosition, - StreamStartPosition = this.file.Length, StreamLength = length, IsFirst = isFirst }); - this.currentWrite = this.file.BeginWrite(data, 0, (int)length, null, null); + if (currentWrite != null) + file.EndWrite(currentWrite); + streamInfos.Add(new StreamInfo { NativeStartPosition = nativeStartPosition, NativeRootFuncInfoStartPosition = nativeRootFuncInfoStartPosition, + StreamStartPosition = file.Length, StreamLength = length, IsFirst = isFirst }); + currentWrite = file.BeginWrite(data, 0, (int)length, null, null); } void NotifyFinish() { - if (this.currentWrite != null) { - this.file.EndWrite(this.currentWrite); - this.currentWrite = null; + if (currentWrite != null) { + file.EndWrite(currentWrite); + currentWrite = null; } - this.file.Flush(); + file.Flush(); - if (this.streamInfos.Count > 0) - this.mmf = MemoryMappedFile.Open(file);//Name, FileAccess.Read, FileShare.ReadWrite); + if (streamInfos.Count > 0) + mmf = MemoryMappedFile.Open(file);//Name, FileAccess.Read, FileShare.ReadWrite); } /// @@ -205,9 +204,9 @@ namespace ICSharpCode.Profiler.Controller.Data /// public void Close() { - if (this.mmf != null) - this.mmf.Close(); - this.file.Close(); + if (mmf != null) + mmf.Close(); + file.Close(); } /// @@ -229,7 +228,7 @@ namespace ICSharpCode.Profiler.Controller.Data throw new IndexOutOfRangeException("index needs to be between 0 and " + (streamInfos.Count - 1) + "\nActual value: " + index); - if (this.mmf == null) + if (mmf == null) throw new InvalidOperationException("All writers have to be closed before reading the data from the database!"); return new DataSet(this, mmf.MapView(streamInfos[index].StreamStartPosition, streamInfos[index].StreamLength), streamInfos[index].NativeStartPosition, @@ -243,16 +242,16 @@ namespace ICSharpCode.Profiler.Controller.Data /// Used to report the progress of writing all DataSets, returning false tells WriteTo to cancel the process. public void WriteTo(IProfilingDataWriter writer, Predicate progressReport) { - writer.ProcessorFrequency = this.processorFrequency; - writer.WriteMappings(this.nameMappings.Values); - writer.WritePerformanceCounterData(this.counters); - writer.WriteEventData(this.events); + writer.ProcessorFrequency = processorFrequency; + writer.WriteMappings(nameMappings.Values); + writer.WritePerformanceCounterData(counters); + writer.WriteEventData(events); - for (int i = 0; i < this.DataSetCount; i++) { - using (UnmanagedProfilingDataSet dataSet = this.LoadDataSet(i)) + for (int i = 0; i < DataSetCount; i++) { + using (UnmanagedProfilingDataSet dataSet = LoadDataSet(i)) writer.WriteDataSet(dataSet); - if (!progressReport.Invoke((i + 1) / (double)this.DataSetCount)) + if (!progressReport.Invoke((i + 1) / (double)DataSetCount)) break; } } @@ -321,7 +320,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// Returns the number of DataSets stored in the database. /// public int DataSetCount { - get { return this.streamInfos.Count; } + get { return streamInfos.Count; } } /// diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/UnitTestRootCallTreeNode.cs b/src/AddIns/Analysis/Profiler/Controller/Data/UnitTestRootCallTreeNode.cs index c431530281..6af9e1bfe2 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/UnitTestRootCallTreeNode.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/UnitTestRootCallTreeNode.cs @@ -12,7 +12,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public class UnitTestRootCallTreeNode : CallTreeNode { - List unitTests = null; + List unitTests; /// /// Creates a new UnitTestRootCallTreeNode. @@ -40,7 +40,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public override bool IsActiveAtStart { get { - return (this.unitTests == null) ? false : this.unitTests.Any(test => test.IsActiveAtStart); + return (unitTests == null) ? false : unitTests.Any(test => test.IsActiveAtStart); } } @@ -66,7 +66,7 @@ namespace ICSharpCode.Profiler.Controller.Data } /// - public override CallTreeNode Merge(System.Collections.Generic.IEnumerable nodes) + public override CallTreeNode Merge(IEnumerable nodes) { // throw new ShouldNeverHappenException(); throw new NotSupportedException("Cannot merge a UnitTestRootCallTreeNode (should never be possible)"); @@ -75,7 +75,7 @@ namespace ICSharpCode.Profiler.Controller.Data /// public override int GetHashCode() { - return (this.unitTests == null) ? 0 : this.unitTests.Aggregate(0, (sum, item) => sum ^= item.GetHashCode()); + return (unitTests == null) ? 0 : unitTests.Aggregate(0, (sum, item) => sum ^= item.GetHashCode()); } /// diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/UnitTestWriter.cs b/src/AddIns/Analysis/Profiler/Controller/Data/UnitTestWriter.cs index 87c0fd197c..ad866cdfb7 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/UnitTestWriter.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/UnitTestWriter.cs @@ -47,8 +47,8 @@ namespace ICSharpCode.Profiler.Controller.Data /// public int ProcessorFrequency { - get { return this.targetWriter.ProcessorFrequency; } - set { this.targetWriter.ProcessorFrequency = value; } + get { return targetWriter.ProcessorFrequency; } + set { targetWriter.ProcessorFrequency = value; } } /// @@ -62,13 +62,13 @@ namespace ICSharpCode.Profiler.Controller.Data FindUnitTests(dataSet.RootNode, list); if (list.Count > 0) { - this.targetWriter.WriteDataSet( + targetWriter.WriteDataSet( new UnitTestDataSet(new UnitTestRootCallTreeNode(list), dataSet.IsFirst) ); } else { // proposed fix for http://community.sharpdevelop.net/forums/t/10533.aspx // discuss with Daniel - this.targetWriter.WriteDataSet(dataSet); + targetWriter.WriteDataSet(dataSet); } } @@ -90,32 +90,32 @@ namespace ICSharpCode.Profiler.Controller.Data } /// - public void WriteMappings(System.Collections.Generic.IEnumerable mappings) + public void WriteMappings(IEnumerable mappings) { - this.targetWriter.WriteMappings(mappings); + targetWriter.WriteMappings(mappings); } /// public void Close() { - this.targetWriter.Close(); + targetWriter.Close(); } /// public void WritePerformanceCounterData(IEnumerable counters) { - this.targetWriter.WritePerformanceCounterData(counters); + targetWriter.WritePerformanceCounterData(counters); } /// public void WriteEventData(IEnumerable events) { - this.targetWriter.WriteEventData(events); + targetWriter.WriteEventData(events); } /// public int DataSetCount { - get { return this.targetWriter.DataSetCount; } + get { return targetWriter.DataSetCount; } } } } diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/UnmanagedCallTreeNode.cs b/src/AddIns/Analysis/Profiler/Controller/Data/UnmanagedCallTreeNode.cs index 3ca9d0f6f1..d0a23f015f 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/UnmanagedCallTreeNode.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/UnmanagedCallTreeNode.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Linq; namespace ICSharpCode.Profiler.Controller.Data @@ -25,7 +24,7 @@ namespace ICSharpCode.Profiler.Controller.Data this.parent = parent; } - public override System.Linq.IQueryable Children { + public override IQueryable Children { get { dataSet.VerifyAccess(); @@ -47,35 +46,35 @@ namespace ICSharpCode.Profiler.Controller.Data public override NameMapping NameMapping { get { - return this.dataSet.GetMapping(this.data->Id); + return dataSet.GetMapping(data->Id); } } public override int RawCallCount { get { dataSet.VerifyAccess(); // need to verify before deferencing data - return this.data->CallCount; + return data->CallCount; } } public int Index { get { dataSet.VerifyAccess(); // need to verify before deferencing data - return (int)(this.data->TimeSpent >> 56); + return (int)(data->TimeSpent >> 56); } } public override bool IsActiveAtStart { get { dataSet.VerifyAccess(); // need to verify before deferencing data - return (this.data->TimeSpent & ((ulong)1 << 55)) != 0; + return (data->TimeSpent & ((ulong)1 << 55)) != 0; } } public override long CpuCyclesSpent { get { dataSet.VerifyAccess(); // need to verify before deferencing data - return (long)(this.data->TimeSpent & CpuCycleMask); + return (long)(data->TimeSpent & CpuCycleMask); } } @@ -83,7 +82,7 @@ namespace ICSharpCode.Profiler.Controller.Data get { dataSet.VerifyAccess(); - long result = (long)(this.data->TimeSpent & CpuCycleMask); + long result = (long)(data->TimeSpent & CpuCycleMask); TargetProcessPointer32* childrenPtr = FunctionInfo.GetChildren32(data); for (int i = 0; i <= data->LastChildIndex; i++) @@ -99,19 +98,19 @@ namespace ICSharpCode.Profiler.Controller.Data public override CallTreeNode Parent { get { - return this.parent; + return parent; } } public override double TimeSpent { get { - return this.CpuCyclesSpent / (1000.0 * this.dataSet.ProcessorFrequency); + return CpuCyclesSpent / (1000.0 * dataSet.ProcessorFrequency); } } public override double TimeSpentSelf { get { - return this.CpuCyclesSpentSelf / (1000.0 * this.dataSet.ProcessorFrequency); + return CpuCyclesSpentSelf / (1000.0 * dataSet.ProcessorFrequency); } } @@ -135,7 +134,7 @@ namespace ICSharpCode.Profiler.Controller.Data { UnmanagedCallTreeNode32 node = other as UnmanagedCallTreeNode32; if (node != null) { - return node.data == this.data; + return node.data == data; } return false; diff --git a/src/AddIns/Analysis/Profiler/Controller/Data/UnmanagedProfilingDataSet.cs b/src/AddIns/Analysis/Profiler/Controller/Data/UnmanagedProfilingDataSet.cs index 41707716b5..7ad98589c5 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Data/UnmanagedProfilingDataSet.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Data/UnmanagedProfilingDataSet.cs @@ -82,12 +82,12 @@ namespace ICSharpCode.Profiler.Controller.Data internal unsafe FunctionInfo* GetFunctionInfo(TargetProcessPointer ptr) { - return (FunctionInfo*)this.TranslatePointer(ptr); + return (FunctionInfo*)TranslatePointer(ptr); } internal unsafe FunctionInfo* GetRootFunctionInfo() { - return GetFunctionInfo(this.nativeRootFuncInfoPosition); + return GetFunctionInfo(nativeRootFuncInfoPosition); } /// @@ -96,7 +96,7 @@ namespace ICSharpCode.Profiler.Controller.Data public unsafe CallTreeNode RootNode { get { VerifyAccess(); - if (this.is64Bit) + if (is64Bit) return new UnmanagedCallTreeNode64( this, GetRootFunctionInfo(), diff --git a/src/AddIns/Analysis/Profiler/Controller/ExtensionMethods.cs b/src/AddIns/Analysis/Profiler/Controller/ExtensionMethods.cs index deb6a0cd52..c00e89a229 100644 --- a/src/AddIns/Analysis/Profiler/Controller/ExtensionMethods.cs +++ b/src/AddIns/Analysis/Profiler/Controller/ExtensionMethods.cs @@ -8,9 +8,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Linq.Expressions; -using System.Reflection; using System.Text; -using System.Text.RegularExpressions; using ICSharpCode.Profiler.Controller.Data; diff --git a/src/AddIns/Analysis/Profiler/Controller/Interprocess/AtomicBoolean.cs b/src/AddIns/Analysis/Profiler/Controller/Interprocess/AtomicBoolean.cs index 3856c30593..364c549b5e 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Interprocess/AtomicBoolean.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Interprocess/AtomicBoolean.cs @@ -48,7 +48,7 @@ namespace ICSharpCode.Profiler.Interprocess /// public override int GetHashCode() { - return this.Value.GetHashCode(); + return Value.GetHashCode(); } /// @@ -62,7 +62,7 @@ namespace ICSharpCode.Profiler.Interprocess /// public bool Equals(AtomicBoolean other) { - return this.Value == other.Value; + return Value == other.Value; } /// diff --git a/src/AddIns/Analysis/Profiler/Controller/Interprocess/MemoryMappedFile.cs b/src/AddIns/Analysis/Profiler/Controller/Interprocess/MemoryMappedFile.cs index 04073e8417..1e81f0d8fa 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Interprocess/MemoryMappedFile.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Interprocess/MemoryMappedFile.cs @@ -9,12 +9,12 @@ using System.Threading; namespace ICSharpCode.Profiler.Interprocess { // aliases for WIN32 types - using WORD = System.Int16; - using DWORD = System.Int32; - using ULONG = System.UInt32; - using LPVOID = System.IntPtr; - using DWORD_PTR = System.IntPtr; - using HANDLE = System.IntPtr; + using WORD = Int16; + using DWORD = Int32; + using ULONG = UInt32; + using LPVOID = IntPtr; + using DWORD_PTR = IntPtr; + using HANDLE = IntPtr; /// /// Represents a memory mapped file. diff --git a/src/AddIns/Analysis/Profiler/Controller/Interprocess/UnmanagedCircularBuffer.cs b/src/AddIns/Analysis/Profiler/Controller/Interprocess/UnmanagedCircularBuffer.cs index 7bca42f38f..26c5cff14d 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Interprocess/UnmanagedCircularBuffer.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Interprocess/UnmanagedCircularBuffer.cs @@ -59,7 +59,7 @@ namespace ICSharpCode.Profiler.Interprocess public static readonly int SynchronizationOverheadSize = sizeof(UnmanagedCircularBufferHeader); #region Construction - private UnmanagedCircularBuffer(IntPtr bufferPointer, int bufferLength) + UnmanagedCircularBuffer(IntPtr bufferPointer, int bufferLength) { // we need space for the header and at least 2 bytes of data (because the buffer can never be completely filled) if (bufferLength < sizeof(UnmanagedCircularBufferHeader) + 2) @@ -281,7 +281,7 @@ namespace ICSharpCode.Profiler.Interprocess // wait until there's data while (startOffset == endOffset) { lock (circularBuffer.closeLock) { - if (this.circularBuffer.isClosed) { + if (circularBuffer.isClosed) { Monitor.Pulse(circularBuffer.closeLock); return 0; } diff --git a/src/AddIns/Analysis/Profiler/Controller/Profiler.cs b/src/AddIns/Analysis/Profiler/Controller/Profiler.cs index 253764d6b1..ddabbc1fac 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Profiler.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Profiler.cs @@ -69,10 +69,10 @@ namespace ICSharpCode.Profiler.Controller public int ProcessorFrequency { get { - if (this.is64Bit) - return this.memHeader64->ProcessorFrequency; + if (is64Bit) + return memHeader64->ProcessorFrequency; else - return this.memHeader32->ProcessorFrequency; + return memHeader32->ProcessorFrequency; } } @@ -202,7 +202,7 @@ namespace ICSharpCode.Profiler.Controller /// public void EnableDataCollection() { - this.enableDC = true; + enableDC = true; } /// @@ -210,8 +210,8 @@ namespace ICSharpCode.Profiler.Controller /// public void DisableDataCollection() { - this.enableDC = false; - this.isFirstDC = true; + enableDC = false; + isFirstDC = true; } /// @@ -321,16 +321,16 @@ namespace ICSharpCode.Profiler.Controller void DataCollection() { while (!stopDC) { - this.Pause(); - this.threadListMutex.WaitOne(); + Pause(); + threadListMutex.WaitOne(); - if (this.is64Bit) + if (is64Bit) CollectData64(); else CollectData32(); - this.threadListMutex.ReleaseMutex(); - this.Continue(); + threadListMutex.ReleaseMutex(); + Continue(); Thread.Sleep(500); } } @@ -342,7 +342,7 @@ namespace ICSharpCode.Profiler.Controller ulong now = GetRdtsc(); - ThreadLocalData32* item = (ThreadLocalData32*)TranslatePointer(this.memHeader32->LastThreadListItem); + ThreadLocalData32* item = (ThreadLocalData32*)TranslatePointer(memHeader32->LastThreadListItem); List> stackList = new List>(); @@ -363,8 +363,8 @@ namespace ICSharpCode.Profiler.Controller item = (ThreadLocalData32*)TranslatePointer(item->Predecessor); } - if (this.enableDC) { - this.AddDataset(fullView.Pointer, + if (enableDC) { + AddDataset(fullView.Pointer, memHeader32->NativeAddress + memHeader32->HeapOffset, memHeader32->Allocator.startPos - memHeader32->NativeAddress, memHeader32->Allocator.pos - memHeader32->Allocator.startPos, @@ -381,7 +381,7 @@ namespace ICSharpCode.Profiler.Controller memHeader32->RootFuncInfoAddress = TranslatePointerBack32(root); - item = (ThreadLocalData32*)TranslatePointer(this.memHeader32->LastThreadListItem); + item = (ThreadLocalData32*)TranslatePointer(memHeader32->LastThreadListItem); now = GetRdtsc(); @@ -415,8 +415,8 @@ namespace ICSharpCode.Profiler.Controller unsafe void AddDataset(byte *ptr, TargetProcessPointer nativeStartPosition, long offset, long length, bool isFirst, TargetProcessPointer nativeRootFuncInfoPosition) { using (DataSet dataSet = new DataSet(this, ptr + offset, length, nativeStartPosition, nativeRootFuncInfoPosition, isFirst, is64Bit)) { - lock (this.dataWriter) { - this.dataWriter.WriteDataSet(dataSet); + lock (dataWriter) { + dataWriter.WriteDataSet(dataSet); if (usePerformanceCounters) { if (performanceCounterInstanceName == null) @@ -487,7 +487,7 @@ namespace ICSharpCode.Profiler.Controller while (readString != null) { readString = ReadString(stream); if (readString != null && !ProcessCommand(readString)) - this.LogString(readString); + LogString(readString); } } @@ -526,23 +526,23 @@ namespace ICSharpCode.Profiler.Controller LogString("Using 64-bit hook."); LogString("Starting process, waiting for profiler hook..."); - this.profilee = new Process(); + profilee = new Process(); - this.profilee.EnableRaisingEvents = true; - this.profilee.StartInfo = this.psi; - this.profilee.Exited += new EventHandler(ProfileeExited); + profilee.EnableRaisingEvents = true; + profilee.StartInfo = psi; + profilee.Exited += new EventHandler(ProfileeExited); - this.enableDC = this.profilerOptions.EnableDCAtStart; - this.isFirstDC = true; + enableDC = profilerOptions.EnableDCAtStart; + isFirstDC = true; - Debug.WriteLine("Launching profiler for " + this.psi.FileName + "..."); - this.profilee.Start(); + Debug.WriteLine("Launching profiler for " + psi.FileName + "..."); + profilee.Start(); - this.logger.Start(nativeToManagedBuffer.CreateReadingStream()); + logger.Start(nativeToManagedBuffer.CreateReadingStream()); // GC references currentSession - if (this.profilerOptions.EnableDC) { - this.dataCollector.Start(); + if (profilerOptions.EnableDC) { + dataCollector.Start(); } OnSessionStarted(EventArgs.Empty); @@ -554,11 +554,11 @@ namespace ICSharpCode.Profiler.Controller /// void Pause() { - this.accessEventHandle.Reset(); + accessEventHandle.Reset(); if (is64Bit) - this.memHeader64->ExclusiveAccess = 1; + memHeader64->ExclusiveAccess = 1; else - this.memHeader32->ExclusiveAccess = 1; + memHeader32->ExclusiveAccess = 1; Thread.MemoryBarrier(); if (is64Bit) while (!AllThreadsWait64()) ; @@ -569,7 +569,7 @@ namespace ICSharpCode.Profiler.Controller bool AllThreadsWait32() { try { - this.threadListMutex.WaitOne(); + threadListMutex.WaitOne(); } catch (AbandonedMutexException) { // profilee crashed while holding the thread list mutex return true; @@ -577,7 +577,7 @@ namespace ICSharpCode.Profiler.Controller bool isWaiting = true; - ThreadLocalData32* item = (ThreadLocalData32*)TranslatePointer(this.memHeader32->LastThreadListItem); + ThreadLocalData32* item = (ThreadLocalData32*)TranslatePointer(memHeader32->LastThreadListItem); while (item != null) { if (item->InLock == 1) @@ -586,7 +586,7 @@ namespace ICSharpCode.Profiler.Controller item = (ThreadLocalData32*)TranslatePointer(item->Predecessor); } - this.threadListMutex.ReleaseMutex(); + threadListMutex.ReleaseMutex(); return isWaiting; } @@ -597,10 +597,10 @@ namespace ICSharpCode.Profiler.Controller void Continue() { if (is64Bit) - this.memHeader64->ExclusiveAccess = 0; + memHeader64->ExclusiveAccess = 0; else - this.memHeader32->ExclusiveAccess = 0; - this.accessEventHandle.Set(); + memHeader32->ExclusiveAccess = 0; + accessEventHandle.Set(); } unsafe void ProfileeExited(object sender, EventArgs e) @@ -610,34 +610,34 @@ namespace ICSharpCode.Profiler.Controller DeregisterProfiler(); - this.stopDC = true; + stopDC = true; Debug.WriteLine("Closing native to managed buffer"); nativeToManagedBuffer.Close(true); Debug.WriteLine("Joining logger thread..."); - this.logger.Join(); + logger.Join(); Debug.WriteLine("Logger thread joined!"); - if (this.profilerOptions.EnableDC) - this.dataCollector.Join(); + if (profilerOptions.EnableDC) + dataCollector.Join(); // Do last data collection - if (this.is64Bit) + if (is64Bit) CollectData64(); else CollectData32(); isRunning = false; - this.dataWriter.WritePerformanceCounterData(performanceCounters); - this.dataWriter.Close(); + dataWriter.WritePerformanceCounterData(performanceCounters); + dataWriter.Close(); OnSessionEnded(EventArgs.Empty); } internal void LogString(string text) { - this.profilerOutput.AppendLine(text); + profilerOutput.AppendLine(text); OnOutputUpdated(EventArgs.Empty); } @@ -654,7 +654,7 @@ namespace ICSharpCode.Profiler.Controller internal unsafe void* TranslatePointer(TargetProcessPointer ptr) { - if (this.is64Bit) + if (is64Bit) return TranslatePointer64(ptr.To64()); else return TranslatePointer32(ptr.To32()); @@ -698,8 +698,8 @@ namespace ICSharpCode.Profiler.Controller string returnType = parts[3]; IList parameters = parts.Skip(5).ToList(); - lock (this.dataWriter) { - this.dataWriter.WriteMappings(new NameMapping[] {new NameMapping(id, returnType, name, parameters)}); + lock (dataWriter) { + dataWriter.WriteMappings(new NameMapping[] {new NameMapping(id, returnType, name, parameters)}); } return true; @@ -712,8 +712,8 @@ namespace ICSharpCode.Profiler.Controller int id = int.Parse(parts[1], CultureInfo.InvariantCulture); string name = parts[3] + ((string.IsNullOrEmpty(parts[4])) ? "" : " - " + parts[4]); - lock (this.dataWriter) { - this.dataWriter.WriteMappings(new[] {new NameMapping(id, null, name, null)}); + lock (dataWriter) { + dataWriter.WriteMappings(new[] {new NameMapping(id, null, name, null)}); } return true; @@ -726,8 +726,8 @@ namespace ICSharpCode.Profiler.Controller int name = int.Parse(parts[2], CultureInfo.InvariantCulture); string data = parts[3]; - lock (this.dataWriter) { - this.dataWriter.WriteEventData(new[] { new EventDataEntry() { DataSetId = this.dataWriter.DataSetCount, NameId = name, Type = (EventType)type, Data = data } }); + lock (dataWriter) { + dataWriter.WriteEventData(new[] { new EventDataEntry() { DataSetId = dataWriter.DataSetCount, NameId = name, Type = (EventType)type, Data = data } }); } return true; } else { @@ -820,27 +820,27 @@ namespace ICSharpCode.Profiler.Controller stopDC = true; nativeToManagedBuffer.Close(true); try { - this.profilee.Kill(); + profilee.Kill(); } catch (InvalidOperationException) { // can happen if profilee has already exited } if (logger != null && logger.IsAlive) { - this.logger.Join(); + logger.Join(); } if (dataCollector != null && dataCollector.IsAlive) { - this.dataCollector.Join(); + dataCollector.Join(); } - this.fullView.Dispose(); - this.file.Close(); + fullView.Dispose(); + file.Close(); - this.threadListMutex.Close(); - this.accessEventHandle.Close(); + threadListMutex.Close(); + accessEventHandle.Close(); - this.dataWriter.Close(); + dataWriter.Close(); - this.profilee.Dispose(); + profilee.Dispose(); } } @@ -865,13 +865,13 @@ namespace ICSharpCode.Profiler.Controller public override int ProcessorFrequency { get { - return this.profiler.ProcessorFrequency; + return profiler.ProcessorFrequency; } } internal unsafe override void* TranslatePointer(TargetProcessPointer ptr) { - return this.profiler.TranslatePointer(ptr); + return profiler.TranslatePointer(ptr); } } #endregion diff --git a/src/AddIns/Analysis/Profiler/Controller/ProfilerOptions.cs b/src/AddIns/Analysis/Profiler/Controller/ProfilerOptions.cs index 1c443b608c..638b2d8908 100644 --- a/src/AddIns/Analysis/Profiler/Controller/ProfilerOptions.cs +++ b/src/AddIns/Analysis/Profiler/Controller/ProfilerOptions.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using ICSharpCode.Profiler.Controller.Data; @@ -41,7 +40,7 @@ namespace ICSharpCode.Profiler.Controller /// Gets the performance counters selected for monitoring. /// public PerformanceCounterDescriptor[] Counters { - get { return this.counters; } + get { return counters; } } /// diff --git a/src/AddIns/Analysis/Profiler/Controller/Properties/AssemblyInfo.cs b/src/AddIns/Analysis/Profiler/Controller/Properties/AssemblyInfo.cs index 602c11c3a8..9c67ac314f 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Properties/AssemblyInfo.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Properties/AssemblyInfo.cs @@ -5,7 +5,6 @@ using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Security.Permissions; // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, diff --git a/src/AddIns/Analysis/Profiler/Controller/Queries/NodePath.cs b/src/AddIns/Analysis/Profiler/Controller/Queries/NodePath.cs index dce6fe2af6..6ca098f4c1 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Queries/NodePath.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Queries/NodePath.cs @@ -58,7 +58,7 @@ namespace ICSharpCode.Profiler.Controller.Queries if (other == null) return false; - return other.lastId == this.lastId && object.Equals(other.previous, this.previous); + return other.lastId == lastId && object.Equals(other.previous, previous); } /// diff --git a/src/AddIns/Analysis/Profiler/Controller/Queries/QueryBase.cs b/src/AddIns/Analysis/Profiler/Controller/Queries/QueryBase.cs index cfb70a6a81..45d04eb71f 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Queries/QueryBase.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Queries/QueryBase.cs @@ -1,10 +1,9 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.Profiler.Controller.Data; using System; -using System.Collections.Generic; using System.Linq; +using ICSharpCode.Profiler.Controller.Data; namespace ICSharpCode.Profiler.Controller.Queries { @@ -53,7 +52,7 @@ namespace ICSharpCode.Profiler.Controller.Queries /// public CallTreeNode GetNodeByPath(params int[] nameIds) { - CallTreeNode node = this.Root; + CallTreeNode node = Root; for (int i = 1; i < nameIds.Length; i++) { node = node.Children.FirstOrDefault(n => n.NameMapping.Id == nameIds[i]); diff --git a/src/AddIns/Analysis/Profiler/Controller/Queries/QueryCompiler.cs b/src/AddIns/Analysis/Profiler/Controller/Queries/QueryCompiler.cs index 5769cf865e..9caa0b43ab 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Queries/QueryCompiler.cs +++ b/src/AddIns/Analysis/Profiler/Controller/Queries/QueryCompiler.cs @@ -1,15 +1,14 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.Profiler.Controller.Data; using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; -using System.Text; using Microsoft.CSharp; +using ICSharpCode.Profiler.Controller.Data; namespace ICSharpCode.Profiler.Controller.Queries { @@ -69,11 +68,11 @@ namespace ICSharpCode.Profiler.Controller.Queries /// true, if successful, otherwise false. public bool Compile() { - if (string.IsNullOrEmpty(this.currentQuery)) + if (string.IsNullOrEmpty(currentQuery)) return false; lock (queryCache) { - if (!queryCache.ContainsKey(this.currentQuery)) { + if (!queryCache.ContainsKey(currentQuery)) { string code = text + PreprocessString(currentQuery) + textEnd; CompilerResults results = csc.CompileAssemblyFromSource(GetParameters(), code); report(results.Errors.Cast()); @@ -81,7 +80,7 @@ namespace ICSharpCode.Profiler.Controller.Queries if (results.Errors.Count > 0) return false; - queryCache.Add(this.currentQuery, results.CompiledAssembly); + queryCache.Add(currentQuery, results.CompiledAssembly); } else { report(new List().AsEnumerable()); // clear errors list } @@ -101,7 +100,7 @@ namespace ICSharpCode.Profiler.Controller.Queries Assembly assembly; lock (queryCache) - assembly = queryCache[this.currentQuery]; + assembly = queryCache[currentQuery]; QueryBase queryContainer = assembly.CreateInstance("Query") as QueryBase; queryContainer.Provider = provider; @@ -130,7 +129,7 @@ namespace ICSharpCode.Profiler.Controller.Queries cp.OutputAssembly = Path.GetTempFileName(); cp.ReferencedAssemblies.Add("System.dll"); cp.ReferencedAssemblies.Add("System.Core.dll"); - cp.ReferencedAssemblies.Add(this.GetType().Assembly.Location); + cp.ReferencedAssemblies.Add(GetType().Assembly.Location); cp.WarningLevel = 4; cp.TreatWarningsAsErrors = true; diff --git a/src/AddIns/Analysis/Profiler/Controller/structs.cs b/src/AddIns/Analysis/Profiler/Controller/structs.cs index 42ccdfe5d7..1a92af36af 100644 --- a/src/AddIns/Analysis/Profiler/Controller/structs.cs +++ b/src/AddIns/Analysis/Profiler/Controller/structs.cs @@ -2,7 +2,6 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; using System.Globalization; using System.Runtime.InteropServices; @@ -126,7 +125,7 @@ namespace ICSharpCode.Profiler.Controller public override bool Equals(object obj) { if (obj is TargetProcessPointer) { - return ((TargetProcessPointer)obj).pointer.Pointer == this.pointer.Pointer; + return ((TargetProcessPointer)obj).pointer.Pointer == pointer.Pointer; } return false; diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/CopySelectedData.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/CopySelectedData.cs index a96201f2b4..cc9a671965 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/CopySelectedData.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/CopySelectedData.cs @@ -6,10 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; -using System.Windows.Controls; -using ICSharpCode.Core; -using ICSharpCode.Profiler.AddIn.Views; using ICSharpCode.Profiler.Controls; namespace ICSharpCode.Profiler.AddIn.Commands diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/DomMenuCommand.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/DomMenuCommand.cs index 4342ad833f..537600046e 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/DomMenuCommand.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/DomMenuCommand.cs @@ -5,11 +5,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Project; namespace ICSharpCode.Profiler.AddIn.Commands diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/FindCallsOfSelected.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/FindCallsOfSelected.cs index d5bc8abf48..d9bb150eee 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/FindCallsOfSelected.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/FindCallsOfSelected.cs @@ -3,16 +3,11 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; -using System.Text; -using System.Windows.Controls; using ICSharpCode.Core; -using ICSharpCode.Profiler.AddIn.Views; using ICSharpCode.Profiler.Controller.Data; using ICSharpCode.Profiler.Controller.Queries; -using ICSharpCode.Profiler.Controls; namespace ICSharpCode.Profiler.AddIn.Commands { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/FindReferences.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/FindReferences.cs index c3b8fc07bf..259804f11f 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/FindReferences.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/FindReferences.cs @@ -3,9 +3,7 @@ using System; using System.Linq; -using ICSharpCode.Core; using ICSharpCode.NRefactory.TypeSystem; -using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Refactoring; diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/GoToDefinition.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/GoToDefinition.cs index 289bf185c3..77a30e63e7 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/GoToDefinition.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/GoToDefinition.cs @@ -6,7 +6,6 @@ using System.Linq; using ICSharpCode.Core; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; namespace ICSharpCode.Profiler.AddIn.Commands { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfileExecutable.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfileExecutable.cs index fe979f06e5..a4d5affd8d 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfileExecutable.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfileExecutable.cs @@ -3,9 +3,8 @@ using System; using ICSharpCode.Core; -using ICSharpCode.Profiler.AddIn.Dialogs; using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; +using ICSharpCode.Profiler.AddIn.Dialogs; namespace ICSharpCode.Profiler.AddIn.Commands { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfileProject.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfileProject.cs index c6f72a9512..a2585b1ca1 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfileProject.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfileProject.cs @@ -8,7 +8,6 @@ using ICSharpCode.SharpDevelop.Project; namespace ICSharpCode.Profiler.AddIn.Commands { - using ICSharpCode.Profiler.Controller; /// /// Description of RunProject diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfilerMenuCommand.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfilerMenuCommand.cs index 155c0cc5dc..127e484d09 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfilerMenuCommand.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ProfilerMenuCommand.cs @@ -5,12 +5,11 @@ using System; using System.Collections.Generic; using System.Linq; using System.Windows; -using System.Windows.Controls; using System.Windows.Shapes; using ICSharpCode.Core; -using ICSharpCode.Profiler.AddIn.Views; using ICSharpCode.Profiler.Controls; +using ICSharpCode.Profiler.AddIn.Views; namespace ICSharpCode.Profiler.AddIn.Commands { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs index f41a540ef6..e77a275381 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs @@ -7,9 +7,7 @@ using ICSharpCode.Core; using ICSharpCode.Profiler.Controller; using ICSharpCode.Profiler.Controller.Data; using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Project; using ICSharpCode.UnitTesting; -using Mono.CSharp.Linq; namespace ICSharpCode.Profiler.AddIn.Commands { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/SetAsRoot.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/SetAsRoot.cs index ea21364714..873b77e7fd 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/SetAsRoot.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/SetAsRoot.cs @@ -3,16 +3,11 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; -using System.Text; -using System.Windows.Controls; using ICSharpCode.Core; -using ICSharpCode.Profiler.AddIn.Views; using ICSharpCode.Profiler.Controller.Data; using ICSharpCode.Profiler.Controller.Queries; -using ICSharpCode.Profiler.Controls; namespace ICSharpCode.Profiler.AddIn.Commands { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ShowFunctions.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ShowFunctions.cs index 6fb43bdd93..26744647fb 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ShowFunctions.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Commands/ShowFunctions.cs @@ -2,15 +2,10 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; using System.Linq; -using System.Windows.Controls; using ICSharpCode.Core; -using ICSharpCode.Profiler.AddIn.Views; -using ICSharpCode.Profiler.Controller; using ICSharpCode.Profiler.Controls; -using ICSharpCode.SharpDevelop; namespace ICSharpCode.Profiler.AddIn.Commands { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs index 5a283f86f8..8eca6a0cc1 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs @@ -11,7 +11,6 @@ using ICSharpCode.Core; using ICSharpCode.Profiler.Controller; using ICSharpCode.Profiler.Controller.Data; using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; using Microsoft.Win32; namespace ICSharpCode.Profiler.AddIn.Dialogs @@ -28,7 +27,7 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs void btnCancelClick(object sender, RoutedEventArgs e) { - this.Close(); + Close(); } void btnStartClick(object sender, RoutedEventArgs e) @@ -64,7 +63,7 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs runner.Run(); } - this.Close(); + Close(); } catch (ProfilerException ex) { MessageService.ShowError(ex.Message); } diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Dialogs/ProfilerControlWindow.xaml.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Dialogs/ProfilerControlWindow.xaml.cs index d6c7f58032..4bf2f2e32c 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Dialogs/ProfilerControlWindow.xaml.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Dialogs/ProfilerControlWindow.xaml.cs @@ -1,17 +1,9 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.Core; using System; -using System.Collections.Generic; -using System.Text; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using ICSharpCode.Profiler.Controller; +using ICSharpCode.Core; namespace ICSharpCode.Profiler.AddIn.Dialogs { @@ -34,7 +26,7 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs void CollectDataChecked(object sender, RoutedEventArgs e) { try { - this.runner.Profiler.EnableDataCollection(); + runner.Profiler.EnableDataCollection(); } catch (Exception ex) { MessageService.ShowException(ex); } @@ -43,7 +35,7 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs void CollectDataUnchecked(object sender, RoutedEventArgs e) { try { - this.runner.Profiler.DisableDataCollection(); + runner.Profiler.DisableDataCollection(); } catch (Exception ex) { MessageService.ShowException(ex); } @@ -51,8 +43,8 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs void ShutdownClick(object sender, RoutedEventArgs e) { - this.AllowClose = true; - this.runner.Stop(); + AllowClose = true; + runner.Stop(); } void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e) diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Extensions.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Extensions.cs index 434dcb10ee..118eaaff00 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Extensions.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Extensions.cs @@ -1,7 +1,6 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.SharpDevelop.Gui; using System; using System.Globalization; using System.IO; diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/OptionPanels/General.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/OptionPanels/General.cs index 457f9a1c79..e7013af155 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/OptionPanels/General.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/OptionPanels/General.cs @@ -2,15 +2,8 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Windows.Forms; -using System.Windows.Forms.Integration; -using ICSharpCode.Core; -using ICSharpCode.Profiler.Controller; -using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Gui; -using System.Windows.Threading; namespace ICSharpCode.Profiler.AddIn.OptionPanels { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/OptionPanels/OptionWrapper.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/OptionPanels/OptionWrapper.cs index 771e003e36..faa351e1be 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/OptionPanels/OptionWrapper.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/OptionPanels/OptionWrapper.cs @@ -4,7 +4,6 @@ using System; using ICSharpCode.Core; using ICSharpCode.Profiler.Controller; -using ICSharpCode.Profiler.Controller.Data; using ICSharpCode.SharpDevelop; namespace ICSharpCode.Profiler.AddIn.OptionPanels diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs index c54744452b..ad2182311f 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs @@ -81,7 +81,7 @@ namespace ICSharpCode.Profiler.AddIn try { using (AsynchronousWaitDialog dlg = AsynchronousWaitDialog.ShowWaitDialog(StringParser.Parse("${res:AddIns.Profiler.Messages.PreparingForAnalysis}"), true)) { profiler.Dispose(); - SD.MainThread.InvokeAsyncAndForget(() => { controlWindow.AllowClose = true; this.controlWindow.Close(); }); + SD.MainThread.InvokeAsyncAndForget(() => { controlWindow.AllowClose = true; controlWindow.Close(); }); if (database != null) { database.WriteTo(writer, progress => { dlg.Progress = progress; @@ -104,9 +104,9 @@ namespace ICSharpCode.Profiler.AddIn public Process Run() { SD.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront(); - this.controlWindow = new ProfilerControlWindow(this); + controlWindow = new ProfilerControlWindow(this); Process p = profiler.Start(); - this.controlWindow.Show(); + controlWindow.Show(); return p; } @@ -149,7 +149,7 @@ namespace ICSharpCode.Profiler.AddIn } #region MessageView Management - static MessageViewCategory profileCategory = null; + static MessageViewCategory profileCategory; static void EnsureProfileCategory() { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ComparisonView.xaml.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ComparisonView.xaml.cs index 2a9fe8213d..48feeab351 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ComparisonView.xaml.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ComparisonView.xaml.cs @@ -2,14 +2,7 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Text; -using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; namespace ICSharpCode.Profiler.AddIn.Views { diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs index d484b997a1..bc30e95ad5 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs @@ -62,7 +62,7 @@ namespace ICSharpCode.Profiler.AddIn.Views void TimeLineRangeChanged(object sender, RangeEventArgs e) { - foreach (TabItem item in this.tabView.Items) { + foreach (TabItem item in tabView.Items) { if (item != null && item.Content != null) ((QueryView)item.Content).SetRange(e.StartIndex, e.EndIndex); } @@ -76,9 +76,9 @@ namespace ICSharpCode.Profiler.AddIn.Views void DoSelectAll() { - if (this.timeLine.IsEnabled) { - this.timeLine.SelectedStartIndex = 0; - this.timeLine.SelectedEndIndex = this.timeLine.Provider.DataSets.Count - 1; + if (timeLine.IsEnabled) { + timeLine.SelectedStartIndex = 0; + timeLine.SelectedEndIndex = timeLine.Provider.DataSets.Count - 1; } } @@ -90,7 +90,7 @@ namespace ICSharpCode.Profiler.AddIn.Views void CanDoSelectAll(CanExecuteRoutedEventArgs e) { - e.CanExecute = this.timeLine.IsEnabled && this.timeLine.Provider.DataSets.Count > 0; + e.CanExecute = timeLine.IsEnabled && timeLine.Provider.DataSets.Count > 0; } void CloseButtonClick(object sender, RoutedEventArgs e) @@ -157,8 +157,8 @@ namespace ICSharpCode.Profiler.AddIn.Views provider.SetProperty("tabs", tabs.CreateSeparatedString()); List queryHistory = new List(); - for (int i = 2; i < this.mnuQueryHistory.Items.Count; i++) - queryHistory.Add((this.mnuQueryHistory.Items[i] as MenuItem).Header.ToString() ?? string.Empty); + for (int i = 2; i < mnuQueryHistory.Items.Count; i++) + queryHistory.Add((mnuQueryHistory.Items[i] as MenuItem).Header.ToString() ?? string.Empty); provider.SetProperty("queryHistory", queryHistory.CreateSeparatedString()); } @@ -170,7 +170,7 @@ namespace ICSharpCode.Profiler.AddIn.Views TabItem CreateTab(string title, string query, bool switchToNewTab) { TabItem newTab = new TabItem(); - Button closeButton = new Button { Style = this.Resources["CloseButton"] as Style }; + Button closeButton = new Button { Style = Resources["CloseButton"] as Style }; TextBlock header = new TextBlock { Margin = new Thickness(0, 0, 4, 0), MaxWidth = 120, MinWidth = 40 }; newTab.Header = new StackPanel { Orientation = Orientation.Horizontal, Children = { header, closeButton } }; @@ -182,9 +182,9 @@ namespace ICSharpCode.Profiler.AddIn.Views newTab.Content = view = new QueryView(); - view.Provider = this.provider; + view.Provider = provider; view.Reporter = new ErrorReporter(UpdateErrorList); - view.SetRange(this.timeLine.SelectedStartIndex, this.timeLine.SelectedEndIndex); + view.SetRange(timeLine.SelectedStartIndex, timeLine.SelectedEndIndex); view.CurrentQuery = query; view.ShowQueryItems = true; diff --git a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs index f1ebeabe1d..99d008188f 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs @@ -1,20 +1,15 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.Core; using System; using System.IO; -using System.Windows.Forms; -using System.Windows.Forms.Integration; -using ICSharpCode.Core.Presentation; +using ICSharpCode.Core; using ICSharpCode.Profiler.Controller.Data; using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Workbench; namespace ICSharpCode.Profiler.AddIn.Views { - using ICSharpCode.Profiler.Controller; /// /// Description of the view content @@ -67,7 +62,7 @@ namespace ICSharpCode.Profiler.AddIn.Views { if (FileUtility.IsEqualFileName(e.FileName, file.FileName) || FileUtility.IsBaseDirectory(e.FileName, file.FileName)) - this.WorkbenchWindow.CloseWindow(true); + WorkbenchWindow.CloseWindow(true); } /// @@ -75,8 +70,8 @@ namespace ICSharpCode.Profiler.AddIn.Views /// public override void Dispose() { - this.dataView.SaveUserState(); - this.provider.Close(); + dataView.SaveUserState(); + provider.Close(); FileService.FileRemoving -= FileServiceFileRemoving; base.Dispose(); diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs index e372fad47c..c5a7bc123d 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.Profiler.Controls protected void OnPropertyChanged(string name) { - if (this.PropertyChanged != null) + if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(name)); } @@ -61,7 +61,7 @@ namespace ICSharpCode.Profiler.Controls void BringIntoView(CallTreeNodeViewModel item) { - if (this.parent != null) { + if (parent != null) { parent.BringIntoView(item); return; } @@ -89,10 +89,10 @@ namespace ICSharpCode.Profiler.Controls public virtual double TimePercentageOfParent { get { - if (this.parent == null) + if (parent == null) return 1; else - return (double)this.node.CpuCyclesSpent / (double)this.parent.node.CpuCyclesSpent; + return (double)node.CpuCyclesSpent / (double)parent.node.CpuCyclesSpent; } } @@ -168,7 +168,7 @@ namespace ICSharpCode.Profiler.Controls public ReadOnlyCollection Parameters { get { - return new ReadOnlyCollection(this.node.Parameters); + return new ReadOnlyCollection(node.Parameters); } } @@ -196,15 +196,15 @@ namespace ICSharpCode.Profiler.Controls public virtual ReadOnlyCollection Children { get { lock (this) { - if (this.children == null) { + if (children == null) { - this.children = this.node.Children + children = node.Children .Select(c => new CallTreeNodeViewModel(c, this)) .ToList() .AsReadOnly(); } - return this.children; + return children; } } } @@ -212,14 +212,14 @@ namespace ICSharpCode.Profiler.Controls public virtual string Name { get { - return this.node.Name ?? string.Empty; + return node.Name ?? string.Empty; } } public virtual string FullyQualifiedClassName { get { - string nodeName = this.node.Name; + string nodeName = node.Name; if (string.IsNullOrEmpty(nodeName)) return null; if (!nodeName.Contains(".")) @@ -234,7 +234,7 @@ namespace ICSharpCode.Profiler.Controls public virtual string MethodName { get { - string nodeName = this.node.Name; + string nodeName = node.Name; if (string.IsNullOrEmpty(nodeName)) return null; if (!nodeName.Contains(".")) @@ -249,9 +249,9 @@ namespace ICSharpCode.Profiler.Controls public virtual string ShortName { get { - string className = this.FullyQualifiedClassName; + string className = FullyQualifiedClassName; if (className == null) - return this.Name; + return Name; int index = className.LastIndexOf('.'); return className.Substring(index + 1) + "." + MethodName; } @@ -265,7 +265,7 @@ namespace ICSharpCode.Profiler.Controls if (isExpanded != value) { isExpanded = value; OnPropertyChanged("IsExpanded"); - this.IsExpandedChanged(new NodeEventArgs(this)); + IsExpandedChanged(new NodeEventArgs(this)); if (isExpanded) { DeselectChildren(children); @@ -285,7 +285,7 @@ namespace ICSharpCode.Profiler.Controls void IsExpandedChanged(NodeEventArgs e) { - this.visibleElementCount = 1 + (IsExpanded ? Children.Sum(c => c.VisibleElementCount) : 0); + visibleElementCount = 1 + (IsExpanded ? Children.Sum(c => c.VisibleElementCount) : 0); OnVisibleChildExpandedChanged(e); if (Parent != null && Parent.IsExpanded) { @@ -318,7 +318,7 @@ namespace ICSharpCode.Profiler.Controls //this.IsSelectedChanged(this); if (isSelected) { - CallTreeNodeViewModel node = this.Parent; + CallTreeNodeViewModel node = Parent; while (node != null) { node.IsExpanded = true; node = node.Parent; @@ -394,7 +394,7 @@ namespace ICSharpCode.Profiler.Controls public virtual int VisibleElementCount { get { - return this.visibleElementCount; + return visibleElementCount; } } diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/CompareView.xaml.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/CompareView.xaml.cs index 4e9bcd486c..c5346719b5 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/CompareView.xaml.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/CompareView.xaml.cs @@ -2,14 +2,7 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Text; -using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; namespace ICSharpCode.Profiler.Controls { diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/CustomGridView.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/CustomGridView.cs index 2ab0dcd771..c0ba2250b8 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/CustomGridView.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/CustomGridView.cs @@ -3,7 +3,6 @@ using System; using System.ComponentModel; -using System.Diagnostics; using System.Windows; using System.Windows.Controls; using System.Windows.Markup; @@ -41,7 +40,7 @@ namespace ICSharpCode.Profiler.Controls GridViewColumn primaryColumn; - private GridViewColumn PrimaryColumn { + GridViewColumn PrimaryColumn { get { return primaryColumn; } set { if (primaryColumn != value) { @@ -153,7 +152,7 @@ namespace ICSharpCode.Profiler.Controls } } - protected override System.Windows.Media.Visual GetVisualChild(int index) + protected override Visual GetVisualChild(int index) { return uiElements[index]; } diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/ExtendedTimeLineControl.xaml.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/ExtendedTimeLineControl.xaml.cs index 7e51674c80..972dd1a6c6 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/ExtendedTimeLineControl.xaml.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/ExtendedTimeLineControl.xaml.cs @@ -3,18 +3,8 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Text; using System.Linq; -using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using ICSharpCode.Profiler.Controller.Data; @@ -36,26 +26,26 @@ namespace ICSharpCode.Profiler.Controls public ProfilingDataProvider Provider { - get { return this.provider; } + get { return provider; } set { - this.provider = value; + provider = value; - this.perfCounterList.ItemsSource = this.provider.GetPerformanceCounters(); - this.perfCounterList.SelectedIndex = 0; - this.timeLine.Provider = provider; + perfCounterList.ItemsSource = provider.GetPerformanceCounters(); + perfCounterList.SelectedIndex = 0; + timeLine.Provider = provider; Update(); } } public int SelectedStartIndex { - get { return this.timeLine.SelectedStartIndex; } - set { this.timeLine.SelectedStartIndex = value; } + get { return timeLine.SelectedStartIndex; } + set { timeLine.SelectedStartIndex = value; } } public int SelectedEndIndex { - get { return this.timeLine.SelectedEndIndex; } - set { this.timeLine.SelectedEndIndex = value; } + get { return timeLine.SelectedEndIndex; } + set { timeLine.SelectedEndIndex = value; } } public event EventHandler RangeChanged; @@ -68,29 +58,29 @@ namespace ICSharpCode.Profiler.Controls void Update() { - this.timeLine.ValuesList.Clear(); + timeLine.ValuesList.Clear(); - var selectedPerformanceCounter = this.perfCounterList.SelectedItem as PerformanceCounterDescriptor; + var selectedPerformanceCounter = perfCounterList.SelectedItem as PerformanceCounterDescriptor; if (selectedPerformanceCounter == null) return; List segments = new List(); - var values = this.provider.GetPerformanceCounterValues(this.perfCounterList.SelectedIndex); - var markers = this.provider.DataSets.Select(item => item.IsFirst).ToArray(); + var values = provider.GetPerformanceCounterValues(perfCounterList.SelectedIndex); + var markers = provider.DataSets.Select(item => item.IsFirst).ToArray(); - this.timeLine.MaxValue = selectedPerformanceCounter.MaxValue ?? (values.Any() ? values.Max() : 0); + timeLine.MaxValue = selectedPerformanceCounter.MaxValue ?? (values.Any() ? values.Max() : 0); - this.maxLabel.Text = (selectedPerformanceCounter.MaxValue ?? (values.Any() ? values.Max() : 0)).ToString("0"); - this.minLabel.Text = (selectedPerformanceCounter.MinValue ?? (values.Any() ? values.Min() : 0)).ToString("0"); + maxLabel.Text = (selectedPerformanceCounter.MaxValue ?? (values.Any() ? values.Max() : 0)).ToString("0"); + minLabel.Text = (selectedPerformanceCounter.MinValue ?? (values.Any() ? values.Min() : 0)).ToString("0"); - this.unitLabel.Text = this.timeLine.Unit = selectedPerformanceCounter.Unit; - this.timeLine.Format = selectedPerformanceCounter.Format; + unitLabel.Text = timeLine.Unit = selectedPerformanceCounter.Unit; + timeLine.Format = selectedPerformanceCounter.Format; for (int i = 0; i < values.Length; i++) segments.Add(new TimeLineSegment() { Value = values[i], DisplayMarker = markers[i], Events = provider.GetEventDataEntries(i) }); - this.timeLine.ValuesList.AddRange(segments); + timeLine.ValuesList.AddRange(segments); } void PerfCounterListSelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/HSVColor.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/HSVColor.cs index 0fb3029a54..2205ed4af4 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/HSVColor.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/HSVColor.cs @@ -13,14 +13,14 @@ namespace ICSharpCode.Profiler.Controls public float Hue { get { return hue; } - set { this.hue = value; } + set { hue = value; } } float saturation; public float Saturation { get { return saturation; } - set { this.saturation = value; } + set { saturation = value; } } float value; @@ -74,34 +74,34 @@ namespace ICSharpCode.Profiler.Controls public Color ToColor() { - if (!InInterval(this.hue, 0, 360)) + if (!InInterval(hue, 0, 360)) throw new ArgumentException("Hue is not between 0 and 360 degrees!"); - if (!InInterval(this.saturation, 0, 1)) + if (!InInterval(saturation, 0, 1)) throw new ArgumentException("Saturation is not between 0 and 1!"); - if (!InInterval(this.value, 0, 1)) + if (!InInterval(value, 0, 1)) throw new ArgumentException("Value is not between 0 and 1!"); - int hi = (int)Math.Floor(this.hue / 60.0f); - float f = this.hue / 60.0f - hi; + int hi = (int)Math.Floor(hue / 60.0f); + float f = hue / 60.0f - hi; - float p = this.value * (1 - this.saturation); - float q = this.value * (1 - this.saturation * f); - float t = this.value * (1 - this.saturation * (1 - f)); + float p = value * (1 - saturation); + float q = value * (1 - saturation * f); + float t = value * (1 - saturation * (1 - f)); switch (hi) { case 0: - return Color.FromRgb((byte)(this.value * 255.0f), (byte)(t * 255.0f), (byte)(p * 255.0f)); + return Color.FromRgb((byte)(value * 255.0f), (byte)(t * 255.0f), (byte)(p * 255.0f)); case 1: - return Color.FromRgb((byte)(q * 255.0f), (byte)(this.value * 255.0f), (byte)(p * 255.0f)); + return Color.FromRgb((byte)(q * 255.0f), (byte)(value * 255.0f), (byte)(p * 255.0f)); case 2: - return Color.FromRgb((byte)(p * 255.0f), (byte)(this.value * 255.0f), (byte)(t * 255.0f)); + return Color.FromRgb((byte)(p * 255.0f), (byte)(value * 255.0f), (byte)(t * 255.0f)); case 3: - return Color.FromRgb((byte)(p * 255.0f), (byte)(q * 255.0f), (byte)(this.value * 255.0f)); + return Color.FromRgb((byte)(p * 255.0f), (byte)(q * 255.0f), (byte)(value * 255.0f)); case 4: - return Color.FromRgb((byte)(t * 255.0f), (byte)(p * 255.0f), (byte)(this.value * 255.0f)); + return Color.FromRgb((byte)(t * 255.0f), (byte)(p * 255.0f), (byte)(value * 255.0f)); case 5: - return Color.FromRgb((byte)(this.value * 255.0f), (byte)(p * 255.0f), (byte)(q * 255.0f)); + return Color.FromRgb((byte)(value * 255.0f), (byte)(p * 255.0f), (byte)(q * 255.0f)); } return Colors.Black; diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/HierarchyList.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/HierarchyList.cs index 9650f2f9b8..d87d0a3585 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/HierarchyList.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/HierarchyList.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Collections.Specialized; using System.Diagnostics; using System.Linq; diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/PercentBar.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/PercentBar.cs index b674bf39d7..034c0c3301 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/PercentBar.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/PercentBar.cs @@ -2,12 +2,7 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; using System.Windows.Media; namespace ICSharpCode.Profiler.Controls @@ -18,8 +13,8 @@ namespace ICSharpCode.Profiler.Controls { base.OnRender(drawingContext); - if (this.RenderSize.Height > 0 && this.RenderSize.Width > 0) { - drawingContext.DrawRectangle(new LinearGradientBrush(Colors.Red, Colors.Orange, 0), new Pen(Brushes.Black, 1), new Rect(new Point(0, 2), new Size(this.RenderSize.Width * this.Value, this.RenderSize.Height - 4))); + if (RenderSize.Height > 0 && RenderSize.Width > 0) { + drawingContext.DrawRectangle(new LinearGradientBrush(Colors.Red, Colors.Orange, 0), new Pen(Brushes.Black, 1), new Rect(new Point(0, 2), new Size(RenderSize.Width * Value, RenderSize.Height - 4))); } } diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/PiePiece.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/PiePiece.cs index 9519585866..75907f28c3 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/PiePiece.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/PiePiece.cs @@ -2,11 +2,9 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Shapes; -using System.Windows.Media; using System.Windows; +using System.Windows.Media; +using System.Windows.Shapes; namespace ICSharpCode.Profiler.Controls { @@ -99,7 +97,7 @@ namespace ICSharpCode.Profiler.Controls /// /// Draws the pie piece /// - private void DrawGeometry(StreamGeometryContext context) + void DrawGeometry(StreamGeometryContext context) { double centreX = Radius; double centreY = Radius; diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/QueryView.xaml.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/QueryView.xaml.cs index d20d4b744c..3fe42610db 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/QueryView.xaml.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/QueryView.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) -using ICSharpCode.Profiler.Controller.Data; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -11,7 +10,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; -using ICSharpCode.Profiler.Controller; +using ICSharpCode.Profiler.Controller.Data; using ICSharpCode.Profiler.Controller.Queries; namespace ICSharpCode.Profiler.Controls @@ -40,7 +39,7 @@ namespace ICSharpCode.Profiler.Controls get { return isQueryModifiable; } set { isQueryModifiable = value; - this.txtQuery.IsReadOnly = !isQueryModifiable; + txtQuery.IsReadOnly = !isQueryModifiable; } } @@ -59,9 +58,9 @@ namespace ICSharpCode.Profiler.Controls public IEnumerable SelectedItems { get { - if (this.list == null) + if (list == null) return new List().AsEnumerable(); - return from i in this.list where i.IsSelected select i; + return from i in list where i.IsSelected select i; } } @@ -87,9 +86,9 @@ namespace ICSharpCode.Profiler.Controls if (!string.IsNullOrEmpty(txtSearch.Text) && list.Count > 0) { searchTask.Cancel(); string text = txtSearch.Text; - int start = this.RangeStart; - int end = this.RangeEnd; - var provider = this.Provider; + int start = RangeStart; + int end = RangeEnd; + var provider = Provider; AdornerLayer layer = AdornerLayer.GetAdornerLayer(this); OverlayAdorner ad = new OverlayAdorner(this); @@ -199,10 +198,10 @@ namespace ICSharpCode.Profiler.Controls { if (e.NewSize.Width > 0 && e.PreviousSize.Width > 0) { double adjustedNameColumnWidth = nameColumn.Width + e.NewSize.Width - e.PreviousSize.Width; - double matchingNameColumnWidth = e.NewSize.Width - this.callCountColumn.Width - - this.percentColumn.Width - this.timeSpentColumn.Width - - this.timeSpentSelfColumn.Width - this.timeSpentPerCallColumn.Width - - this.timeSpentSelfPerCallColumn.Width - 25; + double matchingNameColumnWidth = e.NewSize.Width - callCountColumn.Width + - percentColumn.Width - timeSpentColumn.Width + - timeSpentSelfColumn.Width - timeSpentPerCallColumn.Width + - timeSpentSelfPerCallColumn.Width - 25; // always keep name column at least 75 pixels wide if (matchingNameColumnWidth < 75) @@ -222,25 +221,25 @@ namespace ICSharpCode.Profiler.Controls public void SetRange(int start, int end) { - if (this.Provider == null) + if (Provider == null) return; - this.RangeStart = start; - this.RangeEnd = end; - this.Invalidate(); - this.InvalidateArrange(); + RangeStart = start; + RangeEnd = end; + Invalidate(); + InvalidateArrange(); } public void Invalidate() { - this.isDirty = true; - if (this.IsVisible) + isDirty = true; + if (IsVisible) ExecuteQuery(); } void ExecuteQuery() { - if (!this.isDirty || this.Provider == null) + if (!isDirty || Provider == null) return; if (Provider.DataSets.Count == 0) @@ -254,7 +253,7 @@ namespace ICSharpCode.Profiler.Controls LoadData(); watch.Stop(); Debug.Print("update finished in {0}ms", watch.ElapsedMilliseconds); - this.isDirty = false; + isDirty = false; } void LoadData() @@ -266,7 +265,7 @@ namespace ICSharpCode.Profiler.Controls layer.Add(ad); int rangeStart = RangeStart; int rangeEnd = RangeEnd; - string query = this.CurrentQuery; + string query = CurrentQuery; ProfilingDataProvider provider = Provider; QueryCompiler compiler = new QueryCompiler(Reporter, query); @@ -308,22 +307,22 @@ namespace ICSharpCode.Profiler.Controls foreach (var item in list) { var currentItem = item; - currentItem.RequestBringIntoView += (sender, e) => this.treeView.ScrollIntoView(e.Node); + currentItem.RequestBringIntoView += (sender, e) => treeView.ScrollIntoView(e.Node); } } } public string CurrentQuery { - get { return this.txtQuery.Text; } + get { return txtQuery.Text; } set { if (IsQueryModifiable) - this.txtQuery.Text = value; + txtQuery.Text = value; } } void txtQueryTextChanged(object sender, TextChangedEventArgs e) { - this.CurrentQuery = this.txtQuery.Text; + CurrentQuery = txtQuery.Text; } void txtQueryKeyDown(object sender, KeyEventArgs e) @@ -335,12 +334,12 @@ namespace ICSharpCode.Profiler.Controls void btnExecuteQueryClick(object sender, RoutedEventArgs e) { OnCurrentQueryChanged(EventArgs.Empty); - this.Invalidate(); + Invalidate(); } void BtnExpandHotPathSubtreeClick(object sender, RoutedEventArgs e) { - foreach (CallTreeNodeViewModel node in this.SelectedItems.ToArray()) { + foreach (CallTreeNodeViewModel node in SelectedItems.ToArray()) { ExpandHotPathItems(node, node); } } @@ -356,8 +355,8 @@ namespace ICSharpCode.Profiler.Controls } public ContextMenu TreeViewContextMenu { - get { return this.treeView.ContextMenu; } - set { this.treeView.ContextMenu = this.ringDiagram.ContextMenu = value; } + get { return treeView.ContextMenu; } + set { treeView.ContextMenu = ringDiagram.ContextMenu = value; } } } } diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/RangeEventArgs.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/RangeEventArgs.cs index c51a968d91..0513d6081b 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/RangeEventArgs.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/RangeEventArgs.cs @@ -2,7 +2,6 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Windows; namespace ICSharpCode.Profiler.Controls { @@ -28,7 +27,7 @@ namespace ICSharpCode.Profiler.Controls public int RangeLength { - get { return Math.Abs(this.endIndex - this.startIndex); } + get { return Math.Abs(endIndex - startIndex); } } } } diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/RingDiagramControl.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/RingDiagramControl.cs index bf11c3cf6a..e8b8b2ef1e 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/RingDiagramControl.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/RingDiagramControl.cs @@ -10,7 +10,6 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; -using System.Windows.Threading; namespace ICSharpCode.Profiler.Controls { @@ -40,7 +39,7 @@ namespace ICSharpCode.Profiler.Controls { base.OnPropertyChanged(e); if (e.Property == SelectedRootProperty) - Update(this.SelectedRoot); + Update(SelectedRoot); } public RingDiagramControl() @@ -54,17 +53,17 @@ namespace ICSharpCode.Profiler.Controls { Debug.WriteLine("RingDiagram.Update: new root = " + item); - this.task.Cancel(); + task.Cancel(); - Debug.WriteLine("hierarchyStack count: " + this.hierarchyStack.Count); + Debug.WriteLine("hierarchyStack count: " + hierarchyStack.Count); - while (this.hierarchyStack.Count > 0 && !hierarchyStack.Peek().IsAncestorOf(item)) { - this.hierarchyStack.Pop(); + while (hierarchyStack.Count > 0 && !hierarchyStack.Peek().IsAncestorOf(item)) { + hierarchyStack.Pop(); } Debug.Assert(hierarchyStack.Count == 0 || hierarchyStack.Peek().IsAncestorOf(item)); - this.Children.Clear(); + Children.Clear(); if (item == null) return; @@ -83,28 +82,28 @@ namespace ICSharpCode.Profiler.Controls ell.MouseLeftButtonDown += (sender, e) => { - if (this.hierarchyStack.Count > 1 && this.hierarchyStack.Peek().Level > 1) { - var oldItem = this.hierarchyStack.Pop(); - this.SelectedRoot = this.hierarchyStack.Peek(); - this.SelectedRoot.IsSelected = true; - this.SelectedRoot.IsExpanded = true; + if (hierarchyStack.Count > 1 && hierarchyStack.Peek().Level > 1) { + var oldItem = hierarchyStack.Pop(); + SelectedRoot = hierarchyStack.Peek(); + SelectedRoot.IsSelected = true; + SelectedRoot.IsExpanded = true; oldItem.IsSelected = false; } }; if (hierarchyStack.Count == 0 || hierarchyStack.Peek() != item) - this.hierarchyStack.Push(item); + hierarchyStack.Push(item); List pieces = new List(); - this.task.Execute( + task.Execute( () => { if (item.CpuCyclesSpent > 0) CreateTree(pieces, item, 0, item.CpuCyclesSpent, 0); }, () => { - this.Children.Add(ell); - this.Children.AddRange(pieces.Select(p => CreatePiePiece(p.Radius, p.WedgeAngle, p.RotationAngle, p.Level, p.Node))); + Children.Add(ell); + Children.AddRange(pieces.Select(p => CreatePiePiece(p.Radius, p.WedgeAngle, p.RotationAngle, p.Level, p.Node))); item.BringIntoView(); }, delegate { } @@ -165,8 +164,8 @@ namespace ICSharpCode.Profiler.Controls delegate(object sender, MouseButtonEventArgs e) { node.IsExpanded = true; node.IsSelected = true; // expand the path to the node so that the treeview can select it - var oldNode = this.SelectedRoot; - this.SelectedRoot = node; + var oldNode = SelectedRoot; + SelectedRoot = node; oldNode.IsSelected = false; } ); diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/SingleTask.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/SingleTask.cs index 996c29c4f2..01c3de28ac 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/SingleTask.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/SingleTask.cs @@ -48,9 +48,9 @@ namespace ICSharpCode.Profiler.Controls { dispatcher.VerifyAccess(); - if (this.currentTask != null) { - this.currentTask.Cancel(); - this.currentTask = null; + if (currentTask != null) { + currentTask.Cancel(); + currentTask = null; } } @@ -59,10 +59,10 @@ namespace ICSharpCode.Profiler.Controls if (backgroundAction == null) throw new ArgumentNullException("backgroundAction"); - this.Cancel(); + Cancel(); Task task = Task.Start(backgroundAction); - this.currentTask = task; + currentTask = task; currentTask.RunWhenComplete( dispatcher, () => { @@ -70,8 +70,8 @@ namespace ICSharpCode.Profiler.Controls // want to raise completionAction if the task // was successfully completed but another task // was started before we received the completion callback. - if (this.currentTask == task) { - this.currentTask = null; + if (currentTask == task) { + currentTask = null; if (completionAction != null) completionAction(); } else { diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/Task.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/Task.cs index cb006ccd02..9dd78b285d 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/Task.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/Task.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Profiler.Controls bool isComplete; Action onCompleteActions; - private Task(Action action) + Task(Action action) { this.action = action; } diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/TimeLineControl.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/TimeLineControl.cs index 0459a5feb6..d2b8ce8f41 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/TimeLineControl.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/TimeLineControl.cs @@ -2,11 +2,10 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Linq; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics; using System.Globalization; +using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; @@ -55,8 +54,8 @@ namespace ICSharpCode.Profiler.Controls get { return selectedEndIndex; } set { selectedEndIndex = value; - this.InvalidateMeasure(); - this.InvalidateVisual(); + InvalidateMeasure(); + InvalidateVisual(); OnRangeChanged(new RangeEventArgs(selectedStartIndex, selectedEndIndex)); } } @@ -66,8 +65,8 @@ namespace ICSharpCode.Profiler.Controls get { return selectedStartIndex; } set { selectedStartIndex = value; - this.InvalidateMeasure(); - this.InvalidateVisual(); + InvalidateMeasure(); + InvalidateVisual(); OnRangeChanged(new RangeEventArgs(selectedStartIndex, selectedEndIndex)); } } @@ -85,9 +84,9 @@ namespace ICSharpCode.Profiler.Controls protected override Size MeasureOverride(Size availableSize) { - this.pieceWidth = 25; + pieceWidth = 25; Size calculatedSize = base.MeasureOverride(availableSize); - return new Size(Math.Max(this.pieceWidth * this.valuesList.Count + 1, calculatedSize.Width), calculatedSize.Height + 10); + return new Size(Math.Max(pieceWidth * valuesList.Count + 1, calculatedSize.Width), calculatedSize.Height + 10); } const int offset = 0; @@ -97,26 +96,26 @@ namespace ICSharpCode.Profiler.Controls { base.OnRender(drawingContext); - if (this.valuesList.Count == 0) + if (valuesList.Count == 0) return; - double oldX = offsetFromTop, oldY = this.RenderSize.Height; + double oldX = offsetFromTop, oldY = RenderSize.Height; StreamGeometry geometry = new StreamGeometry(); using (StreamGeometryContext ctx = geometry.Open()) { - ctx.BeginFigure(new Point(0, this.RenderSize.Height), true, true); + ctx.BeginFigure(new Point(0, RenderSize.Height), true, true); List points = new List(); - double maxHeight = this.RenderSize.Height - offsetFromTop; + double maxHeight = RenderSize.Height - offsetFromTop; - for (int i = 0; i < this.valuesList.Count; i++) + for (int i = 0; i < valuesList.Count; i++) { - double x = this.pieceWidth / 2.0 + this.pieceWidth * i; + double x = pieceWidth / 2.0 + pieceWidth * i; // TODO : support MinValues other than 0 - double y = offsetFromTop + (maxHeight - maxHeight * (this.valuesList[i].Value / this.MaxValue)); + double y = offsetFromTop + (maxHeight - maxHeight * (valuesList[i].Value / MaxValue)); points.Add(new Point(x, y)); @@ -124,7 +123,7 @@ namespace ICSharpCode.Profiler.Controls oldY = y; } - points.Add(new Point(oldX, offsetFromTop + this.RenderSize.Height)); + points.Add(new Point(oldX, offsetFromTop + RenderSize.Height)); ctx.PolyLineTo(points, true, true); } @@ -133,7 +132,7 @@ namespace ICSharpCode.Profiler.Controls Brush b = new LinearGradientBrush(Colors.Red, Colors.Orange, 90); - drawingContext.DrawRectangle(Brushes.White, new Pen(Brushes.White, 1), new Rect(new Point(0, 0), this.RenderSize)); + drawingContext.DrawRectangle(Brushes.White, new Pen(Brushes.White, 1), new Rect(new Point(0, 0), RenderSize)); var p = new Pen(Brushes.DarkRed, 2); @@ -141,10 +140,10 @@ namespace ICSharpCode.Profiler.Controls DateTime time = new DateTime(1,1,1,0,0,0,0); - for (int i = 0; i < this.valuesList.Count; i++) { - if (this.valuesList[i].DisplayMarker) + for (int i = 0; i < valuesList.Count; i++) { + if (valuesList[i].DisplayMarker) drawingContext.DrawLine(p, new Point(pieceWidth * i, offsetFromTop), - new Point(pieceWidth * i, this.RenderSize.Height)); + new Point(pieceWidth * i, RenderSize.Height)); if (i % 3 == 0) { FormattedText textFormat = new FormattedText( @@ -156,7 +155,7 @@ namespace ICSharpCode.Profiler.Controls drawingContext.DrawText(textFormat, new Point(pieceWidth * i, 0)); } - var events = this.valuesList[i].Events; + var events = valuesList[i].Events; if (events != null && events.Length > 0) { foreach (EventDataEntry @event in events) { @@ -178,43 +177,43 @@ namespace ICSharpCode.Profiler.Controls new SolidColorBrush(Color.FromArgb(64, Colors.Blue.R, Colors.Blue.G, Colors.Blue.B)), new Pen(Brushes.Blue, 1), new Rect( - new Point(Math.Min(this.selectedStartIndex, this.selectedEndIndex) * pieceWidth + offset, offsetFromTop), - new Point(Math.Max(this.selectedStartIndex, this.selectedEndIndex) * pieceWidth + offset + pieceWidth, this.RenderSize.Height) + new Point(Math.Min(selectedStartIndex, selectedEndIndex) * pieceWidth + offset, offsetFromTop), + new Point(Math.Max(selectedStartIndex, selectedEndIndex) * pieceWidth + offset + pieceWidth, RenderSize.Height) ) ); } - protected override void OnMouseUp(System.Windows.Input.MouseButtonEventArgs e) + protected override void OnMouseUp(MouseButtonEventArgs e) { bool valid; Point pos = e.GetPosition(this); int index = TransformToIndex(pos, out valid); if (pos.Y >= 40) { - if (index < this.selectedStartIndex) { - this.selectedEndIndex = this.selectedStartIndex; - this.selectedStartIndex = index; + if (index < selectedStartIndex) { + selectedEndIndex = selectedStartIndex; + selectedStartIndex = index; } else - this.selectedEndIndex = index; + selectedEndIndex = index; } - this.InvalidateMeasure(); - this.InvalidateVisual(); - this.ReleaseMouseCapture(); + InvalidateMeasure(); + InvalidateVisual(); + ReleaseMouseCapture(); } - protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e) + protected override void OnMouseDown(MouseButtonEventArgs e) { - this.CaptureMouse(); + CaptureMouse(); Point pos = e.GetPosition(this); bool valid; int index = TransformToIndex(pos, out valid); if (pos.Y >= 40) - this.selectedStartIndex = this.selectedEndIndex = index; + selectedStartIndex = selectedEndIndex = index; - this.InvalidateMeasure(); - this.InvalidateVisual(); + InvalidateMeasure(); + InvalidateVisual(); } ToolTip tooltip; @@ -226,9 +225,9 @@ namespace ICSharpCode.Profiler.Controls int index = TransformToIndex(pos, out valid); if (e.LeftButton == MouseButtonState.Pressed) { - this.selectedEndIndex = index; - this.InvalidateMeasure(); - this.InvalidateVisual(); + selectedEndIndex = index; + InvalidateMeasure(); + InvalidateVisual(); } else if (tooltip == null && valid) { tooltip = new ToolTip(); if (pos.Y < 20) @@ -236,14 +235,14 @@ namespace ICSharpCode.Profiler.Controls else if (pos.Y < 40) tooltip.Content = CreateTooltipForEvents(index); else - tooltip.Content = "Value: " + this.valuesList[index].Value.ToString(this.Format) + " " + this.Unit; + tooltip.Content = "Value: " + valuesList[index].Value.ToString(Format) + " " + Unit; tooltip .IsOpen = tooltip.Content != null; } } object CreateTooltipForEvents(int index) { - EventDataEntry[] events = this.ValuesList[index].Events; + EventDataEntry[] events = ValuesList[index].Events; TextBlock block = events.Any() ? new TextBlock() : null; @@ -281,14 +280,14 @@ namespace ICSharpCode.Profiler.Controls protected override void OnLostMouseCapture(MouseEventArgs e) { base.OnLostMouseCapture(e); - OnRangeChanged(new RangeEventArgs(this.selectedStartIndex, this.selectedEndIndex)); + OnRangeChanged(new RangeEventArgs(selectedStartIndex, selectedEndIndex)); } int TransformToIndex(Point point, out bool valid) { - int value = (int)Math.Floor(point.X / this.pieceWidth); - valid = (0 >= value && value <= this.valuesList.Count - 1); - return Math.Min(Math.Max(0, value), this.valuesList.Count - 1); + int value = (int)Math.Floor(point.X / pieceWidth); + valid = (0 >= value && value <= valuesList.Count - 1); + return Math.Min(Math.Max(0, value), valuesList.Count - 1); } #region MouseHover @@ -339,7 +338,7 @@ namespace ICSharpCode.Profiler.Controls mouseHoverStartPoint = newPosition; mouseHoverLastEventArgs = e; mouseHoverTimer = new DispatcherTimer(SystemParameters.MouseHoverTime, DispatcherPriority.Background, - OnMouseHoverTimerElapsed, this.Dispatcher); + OnMouseHoverTimerElapsed, Dispatcher); mouseHoverTimer.Start(); } @@ -362,9 +361,9 @@ namespace ICSharpCode.Profiler.Controls mouseHoverTimer = null; } - if (this.tooltip != null) { - this.tooltip.IsOpen = false; - this.tooltip = null; + if (tooltip != null) { + tooltip.IsOpen = false; + tooltip = null; } } diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/TreeListView.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/TreeListView.cs index c6bbaf5f30..707cb426e9 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/TreeListView.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/TreeListView.cs @@ -2,19 +2,9 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Windows; +using System.Linq; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Linq; namespace ICSharpCode.Profiler.Controls { @@ -22,12 +12,12 @@ namespace ICSharpCode.Profiler.Controls { protected override void OnKeyDown(KeyEventArgs e) { - if (this.SelectedItem is CallTreeNodeViewModel) { - CallTreeNodeViewModel item = this.SelectedItem as CallTreeNodeViewModel; + if (SelectedItem is CallTreeNodeViewModel) { + CallTreeNodeViewModel item = SelectedItem as CallTreeNodeViewModel; if (e.Key == Key.Right) { if (item.IsExpanded) { if (item.Children.Count > 0) - this.SelectedItem = item.Children.First(); + SelectedItem = item.Children.First(); } else { item.IsExpanded = true; } @@ -36,7 +26,7 @@ namespace ICSharpCode.Profiler.Controls if (item.IsExpanded) { item.IsExpanded = false; } else { - this.SelectedItem = item.Parent; + SelectedItem = item.Parent; } e.Handled = true; } diff --git a/src/AddIns/Analysis/Profiler/Frontend/Controls/WaitBar.cs b/src/AddIns/Analysis/Profiler/Frontend/Controls/WaitBar.cs index 74b20453cb..92d66ac89b 100644 --- a/src/AddIns/Analysis/Profiler/Frontend/Controls/WaitBar.cs +++ b/src/AddIns/Analysis/Profiler/Frontend/Controls/WaitBar.cs @@ -4,7 +4,6 @@ using System; using System.Windows; using System.Windows.Controls; -using System.Windows.Documents; using System.Windows.Media; namespace ICSharpCode.Profiler.Controls diff --git a/src/AddIns/Analysis/Profiler/X64Converter/Program.cs b/src/AddIns/Analysis/Profiler/X64Converter/Program.cs index d8314d2b56..27fbb27c88 100644 --- a/src/AddIns/Analysis/Profiler/X64Converter/Program.cs +++ b/src/AddIns/Analysis/Profiler/X64Converter/Program.cs @@ -91,7 +91,7 @@ namespace X64Converter if (methodDeclaration.Name.EndsWith("32", StringComparison.Ordinal)) methodDeclaration.Name = methodDeclaration.Name.Replace("32", "64"); else { - if (!this.copyAllMembers) + if (!copyAllMembers) methodDeclaration.Remove(); } return base.VisitMethodDeclaration(methodDeclaration); @@ -99,28 +99,28 @@ namespace X64Converter public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration) { - if (!this.copyAllMembers) + if (!copyAllMembers) propertyDeclaration.Remove(); return base.VisitPropertyDeclaration(propertyDeclaration); } public override object VisitFieldDeclaration(FieldDeclaration fieldDeclaration) { - if (!this.copyAllMembers) + if (!copyAllMembers) fieldDeclaration.Remove(); return base.VisitFieldDeclaration(fieldDeclaration); } public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration) { - if (!this.copyAllMembers) + if (!copyAllMembers) constructorDeclaration.Remove(); return base.VisitConstructorDeclaration(constructorDeclaration); } public override object VisitEventDeclaration(EventDeclaration eventDeclaration) { - if (!this.copyAllMembers) + if (!copyAllMembers) eventDeclaration.Remove(); return base.VisitEventDeclaration(eventDeclaration); } @@ -134,7 +134,7 @@ namespace X64Converter public override object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration) { - if (!this.copyAllMembers) + if (!copyAllMembers) destructorDeclaration.Remove(); return base.VisitDestructorDeclaration(destructorDeclaration); } @@ -142,7 +142,7 @@ namespace X64Converter public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration) { if (typeDeclaration.Name.EndsWith("32", StringComparison.Ordinal)) { - this.copyAllMembers = true; + copyAllMembers = true; typeDeclaration.Name = typeDeclaration.Name.Replace("32", "64"); } else { if (!typeDeclaration.Modifiers.HasFlag(Modifiers.Partial)) @@ -150,7 +150,7 @@ namespace X64Converter else typeDeclaration.Attributes.Clear(); - this.copyAllMembers = false; + copyAllMembers = false; } return base.VisitTypeDeclaration(typeDeclaration); } diff --git a/src/AddIns/Analysis/Profiler/X64Converter/Properties/AssemblyInfo.cs b/src/AddIns/Analysis/Profiler/X64Converter/Properties/AssemblyInfo.cs index f950ce2963..e0fb788096 100644 --- a/src/AddIns/Analysis/Profiler/X64Converter/Properties/AssemblyInfo.cs +++ b/src/AddIns/Analysis/Profiler/X64Converter/Properties/AssemblyInfo.cs @@ -2,7 +2,6 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden