Unused functions and local and global variables

William Cohen wcohen@redhat.com
Mon Jul 9 14:57:00 GMT 2007


Finally able to get some coverage information about which functions, local 
variables, and global variables are never used by the testing.

-Checked out the cvs sytemtap

-configured to install in /home/wcohen/systemtap_write/install

-built and installed with "make install"

-Set environment variable:
export SYSTEMTAP_COVERAGE=true

-ran "make installcheck" in the build directory

.cd into build directory's testsuite/.systemtap

-The database is stored in 'uname -r'.db

I ran the following queries to get get information about which global and local 
variables unused, and unused functions in the tapsets.


sqlite3 -separator : 2.6.9-55.0.2.ELsmp.db \
"select file, line, col, name from counts where (compiled='0' and type='2')" \
|grep tapset > /tmp/unused_functions.txt

sqlite3 -separator : 2.6.9-55.0.2.ELsmp.db \
"select file, line, col, name from counts where (compiled='0' and type='3')" \ 
|grep tapset > /tmp/unused_locals.txt

sqlite3 -separator : 2.6.9-55.0.2.ELsmp.db \
"select file, line, col, name from counts where (compiled='0' and type='4')" \
|grep tapset > /tmp/unused_global.txt

The resulting files output is attached. The elements are separate by ':'. First 
file name followed by row and column. Then the object name.

Caveats about the coverage implementation:

-It currently doesn't track probe aliases, so all the probes in the data base 
are used, there are no listing of unused probe points.

-The data recording happens in the elaboration phase, so tests that just run to 
-p2 or -p3 are counted as compiled even if though the C compiler never sees the 
generated code

-The local variable names include munging for the function generated to access 
the local variable.

-Will
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unused_functions.txt
Type: text/x-diff
Size: 58160 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20070709/1b97fa55/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unused_global.txt
Type: text/x-diff
Size: 88 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20070709/1b97fa55/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unused_locals.txt
Type: text/x-diff
Size: 41638 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20070709/1b97fa55/attachment-0002.bin>


More information about the Systemtap mailing list