Hypervisor profiling using GCOV

From Tej Bewith on xen-devel:

gcov is a test coverage program. generally used with GCC to analyze programs to help create more efficient, faster running code and to discover untested parts of your program. Software developers also use coverage testing in concert with testsuites,  to make sure software is actually good enough for a release

Our efforts on the same line added the gcov(gcc) profiling support for hypervisor only. Current code base support xen-3.3.onwards, x86_32 and gcc 3.4 to 4.3.

xen-patch: code for hypervisor which populate the gcov_info (gcc 3.4
onward) with data file information, base code is taken from http://ltp.sourceforge.net/coverage/gcov.php. added xen support and a way to interact with linux since hypervisor itself cannot populate the /proc filesystem.

linux-patch: code for linux kernel basically enquire the hypervisor part to revert all data file information and populate the /proc/xen/gcov with data and graph file (optional)

command-line/modules parameter:
1. xen-gcov-link: if set, it creates the *.c and *.gcno linking under /proc/xen/gcov, else to run gcov/lcov we have to create manually linking.
2. xen-gcov-update: update the data files after xen-gcov-update secs, default value is 5sec… e.g while running a test suite, requires lower value of xen-gcov-update.
tunable xen-gcov-update exist at /proc/sys/xen
usage: echo <num> >/proc/sys/xen/xen-gcov-update

Running lcov straight-a-way could be problematic because lcov is written to see profiling info @/proc/gcov. To accomodate /proc/xen/gcov edit the config file /etc/lcovrc parameter as lcov_gcov_dir = /proc/gcov to /proc/xen/gcov and perform modprobe xen-gcov-proc.
We are having patches to accomodate both but changing config file could be a better options. Still if someone need patch please free to mail me @bewith.tej@gmail.com

YES, We are aware that gcov profiling is quite basic profiling concept, but its a begning from our end to make xen hypervisor best and robust, in future we will be working on changes required for 64bit hypervisor, older xen versions (if required), PERFMON features of Modern CPU’s.

Comments, reports, suggestions, and any other types of feedback is more than welcome

-tej & team