Added support for gcov, and ran gprof. Shaved 10% off the runtime of check_page by optimizing rw.c

This commit is contained in:
Sears Russell 2004-10-04 05:24:12 +00:00
parent 96e7af92a4
commit 9268b1d9cf
7 changed files with 79 additions and 31 deletions

View file

@ -6,4 +6,16 @@ docs:
doxygen doc/Doxyfile-api
doxygen doc/Doxyfile-developers
.PHONY: docs
precoverage :
find . -name '*.bb' | xargs rm -f
find . -name '*.bbg' | xargs rm -f
find . -name '*.da' | xargs rm -f
coverage: precoverage check
echo '(make profile requires CFLAGS="-fprofile-arcs -ftest-coverage -pg -O0")'
lcov -c --directory src/libdfa/ --directory src/lladd/ --directory test/ > tmp.info
# lcov -c --directory . > tmp.info
genhtml -o doc/coverage tmp.info
rm tmp.info
.PHONY: docs precoverage coverage

24
README
View file

@ -34,3 +34,27 @@ http://mission.base.com/peter/source/
LLADD's version of the package adds the jbhash.* files, and compiles PBL using
LLADD's make files. Currently, LLADD's hash table implementations are based upon
code from PBL, and pbl is used in a number of places throughout LLADD.
In order to use gcc's profiling and coverage tools (gprof, and gcov, respectively),
execute this command:
export CFLAGS="-fprofile-arcs -ftest-coverage -pg -O0"
./configure
make clean
make check
The 'make check' step will output profiles and test coverage that reflects the test
cases. You can simply invoke 'make' if you are interested in profiling the
library for a specific program.
To produce the gcov output, you may then run this command in src/
ls *.c logger/*.c operations/*.c page/*.c | xargs -n 1 gcov | grep executed | sort -k1,1n
Or, run this:
lcov -c --directory . > tmp.info
genhtml tmp.info
For HTML output.

View file

@ -1,10 +1,13 @@
#! /bin/sh
make distclean
rm -rf Makefile.in aclocal.m4 autom4te.cache config.h.in configure depcomp hello.c install-sh missing doc/api doc/developers
rm -rf Makefile.in aclocal.m4 autom4te.cache config.h.in configure depcomp hello.c install-sh missing doc/api doc/developers doc/coverage autoscan.log configure.scan
find . | grep \~$ | xargs rm -f
find . -name '*.bb' | xargs rm -f
find . -name '*.bbg' | xargs rm -f
find . -name '*.da' | xargs rm -f
find . | perl -ne 'print if (/\/core(\.\d+)?$/)' | xargs rm -f
find . | perl -ne 'print if (/\/Makefile.in$/)' | xargs rm -f
find . | perl -ne 'print if (/\/storefile.txt$/)' | xargs rm -f
find . | perl -ne 'print if (/\/logfile.txt$/)' | xargs rm -f
find . | perl -ne 'print if (/\/blob._file.txt$/)' | xargs rm -f
rm -f test/gmon.out test/lladd/gmon.out

View file

@ -11,6 +11,7 @@ functionality in a modular way.</p>
<ul>
<li><a href="api/html/index.html">User Guide (API)</a></li>
<li><a href="developers/html/index.html">Documentation of LLADD's internals</a></li>
<li><a href="coverage/index.html">Unit Test Coverage Report</a></li>
</ul>
<hr>

View file

@ -83,8 +83,11 @@ void downgradelock(rwl * lock) {
assert(lock->writers);
lock->writers--;
lock->readers++;
if(lock->waiting) {
pthread_cond_signal (lock->writeOK);
} else {
pthread_cond_broadcast(lock->readOK);
}
pthread_mutex_unlock(lock->mut);
}
@ -92,14 +95,19 @@ void unlock(rwl * lock) {
pthread_mutex_lock (lock->mut);
if(lock->readers) {
lock->readers--;
if(lock->waiting) {
pthread_cond_signal (lock->writeOK);
}
} else {
assert (lock->writers);
lock->writers--;
/* Need this as well (in case there's another writer, which is blocking the all of the readers. */
if(lock->waiting) {
pthread_cond_signal (lock->writeOK);
} else {
pthread_cond_broadcast (lock->readOK);
}
}
pthread_mutex_unlock (lock->mut);
}

View file

@ -129,7 +129,7 @@ END_TEST
@todo: Until we have a non-idempotent operation on blobs, this test can't be written.
*/
START_TEST (recoverBlob__exactlyOnce) {
/* START_TEST (recoverBlob__exactlyOnce) {
int xid;
int j;
@ -180,7 +180,7 @@ START_TEST (recoverBlob__exactlyOnce) {
}
END_TEST
*/
/**
@test
Makes sure that aborted idempotent operations are correctly undone.
@ -266,7 +266,7 @@ END_TEST
@todo logical operations on blobs.
*/
START_TEST (recoverBlob__exactlyOnceAbort) {
/* START_TEST (recoverBlob__exactlyOnceAbort) {
int xid;
int j;
@ -311,14 +311,14 @@ START_TEST (recoverBlob__exactlyOnceAbort) {
}
END_TEST
*/
/**
@test
Check the CLR mechanism with an aborted logical operation, and multipl Tinit()/Tdeinit() cycles.
@todo Devise a way of implementing this for blobs.
*/
START_TEST(recoverBlob__clr) {
/*START_TEST(recoverBlob__clr) {
recordid rid;
int xid;
int j;
@ -381,7 +381,7 @@ START_TEST(recoverBlob__clr) {
} END_TEST
*/
void simulateBufferManagerCrash();
extern int numActiveXactions;
/**
@ -550,22 +550,22 @@ Suite * check_suite(void) {
Suite *s = suite_create("recovery_suite");
/* Begin a new test */
TCase *tc = tcase_create("recovery");
void * foobar; /* used to supress warnings. */
/* void * foobar; */ /* used to supress warnings. */
/* Sub tests are added, one per line, here */
tcase_add_test(tc, recoverBlob__idempotent);
/* tcase_add_test(tc, recoverBlob__exactlyOnce); */
foobar = (void*)&recoverBlob__exactlyOnce;
/* tcase_add_test(tc, recoverBlob__exactlyOnce);
foobar = (void*)&recoverBlob__exactlyOnce; */
tcase_add_test(tc, recoverBlob__idempotentAbort);
/* tcase_add_test(tc, recoverBlob__exactlyOnceAbort); */
/* tcase_add_test(tc, recoverBlob__exactlyOnceAbort);
foobar = (void*)&recoverBlob__exactlyOnceAbort;
/* tcase_add_test(tc, recoverBlob__clr); */
foobar = (void*)&recoverBlob__clr;
tcase_add_test(tc, recoverBlob__clr);
foobar = (void*)&recoverBlob__clr; */
tcase_add_test(tc, recoverBlob__crash);
/* tcase_add_test(tc, recoverBlob__multiple_xacts); */
foobar = (void*)&recoverBlob__multiple_xacts;
tcase_add_test(tc, recoverBlob__multiple_xacts);
/*foobar = (void*)&recoverBlob__multiple_xacts; */
/* --------------------------------------------- */
tcase_add_checked_fixture(tc, setup, teardown);

View file

@ -240,7 +240,7 @@ START_TEST(logWriterTruncate) {
} END_TEST
#define ENTRIES_PER_THREAD 1000
#define ENTRIES_PER_THREAD 2000
pthread_mutex_t random_mutex;
@ -318,7 +318,7 @@ START_TEST(logWriterCheckWorker) {
START_TEST(logWriterCheckThreaded) {
#define THREAD_COUNT 50
#define THREAD_COUNT 100
pthread_t workers[THREAD_COUNT];
int i;
pthread_mutex_init(&random_mutex, NULL);