Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Performance Counters - Batch Processing

Status
Not open for further replies.

MartinFister

Programmer
May 20, 2007
2
US
Hi,
I've been experimenting a lot lately with the PerformanceCounter class created by Microsoft and am having a lot of trouble optimizing the speed of the operations. I've read all of the MSDN documents on the subject but unfortunately, they don't really go into details on the subject.

What I'm trying to do is to look at a server and measure the % processor time used by each of the threads. However, because there are over 100 threads being run on the server, querying each of them to obtain a sample takes over 1 minute. When I'm trying to get % processor time in 10 second intervals, this sort of latency is not acceptable.

In essence, can I get a batch process where it will contact the server once, obtain all of these values, and then return them together? Does anyone know a good way of doing this?

Thanks for your help!
 
1. Eliminate the network & permissions latency by running a test project on the server that your monitoring. You should see a significant speedup. If you do, you can bundle the performance info up into a datastructure of your own choice and send it as a batch (rather than 200+ network round-trips, you're down to 2).

2. 100 threads? You know that the NT family of operating systems (Windows 2000, Windows XP, Windows Server 2003, Windows Vista) schedules at the thread level, not the process level? This means that if you have a dual-cpu, dual-core system, the most you could ever run simultaneously is 4, leaving 96 of them queued up for the CPU or awaiting I/O.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Good idea,
I'd never thought about creating a sister service that would run the performance tests on the native machine, I'll have to check up if I am allowed to do that.

Also, with respect to the threads, I know what you mean and as such, after most intervals, only a few threads have actually received processor time. Unfortunately, I don't really know of (or can imagine there being) a way in which I can identify what threads within the concerned process have had run time without actually checking all of the threads (Note, I'm only concerned with threads within a single process and thus, am not looking at every thread on the system).

Thanks for your suggestions!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top