public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: William Cohen <wcohen@redhat.com>
To: SystemTAP <systemtap@sources.redhat.com>
Subject: coverage database support
Date: Fri, 06 Jul 2007 16:21:00 -0000	[thread overview]
Message-ID: <468E6C00.9060405@redhat.com> (raw)

Hi all,

I have been working on incorporating a database to track what parts of
systemtap tapsets are exercised by the testsuite. Comments and
feedback on it would be appreciated. Preliminary support for this
(pr4529) has been checked into the systemtap cvs repository. It makes
use of sqlite3 to store the data base information.  There are two
possible ways of activating the coverage: using '-q' option on command
line and setting environment variable SYSTEMTAP_COVERAGE.

The database is persistent and additional runs will add to the
database.  The resulting data is stored in a very simple database
located in SYSTEMTAP_DIR/`uname -r`.db. This can be further analyzed
using sqlite3 and some simple scripts. It is also possible to have
other programs navigate the database in a cscope style, but notheing
has been implemented to do that currently.

The structure of the data base is very simple flat table. Some work
needs to be done to make the encoding more compact and accesses
faster. The table counts is formated in the following

table counts (
/* token location information */
	file text,	
	line integer,
	col integer,

         type text,	/* 'p' probe, 'f' function, 'l' local, 'g' global */
	name text,	/* name of item */
	parent text,	/* name of probe or function local is in */
         compiled integer, /* ==0 no c code generated, >0 c code generated */
	removed integer, /* >0 parsed */
	executed integer /* >0 code executed, not implemented */
);


Get some data into the database running the recently built systemtap
with coverage support:

../install/bin/stap -v -q -p2 -mx ../src/testsuite/systemtap.samples/poll_map.stp

Start up sqlite3 with:

  sqlite3 ~/.systemtap/2.6.20-1.2962.fc6.db

Print out the functions compiled:

sqlite> select * from counts where (type='f' and compiled>'0');
/home/wcohen/research/profiling/systemtap_write/install/share/systemtap/tapset/context.stp|31|10|f|execname||1|0|0
/home/wcohen/research/profiling/systemtap_write/install/share/systemtap/tapset/logging.stp|19|10|f|exit||1|0|0

Print out the used probes:

sqlite> select * from counts where (type='p' and compiled>'0');
../src/testsuite/systemtap.samples/poll_map.stp|8|7|p|kernel.function("sys_execve@arch/x86_64/kernel/process.c:677").call||316|0|0
../src/testsuite/systemtap.samples/poll_map.stp|12|7|p|timer.ms(1000)||4|0|0
../src/testsuite/systemtap.samples/poll_map.stp|28|7|p|end||2|0|0

Print out the unused functions with:

select * from counts where (type='f' and compiled='0');


Current issues with the coverage support:

-slow, testsuite/semok/twenty.stp takes hours to run because it generates
	so many entries.

-missing entries for unused aliases.

-no execute data, would be really nice to know what probes have
actually been used and record them in the database

-redering to provide information in a manner similar to:
  http://people.redhat.com/wcohen/stap-combined-tests-200705240830/


-Will

             reply	other threads:[~2007-07-06 16:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-06 16:21 William Cohen [this message]
2007-07-07 21:55 ` William Cohen
2007-07-09 14:57 ` Unused functions and local and global variables William Cohen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=468E6C00.9060405@redhat.com \
    --to=wcohen@redhat.com \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).