Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1.  List<Thread> threadsArray = new List<Thread>();
  2.  
  3.                 // Deklaracja czasow
  4.                 for (int i = 10; i <= 10000; i *= 10)
  5.                 {
  6.                     DateTime start = DateTime.Now;
  7.                     for (int j = 0; j < 10 * i; j++)
  8.                     {
  9.                         threadsArray.Add(new Thread(DoNothing));
  10.                         threadsArray[j].Start();
  11.                     }
  12.                     DateTime stop = DateTime.Now;
  13.                     TimeSpan time = stop - start;
  14.                     Console.WriteLine("Czas uruchomienia {0} wątkow: {1} ", i, time.ToString().Substring(4) + "s");
  15.                     for (int j = 0; j < 10 * i; j++)
  16.                     {
  17.                         threadsArray.Clear();
  18.                     }
  19.                 }
  20.            
  21.             Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement