diff options
author | hunt <hunt> | 2005-08-22 19:06:42 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-08-22 19:06:42 +0000 |
commit | d313050f975d945bedacab47b883da41af7e3a97 (patch) | |
tree | ea16ada7f7b7757573a8cc93dac1d9da94741597 | |
parent | 66b6f687920815b1687a398287ebeb8b3a4a9b57 (diff) | |
download | systemtap-steved-d313050f975d945bedacab47b883da41af7e3a97.tar.gz systemtap-steved-d313050f975d945bedacab47b883da41af7e3a97.tar.xz systemtap-steved-d313050f975d945bedacab47b883da41af7e3a97.zip |
2005-08-22 Martin Hunt <hunt@redhat.com>
* Makefile (debug): Add debug target.
* librelay.h (dbug): Define.
* librelay.c: Enable some dbug lines.
-rw-r--r-- | runtime/stpd/ChangeLog | 6 | ||||
-rw-r--r-- | runtime/stpd/Makefile | 3 | ||||
-rw-r--r-- | runtime/stpd/librelay.c | 13 | ||||
-rw-r--r-- | runtime/stpd/librelay.h | 6 |
4 files changed, 21 insertions, 7 deletions
diff --git a/runtime/stpd/ChangeLog b/runtime/stpd/ChangeLog index 448c0209..c4124630 100644 --- a/runtime/stpd/ChangeLog +++ b/runtime/stpd/ChangeLog @@ -1,3 +1,9 @@ +2005-08-22 Martin Hunt <hunt@redhat.com> + + * Makefile (debug): Add debug target. + * librelay.h (dbug): Define. + * librelay.c: Enable some dbug lines. + 2005-08-19 Martin Hunt <hunt@redhat.com> * librelay.c (reader_thread): Check the return value for write(). diff --git a/runtime/stpd/Makefile b/runtime/stpd/Makefile index 1233a08b..ecced7a4 100644 --- a/runtime/stpd/Makefile +++ b/runtime/stpd/Makefile @@ -9,5 +9,8 @@ stp_merge: stp_merge.c stp_dump: stp_dump.c gcc -Wall -O3 -o stp_dump stp_dump.c +debug: stpd.c librelay.c ../transport/transport_msgs.h + gcc -Wall -g -D DEBUG -o stpd stpd.c librelay.c -lpthread + clean: /bin/rm -f stpd stp_merge *.o *~ diff --git a/runtime/stpd/librelay.c b/runtime/stpd/librelay.c index 9dc52f25..4bb1739f 100644 --- a/runtime/stpd/librelay.c +++ b/runtime/stpd/librelay.c @@ -203,7 +203,7 @@ static int open_relayfs_files(int cpu, const char *relay_filebase) #ifdef USE_PROCFS sprintf(tmp, "%s/%d", proc_filebase, cpu); - //printf("Opening %s.\n", tmp); + dbug("Opening %s.\n", tmp); proc_file[cpu] = open(tmp, O_RDWR | O_NONBLOCK); if (proc_file[cpu] < 0) { fprintf(stderr, "ERROR: couldn't open proc file %s: errcode = %s\n", tmp, strerror(errno)); @@ -373,7 +373,7 @@ static void *reader_thread(void *data) int init_relayfs(void) { int i, j; - //printf("initializing relayfs\n"); + dbug("initializing relayfs\n"); for (i = 0; i < ncpus; i++) { if (open_relayfs_files(i, params.relay_filebase) < 0) { @@ -448,7 +448,7 @@ int init_stp(const char *relay_filebase, int print_summary) *ptr = 0; sprintf(buf, "%s/cmd", proc_filebase); - //printf("Opening %s\n", buf); + dbug("Opening %s\n", buf); control_channel = open(buf, O_RDWR); if (control_channel < 0) { fprintf(stderr, "ERROR: couldn't open control channel %s: errcode = %s\n", buf, strerror(errno)); @@ -567,7 +567,7 @@ static void cleanup_and_exit (int closed) exiting = 1; - //printf ("CLEANUP AND EXIT closed=%d mode=%d\n", closed, transport_mode); + dbug("CLEANUP AND EXIT closed=%d mode=%d\n", closed, transport_mode); if (transport_mode == STP_TRANSPORT_RELAYFS) { kill_percpu_threads(ncpus); @@ -590,7 +590,7 @@ static void cleanup_and_exit (int closed) delete_percpu_files(); } - //printf("closing control channel\n"); + dbug("closing control channel\n"); close(control_channel); if (!closed) { @@ -633,7 +633,6 @@ int stp_main_loop(void) fprintf(stderr, "WARNING: unexpected EOF. nb=%d\n", nb); continue; } - // printf("read %d bytes\n", nb); type = *(int *)recvbuf; data = (void *)(recvbuf + sizeof(int)); @@ -651,7 +650,7 @@ int stp_main_loop(void) transport_mode = info->transport_mode; params.subbuf_size = info->subbuf_size; params.n_subbufs = info->n_subbufs; -#if 0 +#ifdef DEBUG if (transport_mode == STP_TRANSPORT_RELAYFS) printf ("TRANSPORT_INFO recvd: RELAYFS %d bufs of %d bytes.\n", params.n_subbufs, diff --git a/runtime/stpd/librelay.h b/runtime/stpd/librelay.h index 371ddfbd..71150858 100644 --- a/runtime/stpd/librelay.h +++ b/runtime/stpd/librelay.h @@ -1,5 +1,11 @@ #include "../transport/transport_msgs.h" +#ifdef DEBUG +#define dbug(args...) {printf("%s:%d ",__FUNCTION__, __LINE__); printf(args); } +#else +#define dbug(args...) ; +#endif /* DEBUG */ + /* * stp external API functions */ |