12. Live Power Profile

Overview of System-Wide Power Profile

The AMD uProf profiler offers live power profiling to monitor the behavior of the systems based on AMD CPUs and APUs. It provides various counters to monitor power and thermal characteristics.

These counters are collected from various resources such as RAPL and MSRs. They are collected at regular time intervals and either reported as a text file or plotted as line graphs. They can also be saved into the database for future analysis.

12.1. Features

12.2. Metrics

The supported metrics depend on the processor family and model and are broadly grouped under various categories. The supported counter categories by processor families are listed here.

Applies to the following processor families.

The supported counter categories are listed here.

Table 12.1 Counter Categoriess#

Power Counter Category

Description

Frequency

CPU Core Effective Frequency for the sampling period, reported in MHz.

P-State

CPU P-State at the time when sampling was performed.

Power

Average Power for the sampling period, reported in Watts. This is an estimated consumption value based on the platform activity levels. It is available for Core and Package.

Temperature

Average temperature for the sampling period, reported in Celsius. The temperature reported is with reference to Tctl. It is available for Package.

12.3. Using Profile through GUI

12.3.1. System-wide Power Profile (Live)

This profile type is used to perform the power analysis where the metrics are plotted in a live timeline graph and/or saved in a database. Complete the following steps to configure and start the profile:

12.3.2. Configuring a Profile

To configure a profile:

  1. Click the PROFILE tab at the top navigation bar or one of the following on the Welcome page:

    The Select Profile Target page is displayed.

  2. Click Next.

    The Select Profile Type page is displayed.

  3. From the Select Profile Configuration screen, select the Live Power Profile tab.

    All live profiling options and available counters are displayed in the respective panes.

    Live System-wide Power Profile.

    Figure 12.1 Live System-wide Power Profile#

  4. Under Counters, select the required counter category and the respective options.

    Note

    You can configure multiple counter categories.

    You can render the graphs live during profiling.

  5. Click Start Profile.

    For this profile type, profile data will be generated as line graphs in the TIMECHART page for further analysis.

    The CLI command is displayed for all the options selected from the GUI for Live Power Profiling.

12.3.3. Analyzing a Profile

After the required counters are selected and the profile data collection begins, the metrics will be plotted in the live timeline graphs under the TIMECHART tab.

Timechart.

Figure 12.2 Timechart#

  1. The TIMECHART page displays the metrics plotted in live timeline graphs - grouped together and plotted based on the category.

  2. The data table adjacent to each graph displays the current value of the counters.

  3. Choose the graph you want to display from the Graph Visibility pane.

  4. When plotting is in progress, you can:

12.4. Using CLI to Profile

Use the AMDuProfCLI timechart command to collect the system metrics and write them into a text file or comma-separated-value (CSV) file. Complete the following procedure to collect power profile counter values:

  1. Run the command with --list option to get the list of supported counter categories.

  2. Use the command to specify the required counters with -e or --event option to collect and report the required counters.

    The timechart run to list the supported counter categories is given here:

    --list Command Output.

    Figure 12.3 –list Command Output#

    Timechart Run.

    Figure 12.4 Timechart Run#

The run will collect the power and frequency counters on all the devices on which these counters are supported and writes them in the output file specified with the -o option. Before the profiling begins, the given application will be launched and the data will be collected till the application terminates.

12.4.1. Examples

12.4.1.1. Windows

Collect all the power counter values for a duration of 10 seconds with a sampling interval of 100 milliseconds.

C:\> AMDuProfCLI.exe timechart --event power --interval 100 --duration 10

Collect all frequency counter values for 10 seconds, sampling them every 500 milliseconds and adding the results to a csv file.

C:\> AMDuProfCLI.exe timechart --event frequency -o C:\Temp\Poweroutput --interval 500 -- duration 10

Collect all the frequency counter values at core 0 to 3 for 10 seconds, sampling them every 500 milliseconds and adding the results to a text file.

C:\> AMDuProfCLI.exe timechart --event core=0-3,frequency -o C:\Temp\Poweroutput
--interval 500 --duration 10 --format txt

Collect socket temperature when workload is running, set the sampling interval to 500 milliseconds.

C:\> AMDuProfCLI timechart --event socket,temperature --interval 500 <command to execute workload>

12.4.1.2. Linux

Collect all the power counter values for a duration of 10 seconds with a sampling interval of 100 milliseconds.

$ ./AMDuProfCLI timechart --event power --interval 100 --duration 10

Collect all the frequency counter values for 10 seconds, sampling them every 500 milliseconds and adding the results to a csv file.

$ ./AMDuProfCLI timechart --event frequency -o /tmp/PowerOutput --interval 500 --duration 10

Collect all the frequency counter values at core 0 to 3 for 10 seconds, sampling them every 500 milliseconds and adding the results to a text file.

$ ./AMDuProfCLI timechart --event core=0-3,frequency -o /tmp/PowerOutput --interval 500 --duration 10 --format txt

12.4.2. AMDPowerProfileAPI Library

Use the API library to configure and collect the supported power profiling counters on various AMD platforms directly without using AMD uProf GUI or CLI. The AMDPowerProfileAPI library is used to analyze the power efficiency of systems based on AMD CPUs and APUs.

These APIs provide interface to read the power, thermal, and frequency characteristics of AMD CPUs and APUs and their subcomponents. These APIs are targeted for software developers who want to write their own application to sample the power counters based on their specific use case(s).

For detailed information on these APIs, see the AMDPowerProfilerAPI.pdf under the <AMDuProf-install-dir>/help/ folder.

12.4.2.1. Using the APIs

Refer the sample program CollectAllCounters.cpp to learn how to use these APIs. The program must be linked with the AMDPowerProfileAPI library while compiling. The power profiling driver must be installed and running.

A sample program CollectAllCounters.cpp that uses these APIs is available in the directory:<AMDuProf-install-dir>/Examples/CollectAllCounters/. To build and execute the sample application, complete the following OS-specific steps:

12.4.2.1.1. Windows

A Visual Studio 2022 solution file CollectAllCounters.sln is available in the directory: C:/Program Files/AMD/AMDuProf/Examples/CollectAllCounters/ to build the sample program.

12.4.2.1.2. Linux
  1. Command to build:

    $ cd <AMDuProf-install-dir>/Examples/CollectAllCounters
    $ g++ -O -std=c++11 CollectAllCounters.cpp -I<AMDuProf-install-dir>/include -l AMDPowerProfileAPI -L<AMDuProf-install-dir>/lib -Wl,-rpath <AMDuProf-install-dir>/bin -o CollectAllCounters
    
  2. Command to execute:

    $ export LD_LIBRARY_PATH=<AMDuProf-install-dir>/lib
    $ ./CollectAllCounters
    

12.5. Limitations

The limitations are listed here: