Re: need help w/ multi-threaded, multi-CPU tick count / stopwatch
- From: "Brian Gideon" <briangideon@xxxxxxxxx>
- Date: 14 Feb 2007 12:31:03 -0800
On Feb 14, 1:44 pm, "not_a_commie" <notacom...@xxxxxxxxx> wrote:
So I have a motherboard with multiple CPU sockets. It seems that if I
create a StopWatch on one thread and then call the Elapsed member from
a different thread that sometimes I get a tick count that's a million
miles away.
My thinking is that I can subclass the StopWatch. Then when the
Elapsed member is called, I can invoke it on the thread that the
StopWatch class was created on. True? How?
Or is there an easy way that I could scan through all processors and
read their tick counts? That way I could just have my own timer class
that stores counts for all CPUs.
Can the BeginThreadAffinity help me somehow? I'm totally at a loss as
to what that function does for me.
Is there some other solution?
I'm using .NET 2.0.
Thanks.
Hi,
The StopWatch class isn't inherently thread-safe. Are you
synchronizing access to it appropriately. Can you post some code
demonstrating the problem?
Brian
.
- Follow-Ups:
- Re: need help w/ multi-threaded, multi-CPU tick count / stopwatch
- From: not_a_commie
- Re: need help w/ multi-threaded, multi-CPU tick count / stopwatch
- References:
- need help w/ multi-threaded, multi-CPU tick count / stopwatch
- From: not_a_commie
- need help w/ multi-threaded, multi-CPU tick count / stopwatch
- Prev by Date: Re: Sort and BinarySearch on custom class?
- Next by Date: Re: need help w/ multi-threaded, multi-CPU tick count / stopwatch
- Previous by thread: need help w/ multi-threaded, multi-CPU tick count / stopwatch
- Next by thread: Re: need help w/ multi-threaded, multi-CPU tick count / stopwatch
- Index(es):
Relevant Pages
|