Improving the Hardware Performance Counter Support


Project Status: Completed 

FreeBSD Developer: Joseph Koshy

The FreeBSD Foundation, with a generous grant from Google, teamed up to sponsor Joseph Koshy in improving the hardware performance counter support in FreeBSD. The goal of the project was the addition of callgraph support in the hwpmc driver. With callgraph support, developers can more clearly visualize performance issues through the exact code paths, rather than a specific function which may only exhibit issues through one path, but not others. In addition to the improvements to this software, Google provided funding for 2 modern CPU machines for development and testing. These new machines were placed in the network performance cluster hosted by Sentex Corp in Ontario, Canada.

Following is a more detailed list of what was added:

  • The hwpmc driver now supports callchain capture, for both the kernel and for user processes.
  • The machine-dependent and machine-independent parts of the kernel for the i386 and amd64 architectures (the ones that hwpmc is available on) have been so enhanced to support extra functionality needed by hwpmc(4) for callgraph support.
  • The libpmc(3) library has been enhanced to process the new information collected by the kernel module.
  • The pmcstat(8) tool produces two kinds of reports using captured callchain data, (a) traditional gprof(1) callgraphs and (b) a callchain summary, for two different ‘views’ into the collected data.
  • Manual pages for the driver hwpmc(4), command-line tool pmcstat(8), and interface library pmc(3) now reflect the new features available.

How to access the code

The callchain capture work is in CVS now.