Edit

Performance Counters Schema

V2 performance data providers are supported on Windows Vista or later. They use a .MAN (XML instrumentation manifest) file to define the provider, the countersets, and the counters.

Note

Instrumentation manifests can contain information about both Event Tracing for Windows (ETW) providers and Performance Counter providers. For details on instrumentation manifests see EventManifest Schema and Writing an Instrumentation Manifest).

This section describes the following elements and types that you use in the counters section of an instrumentation manifest:

Do not use the localization or stringTable sections of the instrumentation manifest for performance data strings. Instead, specify the strings as values of the attribute that you are setting.

After creating the manifest, use the CTRPP tool to validate the manifest and to generate code (.h) and resource (.rc) files to be used in building your provider.

When installing your application, run the LodCtr.exe tool with the /M: parameter to install your performance counters. The LodCtr.exe tool will record the necessary information into the registry under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\_V2Providers\{ProviderGuid}, including the full path to the binary containing the string resources for your provider (as specified in the applicationIdentity attribute of the manifest). You must have administrator privileges to run LodCtr.exe. Example installation command:

LodCtr.exe /M:"manifest" ["ApplicationIdentityDirectory"]

If you need to update a counterset, be sure to uninstall the old counterset using the UnlodCtr.exe tool with the /G: or /P: parameters. After the old counterset is uninstalled, you can install the updated counterset.

Schema

The following is the performance counters schema that you can use to validate the counters section of your manifest. This schema is found in the Windows SDK as counterman.xsd. For details on the schema that you use to validate the instrumentation section of the manifest, see EventManifest Schema.



  
    
      
    
  

  
    
      Hex 1-8 digits in size
    
    
      
    
  

  
    
      Hex 1-8 digits in size or unsignedInt
    
    
  

  
    
      A Valid C Symbol or an empty string
    
    
      
    
  

  
    
      
        
        
      
    
  

  
    
      
    
  
  
  
    
      
        
          
            
              
              
              
              
              
            
          
        
      
    
  
  
  
    
      
    
  
  
  
    
      
        
          
            
              Only five counterAttribute elements allowed, they should all be unique.
            
          
          
          
        
      
    
    
    
    
    
      
        
            This attribute is required for schemaVersion >= 2.0.
        
      
      
        
          
        
      
    
    
      
        
            Resource ID of the name string. This attribute is required
            for schemaVersion >= 2.0. It is not allowed for older versions.
        
      
    
    
      
        
            This attribute is required for schemaVersion >= 2.0.
        
      
    
    
      
        
            Resource ID of the description string. This attribute is required
            for schemaVersion >= 2.0. It is not allowed for older versions.
        
      
    
    
      
        
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
        
      
    
    
    
      
        
          
          
        
      
    
    
      
        
          
          
        
      
    
    
      
        
          
          
          
          
          
        
      
    
    
    
    
    
      
        
          If providerType=userMode, required.
          If providerType=kernelMode, not allowed.
        
      
    
    
      
        
          If providerType=userMode, required.
          If providerType=kernelMode, not allowed.
        
      
    
  

  
    
      
        
          
            If providerType=userMode, required.
            If providerType=kernelMode, not allowed.
          
        
      
      
    
    
    
    
    
      
        
          
        
      
    
    
      
        
            Resource ID of the name string. This attribute is required
            for schemaVersion >= 2.0, and not allowed for older versions.
        
      
    
    
    
      
        
            Resource ID of the description string. This attribute is required
            for schemaVersion >= 2.0, and not allowed for older versions.
        
      
    
    
      
        
          
          
          
          
          
        
      
    
  
  
  
    
        
    
    
      
        
          Provider Symbol is required for User Mode providers.
        
      
    
    
      
        
          
          
        
      
    
    
    
    
      
        
          
          
        
      
    
    
    
      
        
            This attribute is not allowed for schemaVersion >= 2.0.
        
      
    
  
  
  
    
      
    
    
  
  
  
    
      
        
          Counter Set GUID should be unique across the entire document. The
          counter set registration fails if the GUID is already registered.
          To update a counter set that is registered, you must first
          uninstall the counter set and register it again.
        
      
      
      
    
  
  

Example User-Mode Manifest

The following shows an example manifest that defines performance counters for a user-mode provider.




  

    

      

        

          

          
            
              
              
            
          

          
            
              
            
          

        

        

          
            
              
              
            
          

          

          

          
            
              
            
          

          
            
              
            
          

        
      
    
  

Example Kernel-Mode Manifest

The following shows an example manifest that defines performance counters for a kernel-mode provider.