diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2009-03-20 13:31:18 -0400 |
---|---|---|
committer | Masami Hiramatsu <mhiramat@redhat.com> | 2009-03-20 13:31:18 -0400 |
commit | 701c41be909697d5ab36f7604a1f3620c7d04abc (patch) | |
tree | b9dda527c756bbdbb6cd3c243b713073ec00c698 | |
parent | acd56c22068963ad48f39890f5307600ff7d5278 (diff) | |
download | systemtap-steved-701c41be909697d5ab36f7604a1f3620c7d04abc.tar.gz systemtap-steved-701c41be909697d5ab36f7604a1f3620c7d04abc.tar.xz systemtap-steved-701c41be909697d5ab36f7604a1f3620c7d04abc.zip |
PR6930: stap: supports on-file flight recorder options
Add on-file flight recorder options (the combination of -F and -o,
and -S option) to stap command, and change manpages and NEWS.
- Both of -F and -o is specified, stap passes -D option to staprun.
- stap just passes -S option to staprun.
-rw-r--r-- | NEWS | 17 | ||||
-rw-r--r-- | buildrun.cxx | 5 | ||||
-rw-r--r-- | main.cxx | 10 | ||||
-rw-r--r-- | session.h | 1 | ||||
-rw-r--r-- | stap.1.in | 16 | ||||
-rw-r--r-- | staprun.8.in | 15 |
6 files changed, 57 insertions, 7 deletions
@@ -1,5 +1,22 @@ * What's new +- On-file flight recorder is supported. It allows stap to record huge + trace log on the disk and to run in background. + Passing -F option with -o option runs stap in background mode. In this + mode, staprun is detached from console, and stap itself shows staprun's + pid and exits. + Specifying the max size and the max number of log files are also available + by passing -S option. This option has one or two arguments seperated by + a comma. The first argument is the max size of a log file in MB. If the + size of a log file exceeds it, stap switches to the next log file + automatically. The second is how many files are kept on the disk. If the + number of log files exceeds it, the oldest log file is removed + automatically. The second argument can be omitted. + + For example, this will record output on log files each of them is smaller + than 1024MB and keep last 3 logs, in background. + % stap -F -o /tmp/staplog -S 1024,3 script.stp + - In guru mode (-g), the kernel probing blacklist is disabled, leaving only a subset - the kernel's own internal kprobe blacklist - to attempt to filter out areas unsafe to probe. The differences may be enough to diff --git a/buildrun.cxx b/buildrun.cxx index 0e9e0e17..e3634545 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -329,7 +329,10 @@ run_pass (systemtap_session& s) staprun_cmd += "-u "; if (s.load_only) - staprun_cmd += "-L "; + staprun_cmd += (s.output_file.empty() ? "-L " : "-D "); + + if (!s.size_option.empty()) + staprun_cmd += "-S " + s.size_option + " "; staprun_cmd += s.tmpdir + "/" + s.module_name + ".ko"; @@ -111,7 +111,9 @@ usage (systemtap_session& s, int exitcode) << " -o FILE send script output to file, instead of stdout" << endl << " -c CMD start the probes, run CMD, and exit when it finishes" << endl << " -x PID sets target() to PID" << endl - << " -F load module and start probes, then detach" << endl + << " -F run as on-file flight recorder with -o." << endl + << " run as on-memory flight recorder without -o." << endl + << " -S size[,n] set maximum of the size and the number of files." << endl << " -d OBJECT add unwind/symbol data for OBJECT file"; if (s.unwindsym_modules.size() == 0) clog << endl; @@ -444,7 +446,7 @@ main (int argc, char * const argv []) { "vp", 1, &long_opt, LONG_OPT_VERBOSE_PASS }, { NULL, 0, NULL, 0 } }; - int grc = getopt_long (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uqwl:d:L:F", + int grc = getopt_long (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uqwl:d:L:FS:", long_options, NULL); if (grc < 0) break; @@ -628,6 +630,10 @@ main (int argc, char * const argv []) s.macros.push_back (string (optarg)); break; + case 'S': + s.size_option = string (optarg); + break; + case 'q': s.tapset_compile_coverage = true; break; @@ -90,6 +90,7 @@ struct systemtap_session std::string module_name; std::string stapconf_name; std::string output_file; + std::string size_option; std::string cmd; int target_pid; int last_pass; @@ -175,7 +175,7 @@ even if they do not have an explicit probe placed into them. .TP .BI \-o " FILE" Send standard output to named file. In bulk mode, percpu files will -start with FILE_ followed by the cpu number. +start with FILE_ (FILE_cpu with -F) followed by the cpu number. .TP .BI \-c " CMD" Start the probes, run CMD, and exit when CMD finishes. @@ -193,8 +193,18 @@ and aliases. Similar to "-l", but list probe points and script-level local variables. .TP .BI \-F -Load module and start probes, then detach from the module leaving the -probes running. +Without -o option, load module and start probes, then detach from the module +leaving the probes running. +With -o option, run staprun in background as a daemon and show it's pid. +.TP +.BI \-S " size[,N]" +Sets the maximum size of output file and the maximum number of output files. +If the size of output file will exceed +.B size +, systemtap switches output file to the next file. And if the number of +output files exceed +.B N +, systemtap removes the oldest output file. You can omit the second argument. .TP .B \-\-kelf For names and addresses of functions to probe, diff --git a/staprun.8.in b/staprun.8.in index c7e77dc4..68b5c947 100644 --- a/staprun.8.in +++ b/staprun.8.in @@ -52,7 +52,8 @@ The '_stp_target' variable will be set to PID. .TP .B \-o FILE Send output to FILE. If the module uses bulk mode, the output will -be in percpu files FILE_x where 'x' is the cpu number. +be in percpu files FILE_x(FILE_cpux in backgroud and bulk mode) +where 'x' is the cpu number. .TP .B \-b BUFFER_SIZE The systemtap module will specify a buffer size. @@ -73,6 +74,18 @@ Attach to loaded systemtap module. Delete a module. Only detached or unused modules the user has permission to access will be deleted. Use "*" (quoted) to delete all unused modules. +.TP +.BI \-D +Run staprun in background as a daemon and show it's pid. +.TP +.BI \-S " size[,N]" +Sets the maximum size of output file and the maximum number of output files. +If the size of output file will exceed +.B size +, systemtap switches output file to the next file. And if the number of +output files exceed +.B N +, systemtap removes the oldest output file. You can omit the second argument. .SH ARGUMENTS .B MODULE |