Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5019 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
16 changed files with 330 additions and 34 deletions
@ -1,13 +0,0 @@
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0"?> |
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTarget="Build"> |
||||
<PropertyGroup> |
||||
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);MyPostBuildTarget</PrepareForRunDependsOn> |
||||
</PropertyGroup> |
||||
<Target Name="MyPostBuildTarget"> |
||||
<Copy SourceFiles="..\Hook\Win32\$(Configuration)\Hook.dll" DestinationFiles="$(OutputPath)\Hook32.dll" Condition="Exists('..\Hook\Win32\$(Configuration)\Hook.dll')" SkipUnchangedFiles="false" /> |
||||
<Copy SourceFiles="..\Hook\Win32\$(Configuration)\Hook.pdb" DestinationFiles="$(OutputPath)\Hook32.pdb" Condition="Exists('..\Hook\Win32\$(Configuration)\Hook.pdb')" SkipUnchangedFiles="false" /> |
||||
|
||||
<Copy SourceFiles="..\Hook\x64\$(Configuration)\Hook.dll" DestinationFiles="$(OutputPath)\Hook64.dll" Condition="Exists('..\Hook\x64\$(Configuration)\Hook.dll')" SkipUnchangedFiles="false" /> |
||||
<Copy SourceFiles="..\Hook\x64\$(Configuration)\Hook.pdb" DestinationFiles="$(OutputPath)\Hook64.pdb" Condition="Exists('..\Hook\x64\$(Configuration)\Hook.pdb')" SkipUnchangedFiles="false" /> |
||||
</Target> |
||||
</Project> |
||||
@ -0,0 +1,142 @@
@@ -0,0 +1,142 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Profiler.Controller.Data; |
||||
|
||||
namespace Profiler.Tests.Controller.Data |
||||
{ |
||||
/// <summary>
|
||||
/// Stub CallTreeNode for unit tests.
|
||||
/// </summary>
|
||||
public class CallTreeNodeStub : CallTreeNode |
||||
{ |
||||
public override int GetHashCode() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public override bool Equals(CallTreeNode other) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public override System.Linq.IQueryable<CallTreeNode> Callers { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public override CallTreeNode Merge(System.Collections.Generic.IEnumerable<CallTreeNode> nodes) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
List<CallTreeNodeStub> children = new List<CallTreeNodeStub>(); |
||||
CallTreeNode parent; |
||||
|
||||
public override System.Linq.IQueryable<CallTreeNode> Children { |
||||
get { |
||||
return children.AsQueryable(); |
||||
} |
||||
} |
||||
|
||||
public sealed class ChildrenCollection : IEnumerable<CallTreeNodeStub> |
||||
{ |
||||
CallTreeNodeStub parent; |
||||
|
||||
public ChildrenCollection(CallTreeNodeStub parent) |
||||
{ |
||||
this.parent = parent; |
||||
} |
||||
|
||||
public void Add(CallTreeNodeStub node) |
||||
{ |
||||
parent.AddChild(node); |
||||
} |
||||
|
||||
public IEnumerator<CallTreeNodeStub> GetEnumerator() |
||||
{ |
||||
return parent.children.GetEnumerator(); |
||||
} |
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() |
||||
{ |
||||
return GetEnumerator(); |
||||
} |
||||
} |
||||
|
||||
public ChildrenCollection AddChildren { |
||||
get { return new ChildrenCollection(this); } |
||||
} |
||||
|
||||
public void AddChild(CallTreeNodeStub node) |
||||
{ |
||||
node.parent = this; |
||||
children.Add(node); |
||||
} |
||||
|
||||
public override CallTreeNode Parent { |
||||
get { |
||||
return parent; |
||||
} |
||||
} |
||||
|
||||
public override double TimeSpent { |
||||
get { |
||||
return CpuCyclesSpent; |
||||
} |
||||
} |
||||
|
||||
public override double TimeSpentSelf { |
||||
get { |
||||
return CpuCyclesSpentSelf; |
||||
} |
||||
} |
||||
|
||||
public long CpuCyclesSpentValue; |
||||
|
||||
public override long CpuCyclesSpent { |
||||
get { |
||||
return CpuCyclesSpentValue; |
||||
} |
||||
} |
||||
|
||||
public bool IsActiveAtStartValue; |
||||
|
||||
public override bool IsActiveAtStart { |
||||
get { |
||||
return IsActiveAtStartValue; |
||||
} |
||||
} |
||||
|
||||
public int RawCallCountValue; |
||||
|
||||
public override int RawCallCount { |
||||
get { |
||||
return RawCallCountValue; |
||||
} |
||||
} |
||||
|
||||
public NameMapping NameMappingValue; |
||||
|
||||
public override NameMapping NameMapping { |
||||
get { |
||||
return NameMappingValue; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public class DataSetStub : IProfilingDataSet |
||||
{ |
||||
public double CpuUsage { get; set; } |
||||
public bool IsFirst { get; set; } |
||||
public CallTreeNode RootNode { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Profiler.Controller.Data; |
||||
using ICSharpCode.Profiler.Controller.Data.Linq; |
||||
using NUnit.Framework; |
||||
|
||||
namespace Profiler.Tests.Controller.Data |
||||
{ |
||||
[TestFixture] |
||||
public class LinqTests |
||||
{ |
||||
const int k = 1000; |
||||
ProfilingDataSQLiteProvider provider; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void FixtureSetUp() |
||||
{ |
||||
if (File.Exists("temp.sdps")) |
||||
File.Delete("temp.sdps"); |
||||
NameMapping method1 = new NameMapping(1, "r1", "m1", new List<string>()); |
||||
NameMapping method2 = new NameMapping(2, "r2", "m2", new List<string>()); |
||||
NameMapping method3 = new NameMapping(3, "r3", "m3", new List<string>()); |
||||
using (var writer = new ProfilingDataSQLiteWriter("temp.sdps", false, null)) { |
||||
writer.ProcessorFrequency = 2000; // MHz
|
||||
writer.WriteMappings(new[] { method1, method2, method3 } ); |
||||
CallTreeNodeStub dataSet; |
||||
dataSet = new CallTreeNodeStub { |
||||
NameMappingValue = method1, |
||||
AddChildren = { |
||||
new CallTreeNodeStub { |
||||
NameMappingValue = method2, |
||||
RawCallCountValue = 10, |
||||
CpuCyclesSpentValue = 500 * k |
||||
} |
||||
} |
||||
}; |
||||
writer.WriteDataSet(new DataSetStub { CpuUsage = 0.3, IsFirst = true, RootNode = dataSet }); |
||||
dataSet = new CallTreeNodeStub { |
||||
NameMappingValue = method1, |
||||
IsActiveAtStartValue = true, |
||||
AddChildren = { |
||||
new CallTreeNodeStub { |
||||
NameMappingValue = method2, |
||||
RawCallCountValue = 0, |
||||
IsActiveAtStartValue = true, |
||||
CpuCyclesSpentValue = 200 * k |
||||
}, |
||||
new CallTreeNodeStub { |
||||
NameMappingValue = method3, |
||||
RawCallCountValue = 1, |
||||
IsActiveAtStartValue = true, |
||||
CpuCyclesSpentValue = 300 * k |
||||
} |
||||
} |
||||
}; |
||||
writer.WriteDataSet(new DataSetStub { CpuUsage = 0.4, IsFirst = false, RootNode = dataSet }); |
||||
} |
||||
provider = new ProfilingDataSQLiteProvider("test.sdps"); |
||||
} |
||||
|
||||
[TestFixtureTearDown] |
||||
public void FixtureCleanUp() |
||||
{ |
||||
provider.Dispose(); |
||||
File.Delete("temp.sdps"); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestMethod() |
||||
{ |
||||
// TODO: Add your test.
|
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue