Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5526 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
7 changed files with 379 additions and 0 deletions
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00 |
||||
# Visual Studio 2010 |
||||
# SharpDevelop 4.0.0.5522 |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StressTest", "StressTest\StressTest.csproj", "{30D10654-A5F5-4AC5-A370-E6DD4D0FAC50}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|x86 = Debug|x86 |
||||
Release|x86 = Release|x86 |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{30D10654-A5F5-4AC5-A370-E6DD4D0FAC50}.Debug|x86.Build.0 = Debug|x86 |
||||
{30D10654-A5F5-4AC5-A370-E6DD4D0FAC50}.Debug|x86.ActiveCfg = Debug|x86 |
||||
{30D10654-A5F5-4AC5-A370-E6DD4D0FAC50}.Release|x86.Build.0 = Release|x86 |
||||
{30D10654-A5F5-4AC5-A370-E6DD4D0FAC50}.Release|x86.ActiveCfg = Release|x86 |
||||
EndGlobalSection |
||||
EndGlobal |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
#region Using directives
|
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
#endregion
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("StressTest")] |
||||
[assembly: AssemblyDescription("")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyCompany("")] |
||||
[assembly: AssemblyProduct("StressTest")] |
||||
[assembly: AssemblyCopyright("Copyright 2010")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)] |
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all the values or you can use the default the Revision and
|
||||
// Build Numbers by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.*")] |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
<AddIn name = "StressTest" |
||||
author = "Daniel Grunwald" |
||||
url = "" |
||||
description = "TODO: Put description here"> |
||||
|
||||
<Runtime> |
||||
<Import assembly = "StressTest.dll"/> |
||||
</Runtime> |
||||
|
||||
<Path name="/Workspace/Tools"> |
||||
<MenuItem id="StressTest" |
||||
label="Stress Test" |
||||
class="StressTest.StressTestMenuCommand"/> |
||||
</Path> |
||||
|
||||
<Path name="/Workspace/AutostartNothingLoaded"> |
||||
<Class id="StressTest" |
||||
class="StressTest.StressTestMenuCommand"/> |
||||
</Path> |
||||
</AddIn> |
@ -0,0 +1,105 @@
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{30D10654-A5F5-4AC5-A370-E6DD4D0FAC50}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>StressTest</RootNamespace> |
||||
<AssemblyName>StressTest</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' "> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>bin\Debug\</OutputPath> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<StartAction>Program</StartAction> |
||||
<StartProgram>..\..\..\..\bin\SharpDevelop.exe</StartProgram> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="ICSharpCode.AvalonEdit"> |
||||
<HintPath>..\..\..\..\bin\ICSharpCode.AvalonEdit.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.Core"> |
||||
<HintPath>..\..\..\..\bin\ICSharpCode.Core.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.SharpDevelop"> |
||||
<HintPath>..\..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.SharpDevelop.Dom"> |
||||
<HintPath>..\..\..\..\bin\ICSharpCode.SharpDevelop.Dom.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="PresentationCore"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Data.DataSetExtensions"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xaml"> |
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="WindowsBase"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="StressTest.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="StressTestMenuCommand.cs" /> |
||||
<Compile Include="UserControl.xaml.cs"> |
||||
<DependentUpon>UserControl.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="UserControl.xaml" /> |
||||
</ItemGroup> |
||||
<PropertyGroup> |
||||
<StartArguments>/addindir:"$(MsBuildProjectDirectory)\$(OutputPath)"</StartArguments> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
</Project> |
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
// <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 ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace StressTest |
||||
{ |
||||
public sealed class StressTestMenuCommand : AbstractMenuCommand |
||||
{ |
||||
public override void Run() |
||||
{ |
||||
StressTestViewContent vc = WorkbenchSingleton.Workbench.ViewContentCollection.OfType<StressTestViewContent>().FirstOrDefault(); |
||||
if (vc != null) |
||||
vc.WorkbenchWindow.SelectWindow(); |
||||
else |
||||
WorkbenchSingleton.Workbench.ShowView(new StressTestViewContent()); |
||||
} |
||||
} |
||||
|
||||
sealed class StressTestViewContent : AbstractViewContent |
||||
{ |
||||
UserControl ctl = new UserControl(); |
||||
|
||||
public override object Control { |
||||
get { return ctl; } |
||||
} |
||||
|
||||
public StressTestViewContent() |
||||
{ |
||||
this.TitleName = "Stress Test"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<UserControl |
||||
x:Class="StressTest.UserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<ScrollViewer> |
||||
<StackPanel> |
||||
<StackPanel Orientation="Horizontal"><Label>Repetitions:</Label><TextBox Name="repetitionsTextBox" Text="1" Width="40"/></StackPanel> |
||||
<Button |
||||
Content="Open File" |
||||
Height="23" |
||||
Click="openFileButton_Click" /> |
||||
<Button |
||||
Content="Type Comment in C# File" |
||||
Height="23" |
||||
Click="TypeTextButton_Click" /> |
||||
<Button |
||||
Content="Erasing Text in C# code" |
||||
Height="23" |
||||
Click="EraseTextButton_Click" /> |
||||
<Button |
||||
Content="Typing C# code" |
||||
Height="23" |
||||
Click="TypeCodeButton_Click" /> |
||||
</StackPanel> |
||||
</ScrollViewer> |
||||
</UserControl> |
@ -0,0 +1,140 @@
@@ -0,0 +1,140 @@
|
||||
// <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 System.Diagnostics; |
||||
using System.IO; |
||||
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 System.Windows.Threading; |
||||
|
||||
using ICSharpCode.AvalonEdit.Editing; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace StressTest |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for UserControl.xaml
|
||||
/// </summary>
|
||||
public partial class UserControl : System.Windows.Controls.UserControl |
||||
{ |
||||
public UserControl() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
void Run(string name, IEnumerable<DispatcherPriority> process) |
||||
{ |
||||
var e = process.GetEnumerator(); |
||||
Stopwatch w = Stopwatch.StartNew(); |
||||
Action cont = null; |
||||
cont = delegate { |
||||
if (e.MoveNext()) { |
||||
Dispatcher.BeginInvoke(e.Current, cont); |
||||
} else { |
||||
e.Dispose(); |
||||
w.Stop(); |
||||
TaskService.BuildMessageViewCategory.AppendLine(name + " (" + Repetitions + "x): " + w.Elapsed.ToString()); |
||||
} |
||||
}; |
||||
cont(); |
||||
} |
||||
|
||||
int Repetitions { |
||||
get { return int.Parse(repetitionsTextBox.Text); } |
||||
} |
||||
|
||||
void openFileButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
Run("Open File", OpenFile()); |
||||
} |
||||
|
||||
string bigFile = Path.Combine(FileUtility.ApplicationRootPath, @"src\Libraries\NRefactory\Project\Src\Ast\Generated.cs"); |
||||
|
||||
IEnumerable<DispatcherPriority> OpenFile() |
||||
{ |
||||
for (int i = 0; i < Repetitions; i++) { |
||||
IViewContent newContent = FileService.OpenFile(bigFile); |
||||
yield return DispatcherPriority.SystemIdle; |
||||
newContent.WorkbenchWindow.CloseWindow(true); |
||||
yield return DispatcherPriority.SystemIdle; |
||||
} |
||||
} |
||||
|
||||
void TypeTextButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
Run("Type Comment In C# file", TypeText()); |
||||
} |
||||
|
||||
IEnumerable<DispatcherPriority> TypeText() |
||||
{ |
||||
IViewContent vc = FileService.NewFile("stresstest.cs", ""); |
||||
ITextEditor editor = ((ITextEditorProvider)vc).TextEditor; |
||||
TextArea textArea = (TextArea)editor.GetService(typeof(TextArea)); |
||||
yield return DispatcherPriority.SystemIdle; |
||||
for (int i = 0; i < Repetitions; i++) { |
||||
foreach (char c in "// This is a comment\n") { |
||||
textArea.PerformTextInput(c.ToString()); |
||||
yield return DispatcherPriority.SystemIdle; |
||||
} |
||||
} |
||||
vc.WorkbenchWindow.CloseWindow(true); |
||||
} |
||||
|
||||
void EraseTextButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
Run("Erase Text In C# file", EraseText()); |
||||
} |
||||
|
||||
IEnumerable<DispatcherPriority> EraseText() |
||||
{ |
||||
IViewContent vc = FileService.NewFile("stresstest.cs", ""); |
||||
ITextEditor editor = ((ITextEditorProvider)vc).TextEditor; |
||||
TextArea textArea = (TextArea)editor.GetService(typeof(TextArea)); |
||||
editor.Document.Text = File.ReadAllText(bigFile); |
||||
editor.Caret.Offset = 0; |
||||
yield return DispatcherPriority.SystemIdle; |
||||
for (int i = 0; i < Repetitions; i++) { |
||||
EditingCommands.Delete.Execute(null, textArea); |
||||
yield return DispatcherPriority.SystemIdle; |
||||
} |
||||
vc.WorkbenchWindow.CloseWindow(true); |
||||
} |
||||
|
||||
void TypeCodeButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
Run("Type Code In C# file", TypeCode()); |
||||
} |
||||
|
||||
IEnumerable<DispatcherPriority> TypeCode() |
||||
{ |
||||
IViewContent vc = FileService.NewFile("stresstest.cs", ""); |
||||
ITextEditor editor = ((ITextEditorProvider)vc).TextEditor; |
||||
TextArea textArea = (TextArea)editor.GetService(typeof(TextArea)); |
||||
string inputText = string.Join("\n", File.ReadAllLines(bigFile).Where(l => !string.IsNullOrWhiteSpace(l) && !l.StartsWith("//", StringComparison.Ordinal))); |
||||
yield return DispatcherPriority.SystemIdle; |
||||
for (int i = 0; i < Math.Min(inputText.Length, Repetitions); i++) { |
||||
textArea.PerformTextInput(inputText[i].ToString()); |
||||
yield return DispatcherPriority.SystemIdle; |
||||
while (!textArea.StackedInputHandlers.IsEmpty) |
||||
textArea.PopStackedInputHandler(textArea.StackedInputHandlers.Peek()); |
||||
yield return DispatcherPriority.SystemIdle; |
||||
} |
||||
vc.WorkbenchWindow.CloseWindow(true); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue