Which three actions should you perform in sequence?

DRAG DROP
You are developing an application by using C#. The application will process several objects per
second.
You need to create a performance counter to analyze the object processing.
Which three actions should you perform in sequence? (To answer, move the appropriate actions
from the list of actions to the answer area and arrange them in the correct order.)

DRAG DROP
You are developing an application by using C#. The application will process several objects per
second.
You need to create a performance counter to analyze the object processing.
Which three actions should you perform in sequence? (To answer, move the appropriate actions
from the list of actions to the answer area and arrange them in the correct order.)

Answer: See the explanation

Explanation:
Box 1: Create a CounterCreationDataCollection collection. Then create the counters as
CounterCreationData object and set necessary properties.
Box 2: Add ConterCreationData to the collection by calling the Add() method of the collection
Box 3: Call the Create method of the PerformanceCounterCategory and pass the collection to the
method

CounterCreationDataCollection counterDataCollection = new CounterCreationDataCollection(); //
Box1
// Add the counter. Box 1
CounterCreationData averageCount64 = new CounterCreationData();
averageCount64.CounterType = PerformanceCounterType.AverageCount64;
averageCount64.CounterName = “AverageCounter64Sample”;
counterDataCollection.Add(averageCount64);
// Add the base counter.
CounterCreationData averageCount64Base = new CounterCreationData();
averageCount64Base.CounterType = PerformanceCounterType.AverageBase;
averageCount64Base.CounterName = “AverageCounter64SampleBase”;
counterDataCollection.Add(averageCount64Base); // Box 2
// Create the category. Box 3
PerformanceCounterCategory.Create(“AverageCounter64SampleCategory”,
“Demonstrates usage of the AverageCounter64 performance counter type.”,
PerformanceCounterCategoryType.SingleInstance, counterDataCollection);



Leave a Reply 1

Your email address will not be published. Required fields are marked *