したがって、初期データは、ピーク時に1秒あたり20の単純なクエリ(1分あたり1200リクエスト)です。 「サーバー」のテスト:Celeron、3GHz、1GB(70%無料)。
シングルスレッドシステム
最初に、シングルスレッドクエリ実行の基本クラスを作成します。
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
using System; using System.Diagnostics; using System.Threading; namespace TestConsoleApplication { class mockClass { private readonly Int32 incriment_speed; private Int32 inc; public mockClass( int incriment_speed) { this .incriment_speed = incriment_speed; inc = 0; } public Int32 incriment() { Thread.Sleep(incriment_speed); return inc++; } public Int32 getIncriment() { return inc; } } class TestConsoleApplication { static void Main( string [] args) { if (args.Length<1) return ; Int32 mockSpeed = 0; if (! Int32 .TryParse(args[0], out mockSpeed)) return ; var mock = new mockClass(mockSpeed); int beginTick = Environment.TickCount; for ( int j = 0; j < 1200; j++) { mock.incriment(); } int endTick = Environment.TickCount; var performance = new PerformanceCounter( "Process" , "Private Bytes" , Process.GetCurrentProcess().ProcessName); Console .WriteLine(mock.getIncriment()); Console .WriteLine( "tick: {0}" , endTick - beginTick); Console .WriteLine( "memory: {0:N0}K" , (performance.RawValue/1024)); Console .ReadLine(); } } } * This source code was highlighted with Source Code Highlighter .
クエリ実行の遅延のいくつかのパラメーターでプログラムを実行します:2、5、10
2 | 5 | 10 | |||
ダニ | 記憶 | ダニ | 記憶 | ダニ | 記憶 |
3688 | 10 792K | 7281 | 10 780K | 13125 | 10 792K |
ご覧のとおり、メモリは実質的に影響を受けず、時間は(mockSpeed + 1)* 1200にほぼ等しくなります。 オーバーヘッドのために余分なミリ秒を相殺します。
マルチスレッドシステム
マルチスレッドで動作するようにプログラムを書き直し、最適化して結果を比較します。
*このソースコードは、 ソースコードハイライターで強調表示されました。
- システムを使用して ;
- System.Diagnostics を使用します。
- System.Threading を使用します。
- 名前空間 TestConsoleApplication
- {
- クラス mockClass
- {
- プライベート 読み取り専用 Int32 incriment_speed;
- private Int32 inc;
- パブリック mockClass( int incriment_speed)
- {
- this .incriment_speed = incriment_speed;
- inc = 0;
- }
- パブリック Int32犯罪()
- {
- Thread.Sleep(incriment_speed);
- return inc ++;
- }
- パブリック Int32 getIncriment()
- {
- return inc;
- }
- }
- クラス TestConsoleApplication
- {
- private static mockClass mock = null ;
- 静的 void threadmethod()
- {
- ロック (モック)
- {
- mock.incriment();
- }
- }
- static void Main( string [] args)
- {
- if (args.Length <1) return ;
- Int32 mockSpeed = 0;
- if (! Int32 .TryParse(args [0]、 out mockSpeed)) return ;
- mock = new mockClass(mockSpeed);
- var performance = new PerformanceCounter( "Process" 、 "Private Bytes" 、Process.GetCurrentProcess()。ProcessName);
- long performance_RawValue = 0;
- int beginTick = Environment.TickCount;
- ロック (モック)
- {
- for ( int j = 0; j <1200; j ++)
- {
- var trd = 新しいスレッド(threadmethod、65536); //スタックに1ページを割り当てます
- trd.Start();
- }
- performance_RawValue = performance.RawValue;
- }
- int end1Tick = Environment.TickCount;
- while (mock.getIncriment()<1200)
- {
- Thread.Sleep(2);
- }
- int end2Tick = Environment.TickCount;
- Console .WriteLine( "starttick:{0}" 、end1Tick-beginTick);
- Console .WriteLine( "alltick:{0}" 、end2Tick-beginTick);
- Console .WriteLine( "memory:{0:N0} K" 、(performance_RawValue / 1024));
- Console .ReadLine();
- }
- }
- }
- | 2 | 5 | 10 | ||||||
- | 開始ティック | すべてのダニ | 記憶 | 開始ティック | すべてのダニ | 記憶 | 開始ティック | すべてのダニ | 記憶 |
シングルスレッド | - | 3688 | 10 792K | - | 7281 | 10 780K | - | 13125 | 10 792K |
マルチスレッド | 656 | 4234 | 323 508K | 625 | 7719 | 323 508K | 750 | 13735 | 323 508K |
マルチスレッドのパフォーマンスをテストすると、プロセスの起動時間に新しい値が現れました。 この値によって、プログラムの全体的な期間が増加します。 プロセスのおおよその開始は0.5ミリ秒です。 また、使用済みメモリの量が大幅に増加しており、起動されたスレッドのスタックに費やされています。
まとめ
テーブル内のすべての比較値を選択します。
- | シングルスレッド | マルチスレッド |
総時間 | メインスレッドの合計時間は、すべてのリクエストの実行時間に依存します | メインスレッドの稼働時間は、リクエストの数に依存します |
合計プロセッサー時間 | 低寄生負荷 | スプリアス負荷が2倍高い |
記憶 | 要求の数に関係なく、メモリ不足の要求 | スレッドスタックごとに少なくとも256KBのメモリが要求ごとに消費されます |
ここに、そのような質問の研究で出てきた「学生実験室作業」があります。 石を投げないでください:)