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
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
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);
}
--- /dev/null
+.\" -*- 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