~suranap/+junk/concur.net

« back to all changes in this revision

Viewing changes to Driver/Program.cs

  • Committer: U-Scooby\Pinku Surana
  • Date: 2009-08-27 04:19:00 UTC
  • Revision ID: surana@scooby-20090827041900-lypm1j2cjvyu62nj
Make Node.topLayer a property instead of a field.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
using System.Text;
5
5
using System.Threading;
6
6
using System.Threading.Tasks;
 
7
using System.Diagnostics;
7
8
 
8
9
using Concurrency;
9
10
 
18
19
            ConcurrentSkipList<int> sl = new ConcurrentSkipList<int>();
19
20
            Random r = new Random();
20
21
            List<int> nums = new List<int>(SIZE);
 
22
            Stopwatch watch = new Stopwatch();
21
23
 
22
24
            for (int i = 0; i < SIZE; i++)
23
25
            {
25
27
            }
26
28
 
27
29
            Action a = () => TestList(sl, nums) ;
28
 
 
29
 
            DateTime now = DateTime.Now;
30
 
 
31
 
            Parallel.Invoke(a, a, a, a);
32
 
 
33
 
            //Thread t1 = new Thread(() => TestList(sl, nums));
34
 
            //t1.Name = "Thread 2";
35
 
            //Thread.CurrentThread.Name = "Main Thread";
36
 
            //t1.Start();
37
 
            //a();
38
 
            //t1.Join();
39
 
 
40
 
            double totalMilli = (DateTime.Now - now).TotalMilliseconds ;
 
30
            a();
 
31
            watch.Start();
 
32
 
 
33
            //Parallel.Invoke(a, a, a, a);
 
34
 
 
35
            Thread t1 = new Thread(() => TestList(sl, nums));
 
36
            t1.Name = "Thread 2";
 
37
            Thread.CurrentThread.Name = "Main Thread";
 
38
            t1.Start();
 
39
            TestList(sl, nums);
 
40
            t1.Join();
 
41
 
 
42
            watch.Stop();
41
43
 
42
44
            Console.WriteLine("count: {0}, addRetry: {1}, removeRetry: {2}", sl.count, sl.addRetry, sl.removeRetry);
43
 
            Console.WriteLine("Total time: {0}", totalMilli);
 
45
            Console.WriteLine("Total time: {0}", watch.ElapsedMilliseconds);
44
46
            Console.ReadLine();
45
47
        }
46
48