Browse Source

DocumentUtilitites.GetWordAt: fixed ArgumentOutOfRangeException.

Minor improvements to profiler.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5044 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
bd3055466f
  1. 4
      src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs
  2. 15
      src/AddIns/Misc/Profiler/Controller/Data/UnitTestWriter.cs
  3. 2
      src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs
  4. 2
      src/AddIns/Misc/Profiler/Controller/Queries/QueryBase.cs
  5. 2
      src/Main/Base/Project/Src/Editor/DocumentUtilitites.cs

4
src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs

@ -335,7 +335,7 @@ namespace ICSharpCode.Profiler.Controller.Data @@ -335,7 +335,7 @@ namespace ICSharpCode.Profiler.Controller.Data
}
/// <inheritdoc/>
public override IQueryable<CallTreeNode> GetAllCalls(int startIndex, int endIndex)
public override IQueryable<CallTreeNode> GetFunctions(int startIndex, int endIndex)
{
if (startIndex < 0 || startIndex >= this.DataSets.Count)
throw new ArgumentOutOfRangeException("startIndex", startIndex, "Value must be between 0 and " + endIndex);
@ -345,7 +345,7 @@ namespace ICSharpCode.Profiler.Controller.Data @@ -345,7 +345,7 @@ namespace ICSharpCode.Profiler.Controller.Data
SQLiteQueryProvider queryProvider = new SQLiteQueryProvider(this, startIndex, endIndex);
var query = queryProvider.CreateQuery(new Filter(AllCalls.Instance, DataSetFilter(startIndex, endIndex)));
return query.Where(c => c.NameMapping.Id != 0);
return query.Where(c => c.NameMapping.Id != 0 && !c.IsThread).MergeByName();
}
Expression<Func<SingleCall, bool>> DataSetFilter(int startIndex, int endIndex)

15
src/AddIns/Misc/Profiler/Controller/Data/UnitTestWriter.cs

@ -12,13 +12,18 @@ using System.Collections.Generic; @@ -12,13 +12,18 @@ using System.Collections.Generic;
namespace ICSharpCode.Profiler.Controller.Data
{
/// <summary>
/// Description of UnitTestWriter.
/// Filters the data being written to remove NUnit internals and show the unit tests more clearly.
/// </summary>
public class UnitTestWriter : IProfilingDataWriter
{
IProfilingDataWriter targetWriter;
string[] unitTestNames;
HashSet<string> unitTestNames;
/// <summary>
/// Creates a new UnitTestWriter instance.
/// </summary>
/// <param name="targetWriter">The target IProfilingDataWriter where the output should be written to.</param>
/// <param name="unitTestNames">The fully qualified names of the unit test methods.</param>
public UnitTestWriter(IProfilingDataWriter targetWriter, string[] unitTestNames)
{
if (targetWriter == null)
@ -28,7 +33,7 @@ namespace ICSharpCode.Profiler.Controller.Data @@ -28,7 +33,7 @@ namespace ICSharpCode.Profiler.Controller.Data
throw new ArgumentNullException("unitTestNames");
this.targetWriter = targetWriter;
this.unitTestNames = unitTestNames;
this.unitTestNames = new HashSet<string>(unitTestNames);
}
sealed class UnitTestDataSet : IProfilingDataSet
@ -47,11 +52,13 @@ namespace ICSharpCode.Profiler.Controller.Data @@ -47,11 +52,13 @@ namespace ICSharpCode.Profiler.Controller.Data
public CallTreeNode RootNode { get; private set; }
}
/// <inheritdoc/>
public int ProcessorFrequency {
get { return this.targetWriter.ProcessorFrequency; }
set { this.targetWriter.ProcessorFrequency = value; }
}
/// <inheritdoc/>
public void WriteDataSet(IProfilingDataSet dataSet)
{
if (dataSet == null)
@ -85,11 +92,13 @@ namespace ICSharpCode.Profiler.Controller.Data @@ -85,11 +92,13 @@ namespace ICSharpCode.Profiler.Controller.Data
}
}
/// <inheritdoc/>
public void WriteMappings(System.Collections.Generic.IEnumerable<NameMapping> mappings)
{
this.targetWriter.WriteMappings(mappings);
}
/// <inheritdoc/>
public void Close()
{
this.targetWriter.Close();

2
src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs

@ -45,7 +45,7 @@ namespace ICSharpCode.Profiler.Controller.Data @@ -45,7 +45,7 @@ namespace ICSharpCode.Profiler.Controller.Data
children.Sort((a,b) => a.Index.CompareTo(b.Index));
return children.Cast<CallTreeNode>().AsQueryable(); // TODO : remove Cast<> in .NET 4.0
return children.AsQueryable();
}
}

2
src/AddIns/Misc/Profiler/Controller/Queries/QueryBase.cs

@ -40,7 +40,7 @@ namespace ICSharpCode.Profiler.Controller.Queries @@ -40,7 +40,7 @@ namespace ICSharpCode.Profiler.Controller.Queries
/// <summary>
/// Returns all calls.
/// </summary>
public IQueryable<CallTreeNode> Calls { get { return Root.Descendants; } }
public IQueryable<CallTreeNode> Calls { get { return Provider.GetAllCalls(StartDataSetIndex, EndDataSetIndex); } }
/// <summary>
/// Returns all functions.

2
src/Main/Base/Project/Src/Editor/DocumentUtilitites.cs

@ -101,7 +101,7 @@ namespace ICSharpCode.SharpDevelop.Editor @@ -101,7 +101,7 @@ namespace ICSharpCode.SharpDevelop.Editor
/// </summary>
public static string GetWordAt(this ITextBuffer document, int offset)
{
if (offset < 0 || offset > document.TextLength || !IsWordPart(document.GetCharAt(offset))) {
if (offset < 0 || offset >= document.TextLength || !IsWordPart(document.GetCharAt(offset))) {
return String.Empty;
}
int startOffset = offset;

Loading…
Cancel
Save