PrepAway - Latest Free Exam Questions & Answers

What should you do?

You would like to create a custom performance counter for an application that you created recently.
To do this, you decide to create a custom category named ApplicationPerformance and a performance counter named HitNumber.
You need to ensure that this counter is shared across numerous applications.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Use the following code:
PerformanceCounterCategory.Create (“ApplicationPerformance”, “ApplicationPerformanceHelp”,PerformanceCounterCategoryType.MultiInstance, “HitNumber”, “HitNumberHelp”);

B.
Use the following code:
PerformanceCounterCategory.Create (“HitNumber”, “HitNumberHelp”, PerformanceCounterCategoryType.SingleInstance,”ApplicationPerformance” “ApplicationPerformanceHelp”);

C.
Use the following code:
PerformanceCounterCategory.Create (“HitNumber”, “HitNumberHelp”,PerformanceCounterCategoryType.MultiInstance, “ApplicationPerformance” “ApplicationPerformanceHelp”);

D.
Use the following code:
PerformanceCounterCategory.Create (“ApplicationPerformance”, “ApplicationPerformanceHelp”, PerformanceCounterCategoryType.SingleInstance,
“HitNumber”, “HitNumberHelp”);

Explanation:
This code invokes the Create method of the PerformanceCounterCategory class. This method registers a custom category on the local computer. The first two arguments specify the name of the category and category help string, respectively.
The third argument specifies a PerformanceCounterCategoryType enumeration value indicating how many
counters can be in use within the specified category.
The value PerformanceCounterCategoryType.SigleInstance indicates that only a single instance can exist for the entire category.
The last two arguments specify the name of the performance counter and the counter’s help string, respectively.
Incorrect Answers:
A, C: The code fragments that specify the MultiInstance value should not be used because the scenario requires you to share the same counter across multiple applications.
B: This code fragment incorrectly assigns the value HitNumber to the category name and ApplicationPerformance to the counter name.

Leave a Reply