static void Main() { DateTime time1 = DateTime.Now; s_channel = new Channel<int>(); MicroThread t2 = new MicroThread(run2); t2.Start(); MicroThread t3 = new MicroThread(run2); t3.Start(); MicroThread t1 = new MicroThread(run1); t1.Start(); Console.WriteLine("Starting producer/consumer test, loops {0}", s_loops); Scheduler.Run(); DateTime time2 = DateTime.Now; Console.WriteLine("total {0}", res); Console.WriteLine("time {0}ms", (time2 - time1).TotalMilliseconds); Console.WriteLine("END"); }
static void Main() { MicroThread t = new MicroThread(MainRun); t.Start(); Scheduler.Run(); }
static void Main(string[] args) { if (args.Length == 0 || args[0] == "server") { MicroThread pt = new MicroThread(ServerPrintRun); pt.Start(); Server.s_bufferSize = s_blockSize; MicroThread t = new MicroThread(Server.ListenRun); t.Start(); Scheduler.Run(); } else { Console.WriteLine("Starting {0} threads, sending {1} {2} byte blocks", s_threads, s_blocks, s_blockSize); MicroThread pt = new MicroThread(ClientPrintRun); pt.Start(); for (int i = 0; i < s_threads; i++) { Client c = new Client(s_blocks, s_blockSize); MicroThread t = new MicroThread(c.Run); t.Start(); } DateTime t1 = DateTime.Now; Scheduler.Run(); DateTime t2 = DateTime.Now; Console.WriteLine(); Console.WriteLine("TOTAL {0} MB/s", (Client.s_totalBlocksSent / 1000.0 / 1000.0 * s_blockSize) / ((TimeSpan)(t2 - t1)).TotalSeconds); } }
//static long s_totalYields = 0; static int Main(string[] args) { if(args.Length != 2) { Console.WriteLine("usage: YieldTest <numthreads> <numloops>"); return 1; } s_threads = Int32.Parse(args[0]); s_loops = Int32.Parse(args[1]); for (int i = 0; i < s_threads; i++) { MicroThread t = new MicroThread(Run); t.Start(); } DateTime t1 = DateTime.Now; Scheduler.Run(); DateTime t2 = DateTime.Now; TimeSpan ts = t2 - t1; //Console.WriteLine("Total yields {0}", s_totalYields); Console.WriteLine("{0} threads * {1} loops = {2} yields in {3:F2}s, {4:F0} yields/s", s_threads, s_loops, s_threads * s_loops, ts.TotalSeconds, (s_threads * s_loops)/ts.TotalSeconds); /* long mem = System.GC.GetTotalMemory(false); Console.WriteLine("Mem {0:F2}M", mem / 1000000.0); */ return 0; }
static void Main() { MicroThread t1 = new MicroThread(Run1); MicroThread t2 = new MicroThread(Run2); t1.Start(); t2.Start(); Scheduler.Run(); }
static void MainRun() { int started = 0; while (true) { if (Scheduler.ThreadCount < 100) { MicroThread t = new MicroThread(Work); t.Start(); started++; } Console.WriteLine("Threads {0}, started {1}", Scheduler.ThreadCount, started); Scheduler.Yield(); } }
static void Main() { DateTime time1 = DateTime.Now; MicroThread t = new MicroThread(loop); t.Start(); Console.WriteLine("Starting yield test, loops {0}", s_loops); Scheduler.Run(); DateTime time2 = DateTime.Now; Console.WriteLine("END {0}", res); TimeSpan ts = time2 - time1; Console.WriteLine("time {0}ms", ts.TotalMilliseconds); }
static int Main(string[] args) { if(args.Length != 1) { Console.WriteLine("usage: SleepTest <numthreads>"); return 1; } s_threads = Int32.Parse(args[0]); for (int i = 0; i < s_threads; i++) { Sleeper s = new Sleeper(); MicroThread t = new MicroThread(s.Run); t.Start(); } Scheduler.Run(); return 0; }
public static void ListenRun() { MicroSocket listenSocket = new MicroSocket(); IPEndPoint ep = new IPEndPoint(IPAddress.Any, 12345); listenSocket.Bind(ep); listenSocket.Listen(10); while (true) { MicroSocket socket = listenSocket.Accept(); //Console.WriteLine("Accepted a new socket"); //Console.Write("."); s_connectedSockets++; Server server = new Server(socket); MicroThread t = new MicroThread(server.SocketRun); t.Start(); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MyForm f = new MyForm(); f.Show(); new MicroThread(WindowRun).Start(); for (int i = 0; i < 200; i++) { Dot d = new Dot(i, 0, Color.Red, f); MicroThread t = new MicroThread(d.Run); t.Start(); } Scheduler.Run(); // Application.Run(f); }