Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8083617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:31:46+00:00 2026-06-05T17:31:46+00:00

I am having problem with previewing custom performance counters with PerflibV2. Performance Monitor shows

  • 0

I am having problem with previewing custom performance counters with PerflibV2.

Performance Monitor shows my custom performance counter group by GUID, and when I want to expand it “Can’t load counters” is shown.

I tried adding myself to “Performance Monitor Users” and “Performance Log Users” groups with no success.

I googled it, and read a lot of MSDN articles, but no success.

Is someone familiar with this problem?

Following is detailed procedure how I created and added custom performance counter:

I need to create a performance counter that will be updated from my unamanged application.

There are two approaches that I found:

  • Wrapping managed performance counter API, which is not an option because it will impact performance;

  • Using PerflibV2 which provides needed functionality;

As a test application, I created following schema.xml schema describing custom performance counter:

<!-- <?xml version="1.0" encoding="UTF-16"?> -->
<instrumentationManifest     
xmlns="http://schemas.microsoft.com/win/2004/08/events" 
xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"    
>
<instrumentation>
    <counters xmlns="http://schemas.microsoft.com/win/2005/12/counters">
        <provider callback = "custom"
          applicationIdentity = "PerfCounters.exe"
          providerType = "userMode"
          providerGuid = "{ab8e1320-965a-4cf9-9c07-fe25378c2a23}">
            <counterSet
              guid = "{ad36a036-c923-4794-b696-70577630b5cf}"
              uri = "Microsoft.Windows.System.PerfCounters.MyCounterSet1"
              name = "My LogicalDisk" 
              description = "This is a sample counter set with multiple instances." 
              instances = "multiple">
                <counter id = "1"
                  uri = "Microsoft.Windows.System.PerfCounters.MyCounterSet1.MyCounter1"
                  name = "My Free Megabytes"
                  description = "First sample counter."
                  type = "perf_counter_rawcount"
                  detailLevel = "standard"
                  defaultScale = "1"/>
            </counterSet>
        </provider>
    </counters>
    </instrumentation>
</instrumentationManifest>

And executed:

ctrpp schema.xml

I added created files to my test application, and in my test app, roughly:

PerfAutoInitialize();

ULONG instanceId = 0;
wchar_t instanceName[] = {'t', 'e', 's', 't', 0};
PPERF_COUNTERSET_INSTANCE b = PerfCreateInstance(hDataSource_schema_1, &CtrSetGuid_schema_1_1, instanceName, instanceId);

I installed performance counters with:

lodctr /m:schema.xml

My PerfCounters application is up and running while trying to read counters from Performance Monitor.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:31:49+00:00Added an answer on June 5, 2026 at 5:31 pm

    What was exact problem with my sample I am not completely sure but, there is an Microsoft example with Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1:

    http://www.microsoft.com/en-us/download/confirmation.aspx?id=3138

    After istalling MS SDK sample is located at:

    C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\winbase\PerfCounters\Basic\CPP

    It should be adapted for Windows 7 (ctrcpp has fewer arguments, and PerfAutoInitialize() and PerfAutoCleanup() are used instead of CounterInitialize() and CounterCleanup()).

    It app crashes on adding counter from perfmon, see:
    Perflib 2 crashes when adding a counter (from Perfmon)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I having problem to update the counter (integer value). this is the definitions of
i'm having problem when i want to select element using querySelector <ul class=xoxo blogroll>
i having problem with draw image in applet. i want to display all images
i having problem understanding what is wrong with my inheritance. I just can not
Having problem reading bytearray of custom objects. Any help is appreciated public class CustomObject
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
I'm having problem when running my Windows Forms program. In the program, I have
I'm having problem with Rails plugin attachment_fu . On every upload, I get validation
i'm having problem to deal with charset in ruby on rails app, specificially in
I am having problem in getting reference of Ajax control extender using $find() or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.