<p>
        Performance counter is used to monitor the running status of an application. The application itself just output the performance data. The data itself don't need to be calcuated by the application, the data is used by external application, like performance MMC. Here discussed how to output performance data only. To output performance data takes several steps.
        </p>

        <ol>
        <li>
        <div>First setup the register performance counter, and its belong category. For example:</div>

        <pre data-sub="prettyprint:_">
        CounterCreationDataCollection counterCreationDataCollection = new CounterCreationDataCollection();

        // Add the counter.
        CounterCreationData averageCount64 = new CounterCreationData();
        averageCount64.CounterType = PerformanceCounterType.AverageCount64;
        averageCount64.CounterName = "AverageCounter64Sample";
        counterCreationDataCollection.Add(averageCount64);

        // Add the base counter.
        CounterCreationData averageCount64Base = new CounterCreationData();
        averageCount64Base.CounterType = PerformanceCounterType.AverageBase;
        averageCount64Base.CounterName = "AverageCounter64SampleBase";
        counterCreationDataCollection.Add(averageCount64Base);

        // Create the category.
        PerformanceCounterCategory.Create("AverageCounter64SampleCategory",
        "Demonstrates usage of the AverageCounter64 performance counter type.",
        PerformanceCounterCategoryType.SingleInstance, counterCreationDataCollection);

        </pre>

        <p>
        When instrumenting applications (creating and writing custom performance counters), you might be working with performance counter types that rely on an accompanying base counter that is used in the calculations. The base counter must be immediately after its associated counter in the CounterCreationDataCollection collection your application uses. Please note the base counter is not visible to the performance MMC.
        </p>
        <table>
        <tbody>
        <tr>
        <th>
        <p>
        Base counter type
        </p>
        </th>
        <th>
        <p>
        Performance counter types
        </p>
        </th>
        </tr>
        <tr>
        <td>
        <p>
        <span class="keyword">AverageBase</span></p>
        </td>
        <td>
        <p>
        <span class="keyword">AverageTimer32</span></p>
        <p>
        <span class="keyword">AverageCount64</span></p>
        </td>
        </tr>
        <tr>
        <td>
        <p>
        <span class="keyword">CounterMultiBase</span></p>
        </td>
        <td>
        <p>
        <span class="keyword">CounterMultiTimer</span></p>
        <p>
        <span class="keyword">CounterMultiTimerInverse</span></p>
        <p>
        <span class="keyword">CounterMultiTimer100Ns</span></p>
        <p>
        <span class="keyword">CounterMultiTimer100NsInverse</span></p>
        </td>
        </tr>
        <tr>
        <td>
        <p>
        <span class="keyword">RawBase</span></p>
        </td>
        <td>
        <p>
        <span class="keyword">RawFraction</span></p>
        </td>
        </tr>
        <tr>
        <td>
        <p>
        <span class="keyword">SampleBase</span></p>
        </td>
        <td>
        <p>
        <span class="keyword">SampleFraction</span></p>
        </td>
        </tr>
        </tbody>
        </table>
        </li>

        <li>
        <div>Then you need to get a reference of the performance counter</div>

        <pre data-sub="prettyprint:_">
        CounterCreationDataCollection counterCreationDataCollection = new CounterCreationDataCollection();

        // Add the counter.
        CounterCreationData averageCount64 = new CounterCreationData();
        averageCount64.CounterType = PerformanceCounterType.AverageCount64;
        averageCount64.CounterName = "AverageCounter64Sample";
        counterCreationDataCollection.Add(averageCount64);

        // Add the base counter.
        CounterCreationData averageCount64Base = new CounterCreationData();
        averageCount64Base.CounterType = PerformanceCounterType.AverageBase;
        averageCount64Base.CounterName = "AverageCounter64SampleBase";
        counterCreationDataCollection.Add(averageCount64Base);

        // Create the category.
        PerformanceCounterCategory.Create("AverageCounter64SampleCategory",
        "Demonstrates usage of the AverageCounter64 performance counter type.",
        PerformanceCounterCategoryType.SingleInstance, counterCreationDataCollection);

        </pre>

        </li>
        <li>
        <div>The last step is output the counter.</div>

        <code>
        pc.IncrementBy(value);
        basedPc.Increment();
        </pre>

        </li>
        </ol>