Monitoring CPU usage of Win devices with different languages using typeperf %Processor Time

Priya Jagyasi 21 Reputation points
2024-04-18T04:44:04.0833333+00:00

I use Windows 10 and above for my project in English, Spanish, etc. I am monitoring CPU usage of Win devices using typeperf %Processor Time. I want to run typeperf in devices with different locale without having to change object or counter. I see we have perflib from registry. How can I use the ID of the object or counter to fetch CPU usage in different languages, since the counter depends on the locale? Will perflib be available on all devices?

Windows Performance Toolkit
Windows Performance Toolkit
A collection of Microsoft performance monitoring tools that produce in-depth performance profiles of Windows operating systems and applications.
86 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Muminjon 0 Reputation points
    2024-04-22T12:37:54.6966667+00:00

    You can try numerical identifiers from perflib. I remember that the identifiers are consistent regardless of the system locale.

    In the registry, perflib has a identifier for the locale like 009 for English or 010 for Spanish.

    • **HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib
      **
      So you can find what is available there, and navigate to the performance object and work with them.

    You can utilize something like this: typeperf "\238(_Total)\6"

    • \238 represents the ID of the performance object
    • total for summary of all instances
    • \6 for the processor time value

    So if you follow the numeric IDs, they do not change with the system language settings.

    You can learn the syntax here: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/typeperf