The Performance Monitor build feature allows you to get the statistics on the CPU, disk, and memory usage during a build run on a build agent.
Performance Monitor supports Windows, Linux, macOS, Solaris, and FreeBSD operating systems. It requires Perl to be installed on any used OS except Windows.
Note that Performance Monitor reports the load of the whole operating system. It will not report proper results if you have more than one agent running on the same host, or if an agent and a server are installed on the same machine.
After you enable the Performance Monitor build feature for a build configuration, the Build Results page of each newly run build in this configuration will contain the PerfMon tab with a graph of performance statistics. The CPU value reflects the average CPU load during the build, the Disk and Memory values are calculated relatively to the total disk space and physical memory available on the agent machine.
Clicking on a point in the graph displays the corresponding value (CPU on a screenshot below) as well as the build log with the highlighted fragment for the selected time:
Since version 2021.1.2, you can select a specific time range with a drag-and-drop, and TeamCity will show the respective log entries.