473,800 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a performance counter with an instance name

I use the following two lines of code to create a performance counter with an
instance name.

PerformanceCoun terCategory.Cre ate(m_CategoryN ame, "",
PerformanceCoun terCategoryType .MultiInstance, m_CounterName, "");

PerformanceCoun ter counter = new PerformanceCoun ter(m_CategoryN ame,
m_CounterName, "test", false);

But I get this exception:
"Category 'cat' is marked as single-instance. Performance counters in this
category can only be created without instance names."

Any idea?

Thanks.

Kai
Apr 1 '08 #1
0 3083

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1565
by: william | last post by:
Hi, I'm playing windows service using vb.net. I added a performance counter to my windows service, but I couldn't set MachineName property of the performance counter to blank. After I set it to empty, whenever the focus leave it, pop up error message. In Chapter 2 lesson 3 of Developing XML Web Services and Server Components with Microsoft Visual Basic.NET and Microsoft VIsual C#.net book, there is a note saying "By default the designer also...
0
440
by: Val Mazur (MVP) | last post by:
Hi guys, My application creates custom performance counter and it works fine. Now I am creating multiple instances of the same counter and increment value for each instance. This part work fine as well. But if I open Performance Monitor it does not show any instances of the counter and, of course, no information available for the counter. Am I missing something? Val
3
3790
by: Dirk Reske | last post by:
Hello, I have following code:
1
336
by: Jim Heavey | last post by:
I am messing around with performance counters to try to learn how to work with them. In VS.Net, I can see that there exist a Performance Counter with a "CategoryName" of "Browser". My application allows the user to key in the "CategoryName" and then if it is found, builds a ListView with each of the counter's name found within the specified CategoryName keyed.
0
1754
by: Christopher Attard | last post by:
Hi, I want to make use of the Performance Counter "Connections active" which falls under the "TCP" Performance object. I'm using the following code (in C#) to get the performance counter: PerformanceCounter perfCounter = new PerformanceCounter("TCP","Connections Active");
0
1537
by: jimiz | last post by:
I have a question on how the performance counter instance returns values. I have an app that uses the performance counter for Category name = "Web Service" Counter name = "Current Connections" Instance name = "_Total" That works great / however when I use the following counter it returns some incorrect data. Category Name = "Web Service"
1
2571
by: socal | last post by:
I've added the performance counter object to my app... Within the class there's the PerformanceCounter.CategoryName property that allows you to set what category you want to monitor. For instance, CategoryName = "Processor". At design time, you get a drop down list of available categories. Does anyone know how to get the list of available categories at runtime? http://msdn.microsoft.com/library/default.asp?url=/library/en-...
37
3314
by: Steven Bethard | last post by:
The PEP below should be mostly self explanatory. I'll try to keep the most updated versions available at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt http://ucsu.colorado.edu/~bethard/py/pep_create_statement.html PEP: XXX Title: The create statement
1
2457
by: jvn | last post by:
I am experiencing a particular problem with performance counters. I have created a set of classes, that uses System.Diagnostics.PerformanceCounter to increment custom performance counters (using .Net 2.0) The performance counter categories have been successfully created. When the set of classes are used by a WinForm test harness application, they function as expected, and the performance counters can be seen to be updated by using the...
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.