linux-packaging-mono/mono/tests/gc-copy-stress.cs
Jo Shields 181b81b4a4 Imported Upstream version 3.12.0
Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
2015-01-13 10:44:36 +00:00

36 lines
685 B
C#

using System;
class T {
static int count = 1000000;
static int loops = 20;
static int persist_factor = 10;
static object obj;
static object[] persist;
static int persist_idx;
static void work () {
persist = new object[count / persist_factor + 1];
persist_idx = 0;
for (int i = 0; i < count; ++i) {
obj = new object ();
if (i % persist_factor == 0)
persist[persist_idx++] = obj;
}
}
static void Main (string[] args) {
if (args.Length > 0)
loops = int.Parse (args [0]);
if (args.Length > 1)
count = int.Parse (args [1]);
if (args.Length > 2)
persist_factor = int.Parse (args [2]);
for (int i = 0; i < loops; ++i) {
work ();
}
}
}