简体   繁体   中英

Use of Performance Counters

I have written some code for load testing in C#. The code is suppose to send large no of files to IM client. Now I need to check performance of the code, by monitoring the actual number of files sent or not. Have, Read about using PerformanceCounter class in C#. Is it possible to use this class to calculate/monitor number of files successfully sent using it ? Is the feasible to use . Any suggestions will be valuable .

Thanks in

Performance counters are probably the best way to do it. Your application would publish the counters, then they could be monitored by tools like perfmon or logman .

Generating performance counters is relatively easy, but there is some housekeeping to do:

  • writing counters is repetitive and is best done as code generation. See Using XSLT to generate Performance Counters code for an example.
  • counters are best installed during application deployment.
  • if you plan to monitor counters yourself in an application, the built in .Net counters classes are way too slow and you'd need to use the high performance PDH library instead, see Using the PDH Functions to Consume Counter Data . Unfortunately this does not have a .Net equivalent. But as long as you only need to publish the counters and use the exsting Windows infrastructure to monitor the values, you don't need this.

Yes, that sounds like a good use for a performance counter. You might want two counters: the total number of files sent, and the number of files per second.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM