Export (0) Print
Expand All

CTRPP

The CTRPP tool is a pre-processor that parses and validates your counters manifest. The tool also generates code that you use to provide your counter data. You should use the generated code as a starting point when developing your provider instead of trying to generate this code yourself.

ctrpp -o filename -rc filename [-legacy] [-MemoryRoutines] [-NotificationCallback] 
[-prefix prefix] [-ch filename] [-backcompat] [-summary path] [-sumPath path] manifest

Arguments

-backcompat

Used by kernel-mode drivers to generate code that is compatible with operating systems prior to Windows 7. Although the provider will run without failing on operating systems prior to Windows 7, the provider will not provide counter data.

-ch filename

Creates a header file that assigns symbols to the counter set names and GUIDs for each counter set in the manifest.

-legacy

Generates code using the Windows Vista code templates. The tool generates the following files:

  • .h
  • .c
  • .rc
  • _r.h

The .h file contains the provider GUID, a counter set GUID and PERF_COUNTERSET_INFO block for each counter set defined in the manifest, the function declarations for the initialization, cleanup, and notification (if specified) functions, and the provider handle that is used when starting and stopping the provider.

The .c file contains the PerfAutoInitialize function, the PerfAutoCleanup function, and the default implementation of the notification callback function. You can include the rest of your provider implementation in this file or another file.

The PerfAutoInitialize function calls the PerfStartProvider function to register the provider and the PerfSetCounterSetInfo function to initialize each counter set. If you specify the -MemoryRoutines or -NotificationCallback arguments, the PerfAutoInitialize function will call the PerfStartProviderEx function instead of calling PerfStartProvider.

The PerfAutoCleanup function calls PerfStopProvider to remove the provider's registration from the list of registered providers and frees all resources associated with the provider.

Your provider calls the PerfAutoInitialize and PerfAutoCleanup functions.

The .c file includes the notification callback function only if the callback attribute of provider is set to "custom" or you use the -NotificationCallback argument. The generated callback includes all the callback cases. You can provide implementation for each case or remove those cases that you do not want to support.

The .rc file contains the localized strings for the counter name and description strings.

The _r.h file contains string constant definitions.

You can use this argument with only the -MemoryRoutines and -NotificationCallback arguments.

Windows Vista:  This argument is not supported.

-MemoryRoutines

Changes the default signature of the CounterInitialize function to include parameters for specifying the name of your AllocateMemory and FreeMemory callback functions.

Windows Vista:  Generates function templates for memory allocation and free routines (you provide the implementation for these routines).

-NotificationCallback

Changes the default signature of the CounterInitialize function to include the parameter for specifying the name of your ControlCallback callback function.

This argument is that same as including the callback attribute in the provider element.

Windows Vista:  Generates function templates for the notification callback (you provide the implementation for this callback).

-o filename

Specifies the name of the header file that the tool generates. If you do not specify a path, the file is generated in the current folder. You must specify this argument.

Windows Vista:  This argument is not supported.

-prefix

Specifies the prefix to use for the global variables and functions defined in the generated header file.

Windows Vista:  This argument is not supported.

-rc filename

Specifies the name of the resource file that the tool generates. If you do not specify a path, the file is generated in the current folder. You must specify this argument.

Windows Vista:  This argument is not supported.

-summary path

Reserved.

-sumPath path

Reserved.

manifest

The manifest that defines your counters. If manifest does not include a full path, the tool looks in the current folder.

Remarks

The names of the files that the tool generates are based on the name of the manifest that you pass to the CTRPP tool. For example, if the manifest name is Perf.man, the tool generates the following files for you.

  • Perf.h
  • Perf.rc

Note that these files include code for each provider included in the manifest.

The .h file contains the initialization and cleanup functions that your provider calls. The initialization function is called prefixCounterInitialize and the cleanup function is called prefixCounterCleanup. The function names include the prefix string if you specify the -prefix argument. The functions are inline functions.

The .h file also includes a counter set GUID and PERF_COUNTERSET_INFO block for each counter set defined in the manifest and the symbolic names for the provider, counter sets, and counters (if specified). You specify the symbolic names in the manifest. You can use the symbolic names when you reference the provider, counter set, or counter. For example, when calling the PerfCreateInstance function, set the CounterSetGuid parameter to the symbolic name.

The .rc file contains the strings for the counter names and descriptions.

You cannot specify the -legacy argument with the -o, -rc, -ch, and -prefix arguments; they are mutually exclusive.

If you do not specify the -legacy, -o, -ch, or -rc arguments, the tool validates the manifest but does not generate any code.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

 

 

Community Additions

ADD
Show:
© 2014 Microsoft