]> sourceware.org Git - systemtap.git/commitdiff
PR 11369, due to performance issues stap_merge.c is being shipped
authorLukas Berk <lberk@redhat.com>
Thu, 12 Aug 2010 16:10:08 +0000 (12:10 -0400)
committerLukas Berk <lberk@redhat.com>
Thu, 12 Aug 2010 16:10:08 +0000 (12:10 -0400)
instead of a .tcl script.  stap-merge.1 man page was added to
document the command.

Makefile.am
runtime/staprun/stap_merge.c
stap-merge.1 [new file with mode: 0644]

index 7128d5f48f88fad93c290214bd2fc42fece9dbfd..980b88bce84b8aef55d32c970374ff8341947d18 100644 (file)
@@ -13,18 +13,18 @@ AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Werror -Wunused -Wformat=2 -W
 AM_CXXFLAGS = -Wall -Werror
 
 man_MANS = stapprobes.3stap stapfuncs.3stap stapvars.3stap stapex.3stap \
-dtrace.1 \
+dtrace.1 stap-merge.1\
 stappaths.7 \
 staprun.8
 
-bin_PROGRAMS = staprun
+bin_PROGRAMS = staprun stap-merge
 bin_SCRIPTS = stap-report
 pkglibexec_PROGRAMS = stapio
 pkglibexec_SCRIPTS = stap-env
 oldinclude_HEADERS = includes/sys/sdt.h
 
 if BUILD_TRANSLATOR
-bin_PROGRAMS += stap
+bin_PROGRAMS += stap 
 man_MANS += stap.1
 bin_SCRIPTS += dtrace
 
@@ -182,6 +182,10 @@ stapio_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ -fno-strict-aliasing -fno-builtin-strft
 stapio_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
 stapio_LDADD = -lpthread
 
+stap_merge_SOURCES = runtime/staprun/stap_merge.c
+stap_merge_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@
+stap_merge_LDFLAGS = $(AM_LDFLAGS) @PIECFLAGS@
+stap_merge_LDADD = 
 
 install-exec-hook:
        if [ `id -u` -eq 0 ]; then chmod 04111 "$(DESTDIR)$(bindir)/staprun"; fi
index fb8a17c1d5fc271d97ec3fd27a34b6b74ccde8e1..5c0d32f0d2d280c2e5b739a0ea4f74b1169eef79 100644 (file)
@@ -105,19 +105,19 @@ int main (int argc, char *argv[])
                        if (verbose)
                                fprintf(stdout, "[CPU:%d, seq=%ld, length=%d]\n", j, min, len);
                        if (len > bufsize) {
-                               bufsize = len * 2;
+                               bufsize = len;
                                if (verbose) fprintf(stderr, "reallocating %d bytes\n", bufsize);
                                buf = realloc(buf, bufsize);
                                if (buf == NULL) {
-                                       fprintf(stderr, "Memory allocation failed.\n");
+                                       fprintf(stderr, "Memory allocation failed.\n"); 
                                        exit(-2);
                                }
                        }
-                       if ((rc = fread(buf, len, 1, fp[j]) <= 0)) {
+                       if ((rc = fread(buf, len, 1, fp[j])) <= 0 ) {
                                fprintf(stderr, "fread error: got %d\n", rc);
                                exit(-3);
                        }
-                       if ((rc = fwrite(buf, len, 1, ofp)) <= 0) {
+                       if ((rc = fwrite(buf, len, 1, ofp)) <= 0 ) {
                                fprintf(stderr, "fread error: got %d\n", rc);
                                exit(-3);
                        }
diff --git a/stap-merge.1 b/stap-merge.1
new file mode 100644 (file)
index 0000000..d4b2a35
--- /dev/null
@@ -0,0 +1,100 @@
+.\" -*- nroff -*-
+.TH STAP-MERGE 1
+.SH NAME
+stap\-merge \- systemtap per-cpu binary merger
+
+.\" macros
+.de SAMPLE
+.br
+.RS
+.nf
+.nh
+..
+.de ESAMPLE
+.hy
+.fi
+.RE
+..
+
+.SH SYNOPSIS
+
+.br
+.B stap-merge
+[
+.I OPTIONS
+]
+[
+.I INPUT FILENAMES
+]
+
+.SH DESCRIPTION
+
+The stap-merge executable applies when the \-b option has been used 
+while running a 
+.IR stap 
+script.  The \-b option will generate files 
+per\-cpu, based on the timestamp field. Stap-merge will 
+then merge and sort through the per\-cpu files based on the timestamp
+field.
+
+.SH OPTIONS
+
+The systemtap merge executable supports the following options.
+.TP
+.B \-v
+Verbose mode, displays three extra fields per set of collected data.
+.SAMPLE
+.BR [cpu number, sequence number of data, the length of the data set]
+.ESAMPLE
+.TP
+.BI \-o " OUTPUT_FILENAME"
+
+Specify the name of the file you would like the output to be 
+redirected into.  If this option is not specified than the
+output will be pushed to standard out.
+
+.SH EXAMPLES
+.SAMPLE
+$ stap -v -b -e 'probe syscall.open { printf("%s(%d) open\\n",
+execname(), pid()) }' 
+
+.ESAMPLE
+
+This should result in several
+.I stpd_cpu
+files (each labled with a number 
+representing which cpu the file was produced from).
+
+.SAMPLE
+$ stap-merge -v stpd_cpu0 stpd_cpu1
+
+.ESAMPLE
+
+Running the stap-merge program in the same directory as the stap 
+script earlier in the example, will produce an ordered sequence of 
+packets with the three part label for each set of data.  This
+result will be pushed through the standard output.  An output file 
+could have been specified using the "-o" option.
+
+.SH FILES
+
+.TP
+Important files and their corresponding paths can be located in the 
+stappaths (7) manual page.
+
+.SH SEE ALSO
+.IR stapprobes (3stap),
+.IR stapfuncs (3stap),
+.IR stappaths (7),
+.IR staprun (8),
+.IR stapvars (3stap),
+.IR stapex (3stap),
+.IR stap-client (8),
+.IR stap-server (8),
+.IR gdb (1)
+
+.SH BUGS
+Use the Bugzilla link of the project web page or our mailing list.
+.nh
+.BR http://sources.redhat.com/systemtap/ , <systemtap@sources.redhat.com> .
+.hy
This page took 0.035217 seconds and 5 git commands to generate.