diff options
author | Sean Gillespie <segilles@microsoft.com> | 2016-03-11 15:48:56 -0800 |
---|---|---|
committer | Sean Gillespie <segilles@microsoft.com> | 2016-04-11 11:47:48 -0700 |
commit | 57246c0812e94e0ad98cb313d2d97ba1a458afb8 (patch) | |
tree | 260e5bf0a11da114357fb35e5941c53e70cb326b /tests/src/GC/Coverage | |
parent | 2eb214ee49e3474ec64aad04ac673f7f18379c95 (diff) | |
download | coreclr-57246c0812e94e0ad98cb313d2d97ba1a458afb8.tar.gz coreclr-57246c0812e94e0ad98cb313d2d97ba1a458afb8.tar.bz2 coreclr-57246c0812e94e0ad98cb313d2d97ba1a458afb8.zip |
Create Long-running GC test job for the CI
Diffstat (limited to 'tests/src/GC/Coverage')
-rw-r--r-- | tests/src/GC/Coverage/concurrentspin2.cs | 184 | ||||
-rw-r--r-- | tests/src/GC/Coverage/concurrentspin2.csproj | 45 |
2 files changed, 0 insertions, 229 deletions
diff --git a/tests/src/GC/Coverage/concurrentspin2.cs b/tests/src/GC/Coverage/concurrentspin2.cs deleted file mode 100644 index 23edb8bb34..0000000000 --- a/tests/src/GC/Coverage/concurrentspin2.cs +++ /dev/null @@ -1,184 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Diagnostics; -using System.Threading; - -class PriorityTest -{ - private byte[][] old; - private byte[][] med; - private Random rand; - - private int oldDataSize; - private int medDataSize; - private int iterCount; - private int meanAllocSize; - private int medTime; - private int youngTime; - - - public PriorityTest(int oldDataSize, int medDataSize, - int iterCount, int meanAllocSize, - int medTime, int youngTime) - { - rand = new Random(314159); - this.oldDataSize = oldDataSize; - this.medDataSize = medDataSize; - this.iterCount = iterCount; - this.meanAllocSize = meanAllocSize; - this.medTime = medTime; - this.youngTime = youngTime; - } - - // creates initial arrays - void AllocTest(int oldDataSize, int medDataSize, int meanAllocSize) - { - old = new byte[oldDataSize][]; - med = new byte[medDataSize][]; - - for (int i = 0; i < old.Length; i++) - { - old[i] = new byte[meanAllocSize]; - } - - for (int i = 0; i < med.Length; i++) - { - med[i] = new byte[meanAllocSize]; - } - } - - // churns data in the heap by replacing byte arrays with new ones of random length - // this should induce concurrent GCs - void SteadyState(int oldDataSize, int medDataSize, - int iterCount, int meanAllocSize, - int medTime, int youngTime) - { - - for (int i = 0; i < iterCount; i++) - { - byte[] newarray = new byte[meanAllocSize]; - - if ((i % medTime) == 0) - { - old[rand.Next(0, old.Length)] = newarray; - } - if ((i % youngTime) == 0) - { - med[rand.Next(0, med.Length)] = newarray; - } - //if (((i % 5000) == 0) && (Thread.CurrentThread.Priority != ThreadPriority.Lowest)) - //{ - // Thread.Sleep(200); - //} - } - } - - // method that runs the test - public void RunTest() - { - for (int iteration = 0; iteration < iterCount; iteration++) - { - AllocTest(oldDataSize, medDataSize, meanAllocSize); - - SteadyState(oldDataSize, medDataSize, - iterCount, meanAllocSize, - medTime, youngTime); - - if (((iteration + 1) % 20) == 0) - Console.WriteLine("Thread: {1} Finished iteration {0}", iteration, System.Threading.Thread.CurrentThread.Name); - } - - } - -} - - -class ConcurrentRepro -{ - - public static void Usage() - { - Console.WriteLine("Usage:"); - Console.WriteLine("\t<num iterations> <num threads>"); - } - - public static int[] ParseArgs(string[] args) - { - int[] parameters = new int[2]; - - // set defaults - parameters[0] = 100; - parameters[1] = 4; - - if (args.Length == 0) - { - //use defaults - Console.WriteLine("Using defaults: 100 iterations, 4 threads"); - return parameters; - } - if (args.Length == parameters.Length) - { - for (int i = 0; i < args.Length; i++) - { - int j = 0; - if (!int.TryParse(args[i], out j)) - { - Usage(); - return null; - } - parameters[i] = j; - } - - return parameters; - } - - // incorrect number of arguments - Usage(); - return null; - } - - - public static int Main(string[] args) - { - - // parse arguments - int[] parameters = ParseArgs(args); - if (parameters == null) - { - return 0; - } - - // set process affinity to 1 to repro bug easier - //Process.GetCurrentProcess().ProcessorAffinity = (IntPtr)1; - - - PriorityTest priorityTest = new PriorityTest(1000000, 5000, parameters[0], 17, 30, 3); - ThreadStart startDelegate = new ThreadStart(priorityTest.RunTest); - - // create threads - Thread[] threads = new Thread[parameters[1]]; - for (int i = 0; i < threads.Length; i++) - { - threads[i] = new Thread(startDelegate); - threads[i].Name = String.Format("Thread{0}", i); - //if (i % 2 == 0) - //{ - // threads[i].Priority = ThreadPriority.Lowest; - //} - threads[i].Start(); - } - - // wait for threads to complete - for (int i = 0; i < threads.Length; i++) - { - threads[i].Join(); - } - - return 100; - } -} - - diff --git a/tests/src/GC/Coverage/concurrentspin2.csproj b/tests/src/GC/Coverage/concurrentspin2.csproj deleted file mode 100644 index 7e63affeba..0000000000 --- a/tests/src/GC/Coverage/concurrentspin2.csproj +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <OutputType>Exe</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <FileAlignment>512</FileAlignment> - <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> - <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - </PropertyGroup> - <ItemGroup> - <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> - <Visible>False</Visible> - </CodeAnalysisDependentAssemblyPaths> - </ItemGroup> - <ItemGroup> - <!-- Add Compile Object Here --> - <Compile Include="ConcurrentSpin2.cs" /> - </ItemGroup> - <ItemGroup> - <None Include="app.config" /> - <None Include="$(GCPackagesConfigFileDirectory)minimal\project.json" /> - </ItemGroup> - <PropertyGroup> - <ProjectJson>$(GCPackagesConfigFileDirectory)minimal\project.json</ProjectJson> - <ProjectLockJson>$(GCPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> - </PropertyGroup> - <ItemGroup> - <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> - </ItemGroup> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> - <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> - </PropertyGroup> -</Project>
\ No newline at end of file |