K
Kovan Akrei
Hi,
The code shown below is going to be a part of some tests I'm doing. I'm
trying to check how many threads are created and started (threads does not
do anything and exits soon after creation) i a certain amount of time, i ex.
30 seconds.
I'm trying to optimize it as much as possible. I wonder if there is another
way to check systemtime insted of DateTime, beacause I think Datetime slows
down the tests. I'm only interested in those possiblities csharp and .net
presents.
class ThreadOverhead
{
static void Main(string[] args)
{
DateTime startTime;
long maxThread = 0;
TimeSpan endTime = new TimeSpan(0,0,30);
startTime = DateTime.Now;
while(((DateTime.Now)-startTime) < endTime)
{
new DummyThread().thread.Start();
++maxThread ;
}
}
}
The code shown below is going to be a part of some tests I'm doing. I'm
trying to check how many threads are created and started (threads does not
do anything and exits soon after creation) i a certain amount of time, i ex.
30 seconds.
I'm trying to optimize it as much as possible. I wonder if there is another
way to check systemtime insted of DateTime, beacause I think Datetime slows
down the tests. I'm only interested in those possiblities csharp and .net
presents.
class ThreadOverhead
{
static void Main(string[] args)
{
DateTime startTime;
long maxThread = 0;
TimeSpan endTime = new TimeSpan(0,0,30);
startTime = DateTime.Now;
while(((DateTime.Now)-startTime) < endTime)
{
new DummyThread().thread.Start();
++maxThread ;
}
}
}