From 1771eb5595000708f7f1416b51b798528ec1a0c0 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 31 Oct 2009 10:21:13 +0000 Subject: [PATCH] - Added missing XML Doc. - Cleaned up file structure. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5199 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Controller/Data/EventDataEntry.cs | 63 +++++++++++++++ .../Controller/Data/IProfilingDataWriter.cs | 6 ++ .../Data/PerformanceCounterDescriptor.cs | 76 +++++++++++++++---- .../Controller/Data/ProfilingDataProvider.cs | 9 +++ .../Data/ProfilingDataSQLiteProvider.cs | 3 + .../Controller/Data/TempFileDatabase.cs | 6 ++ .../Controller/Data/UnitTestWriter.cs | 3 + .../Controller/Profiler.Controller.csproj | 1 + .../Profiler/Controller/ProfilerOptions.cs | 6 ++ 9 files changed, 157 insertions(+), 16 deletions(-) create mode 100644 src/AddIns/Misc/Profiler/Controller/Data/EventDataEntry.cs diff --git a/src/AddIns/Misc/Profiler/Controller/Data/EventDataEntry.cs b/src/AddIns/Misc/Profiler/Controller/Data/EventDataEntry.cs new file mode 100644 index 0000000000..0257020603 --- /dev/null +++ b/src/AddIns/Misc/Profiler/Controller/Data/EventDataEntry.cs @@ -0,0 +1,63 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; + +namespace ICSharpCode.Profiler.Controller.Data +{ + /// + /// Represents an entry in the list of events collected by the profiler. + /// + public class EventDataEntry + { + /// + /// The id of the dataset this entry belongs to. + /// + public int DataSetId { get; set; } + + /// + /// The type of this event entry. + /// + public EventType Type { get; set; } + + /// + /// The id of NameMapping of this event entry. + /// + public int NameId { get; set; } + + /// + /// Additional data collected by the profiler. + /// + public string Data { get; set; } + } + + /// + /// Defines kinds of events that can be handled by the profiler. + /// + public enum EventType : int + { + /// + /// Recorded event was an exception thrown by the profilee. + /// + Exception = 0, + /// + /// Recorded event was a call to a Console.Write*/Read* method. + /// + Console = 1, + /// + /// Recorded event was fired by Windows Forms controls. + /// + WindowsForms = 2, + /// + /// Recorded event was fired by Windows Presentation Foundation controls. + /// + WindowsPresentationFoundation = 3 + } +} diff --git a/src/AddIns/Misc/Profiler/Controller/Data/IProfilingDataWriter.cs b/src/AddIns/Misc/Profiler/Controller/Data/IProfilingDataWriter.cs index 14f214327c..be87d6a89a 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/IProfilingDataWriter.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/IProfilingDataWriter.cs @@ -29,8 +29,14 @@ namespace ICSharpCode.Profiler.Controller.Data /// void WriteMappings(IEnumerable mappings); + /// + /// Writes an amount of performance counters and the collected values. + /// void WritePerformanceCounterData(IEnumerable counters); + /// + /// Writes an amount of events. + /// void WriteEventData(IEnumerable events); /// diff --git a/src/AddIns/Misc/Profiler/Controller/Data/PerformanceCounterDescriptor.cs b/src/AddIns/Misc/Profiler/Controller/Data/PerformanceCounterDescriptor.cs index 2c06e9e267..4456e81568 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/PerformanceCounterDescriptor.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/PerformanceCounterDescriptor.cs @@ -12,22 +12,65 @@ using System.Linq; namespace ICSharpCode.Profiler.Controller.Data { + /// + /// Wraps to support lazy-loading and easy value collection. + /// Stores additonal meta data such as min/max allowed value or unit of the values. + /// public class PerformanceCounterDescriptor { + /// + /// Gets the category of the performance counter. + /// public string Category { get; private set; } + + /// + /// Gets the name of the performance counter. + /// public string Name { get; private set; } + + /// + /// Gets the instance (perfmon process id) of the performance counter. + /// public string Instance { get; private set; } + + /// + /// Gets the computer the performance counter is executed on. + /// public string Computer { get; private set; } + + /// + /// Gets a list of values collected by this performance counter. + /// public IList Values { get; private set; } + /// + /// Gets the minimum allowed value collected by the performance counter. + /// Returns null if there is no lower bound. + /// public float? MinValue { get; private set; } + + /// + /// Gets the maximum allowed value collected by the performance counter. + /// Returns null if there is no upper bound. + /// public float? MaxValue { get; private set; } + + /// + /// Gets a string representation of the unit of the values collected. + /// public string Unit { get; private set; } + + /// + /// Gets the format string for display of the collected values. + /// public string Format { get; private set; } float defaultValue; PerformanceCounter counter; + /// + /// Creates a new PerformanceCounterDescriptor. + /// public PerformanceCounterDescriptor(string category, string name, string instance, string computer, float defaultValue, float? minValue, float? maxValue, string unit, string format) { @@ -43,11 +86,18 @@ namespace ICSharpCode.Profiler.Controller.Data Format = format; } + /// + /// Creates a new PerformanceCounterDescriptor. + /// public PerformanceCounterDescriptor(string name, float? minValue, float? maxValue, string unit, string format) : this(null, name, null, null, 0, minValue, maxValue, unit, format) { } + /// + /// Returns the perfmon process identifier for a process Id. + /// If the process is not available (e. g. not running anymore) null is returned. + /// public static string GetProcessInstanceName(int pid) { PerformanceCounterCategory cat = new PerformanceCounterCategory("Process"); @@ -64,11 +114,18 @@ namespace ICSharpCode.Profiler.Controller.Data return null; } + /// + /// Deletes all collected information. + /// public void Reset() { this.Values.Clear(); } + /// + /// Collects a new value. The default value is recorded if any error occurs, while attempting to collect a value. + /// + /// public void Collect(string instanceName) { if (counter == null && Instance != null) @@ -84,25 +141,12 @@ namespace ICSharpCode.Profiler.Controller.Data } } + /// + /// Returns the name of the performance counter. + /// public override string ToString() { return Name; } } - - public enum EventType : int - { - Exception = 0, - Console = 1, - WindowsForms = 2, - WindowsPresentationFoundation = 3 - } - - public class EventDataEntry - { - public int DataSetId { get; set; } - public EventType Type { get; set; } - public int NameId { get; set; } - public string Data { get; set; } - } } diff --git a/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataProvider.cs b/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataProvider.cs index 5e5e9b093b..e9f02c637b 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataProvider.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataProvider.cs @@ -77,10 +77,19 @@ namespace ICSharpCode.Profiler.Controller.Data return GetAllCalls(startIndex, endIndex).Where(c => !c.IsThread).MergeByName(); } + /// + /// Returns the list of performance counters used in all datasets. + /// public abstract PerformanceCounterDescriptor[] GetPerformanceCounters(); + /// + /// Returns the list of all values collected by a performance counter identified by its index. + /// public abstract float[] GetPerformanceCounterValues(int index); + /// + /// Returns the list of all events for a dataset. + /// public abstract EventDataEntry[] GetEventDataEntries(int index); } } diff --git a/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs b/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs index c81604ff34..9f983d60d6 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs @@ -352,6 +352,7 @@ namespace ICSharpCode.Profiler.Controller.Data return query.Where(c => c.NameMapping.Id != 0 && !c.IsThread).MergeByName(); } + /// public override PerformanceCounterDescriptor[] GetPerformanceCounters() { SQLiteCommand cmd; @@ -380,6 +381,7 @@ namespace ICSharpCode.Profiler.Controller.Data } } + /// public override float[] GetPerformanceCounterValues(int index) { SQLiteCommand cmd; @@ -400,6 +402,7 @@ namespace ICSharpCode.Profiler.Controller.Data } } + /// public override EventDataEntry[] GetEventDataEntries(int index) { SQLiteCommand cmd; diff --git a/src/AddIns/Misc/Profiler/Controller/Data/TempFileDatabase.cs b/src/AddIns/Misc/Profiler/Controller/Data/TempFileDatabase.cs index a8bfbea6cc..e7ea2c57ec 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/TempFileDatabase.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/TempFileDatabase.cs @@ -39,12 +39,18 @@ namespace ICSharpCode.Profiler.Controller.Data List counters = new List(); + /// + /// Returns the list of performance counters stored in the database. + /// public ReadOnlyCollection Counters { get { return counters.AsReadOnly(); } } List events = new List(); + /// + /// Returns the list of events stored in the database. + /// public ReadOnlyCollection Events { get { return events.AsReadOnly(); } } diff --git a/src/AddIns/Misc/Profiler/Controller/Data/UnitTestWriter.cs b/src/AddIns/Misc/Profiler/Controller/Data/UnitTestWriter.cs index 79e2da7363..763afae02e 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/UnitTestWriter.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/UnitTestWriter.cs @@ -105,16 +105,19 @@ namespace ICSharpCode.Profiler.Controller.Data this.targetWriter.Close(); } + /// public void WritePerformanceCounterData(IEnumerable counters) { this.targetWriter.WritePerformanceCounterData(counters); } + /// public void WriteEventData(IEnumerable events) { this.targetWriter.WriteEventData(events); } + /// public int DataSetCount { get { return this.targetWriter.DataSetCount; } } diff --git a/src/AddIns/Misc/Profiler/Controller/Profiler.Controller.csproj b/src/AddIns/Misc/Profiler/Controller/Profiler.Controller.csproj index 58537988a6..485d79ebe5 100644 --- a/src/AddIns/Misc/Profiler/Controller/Profiler.Controller.csproj +++ b/src/AddIns/Misc/Profiler/Controller/Profiler.Controller.csproj @@ -94,6 +94,7 @@ + diff --git a/src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs b/src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs index 73c3389878..a221f0cfce 100644 --- a/src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs +++ b/src/AddIns/Misc/Profiler/Controller/ProfilerOptions.cs @@ -24,6 +24,9 @@ namespace ICSharpCode.Profiler.Controller /// public const int DefaultSharedMemorySize = 64 * 1024 * 1024; // 64 mb + /// + /// Defines a list of default performance counters. + /// public static readonly PerformanceCounterDescriptor[] DefaultCounters = new[] { new PerformanceCounterDescriptor("Process", "% Processor Time", "_Total", ".", 0, 0, 100, "%", "0.00"), new PerformanceCounterDescriptor("Process", "IO Data Bytes/sec", "_Total", ".", 0, null, null, "bytes/sec", "#,##0") @@ -37,6 +40,9 @@ namespace ICSharpCode.Profiler.Controller PerformanceCounterDescriptor[] counters; + /// + /// Gets the performance counters selected for monitoring. + /// public PerformanceCounterDescriptor[] Counters { get { return this.counters; } }