-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
32 lines (28 loc) · 852 Bytes
/
Copy pathProgram.cs
File metadata and controls
32 lines (28 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using SampleAnalysis;
using System.Diagnostics;
string collectionType = args.Length > 1 ? args[1] : DataCollectionFactory.ArrayListCollectionName;
IDataCollection<int> data = DataCollectionFactory.Create<int>(collectionType);
Console.WriteLine($"Starting stress test with {collectionType}...{args[0]}");
long count = 0;
Stopwatch sw = Stopwatch.StartNew();
try
{
while (true)
{
data.Add(10);
count++;
if (count % 1000 == 0)
{
Console.WriteLine($"Added {count} items to collection so far...");
}
}
}
catch (Exception ex)
{
sw.Stop();
Console.WriteLine();
Console.WriteLine($"Program crashed. Successfully added {count} items before crash in {sw.ElapsedMilliseconds}ms");
Console.WriteLine();
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}