Retrieving Selected Data

Retrieving the performance data is not without cost to the system, especially in terms of processor and memory requirements. In cases where your application does not need all the performance data, you can use the lpszValueName parameter of RegQueryValueEx to indicate the amount of information to retrieve. The following table lists the values you can specify for lpszValueName. Note that the value strings are case-sensitive, and if a string includes more than one word, your words must be separated by a space.

Table 12.2 Possible Values for lpszValueName

String

Meaning

Global

The function returns all data for counters on the local computer except those included in the Costly category, described later in this table.

nnn xx yyy

Each of these is a Unicode string representing the decimal value for a PERF_OBJECT_TYPE.ObjectNameTitleIndex. The function only returns data about the specified object types on the local computer. 1

Using the example above, if your program were to pass "2 4" as the lpszValueName the System and Memory objects would be retrieved.

Foreign ssss

The string ssss is the name of a foreign computer, such as a Novell NetWare server or a UNIX system that does not support the Registry calls for returning data remotely. The function returns all data for counters on the foreign computer, if your system is capable of collecting data from a foreign computer. You may want to try this approach if RegConnectRegistry fails to connect to a foreign computer.

Foreign ssss nnn xx yyy

This format combines Foreign ssss and nnn xx yyy discussed above, and returns all data for the specified objects on the foreign computer, if your system is capable of collecting data from a foreign computer.

Costly

Data for object types whose data is expensive to collect (in terms of processor time or memory usage) is returned. If you want to respond to the user during data collection, you may want to start a secondary thread to access this data. PView does this. Costly data includes all the data normally returned by Global, and the expensive stuff too. For example, to return the current instruction pointer, the data collection code must map into every process's address space. This is too expensive for routine performance monitoring but may be useful in other situations.

|


1If you request an object type that requires other object types, the required object types will also be returned. For example, processes are needed to identify threads, so if you request threads you will also receive data about processes.