diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-12-15 19:07:16 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-12-15 19:07:16 -0500 |
commit | a2fc047f34a527af7cc313a1f094ffa86e9cbc16 (patch) | |
tree | 10aa96dce3eb4706311c614f4d8e0517692659eb /trace-cmd.c | |
parent | 5c5678691b5e7ced2ff9b4cfa0aa8ea74cb3616d (diff) |
trace-cmd: Add sleep_time between splice reads
I found that tracing few events causes trace-cmd to almost spin
in a busy loop since it can constantly read a page, and the process
of reading that page causes it to run again. We end up just causing
events to read.
This adds a -s sleep time option that forces trace-cmd to sleep.
The default is 1ms. But it can be disabled with 0.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-cmd.c')
-rw-r--r-- | trace-cmd.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/trace-cmd.c b/trace-cmd.c index 0d53e8c..92008cd 100644 --- a/trace-cmd.c +++ b/trace-cmd.c | |||
@@ -51,7 +51,7 @@ unsigned int page_size; | |||
51 | static const char *output_file = "trace.dat"; | 51 | static const char *output_file = "trace.dat"; |
52 | 52 | ||
53 | static int latency; | 53 | static int latency; |
54 | 54 | static int sleep_time = 1000; | |
55 | static int cpu_count; | 55 | static int cpu_count; |
56 | static int *pids; | 56 | static int *pids; |
57 | 57 | ||
@@ -568,7 +568,7 @@ static int create_recorder(int cpu) | |||
568 | 568 | ||
569 | if (!recorder) | 569 | if (!recorder) |
570 | die ("can't create recorder"); | 570 | die ("can't create recorder"); |
571 | tracecmd_start_recording(recorder); | 571 | tracecmd_start_recording(recorder, sleep_time); |
572 | tracecmd_free_recorder(recorder); | 572 | tracecmd_free_recorder(recorder); |
573 | 573 | ||
574 | exit(0); | 574 | exit(0); |
@@ -631,12 +631,13 @@ void usage(char **argv) | |||
631 | printf("\n" | 631 | printf("\n" |
632 | "%s version %s\n\n" | 632 | "%s version %s\n\n" |
633 | "usage:\n" | 633 | "usage:\n" |
634 | " %s record [-e event][-p plugin] [-d] [-o file] [-O option ] [command ...]\n" | 634 | " %s record [-e event][-p plugin][-d][-o file][-s usecs][-O option ] [command ...]\n" |
635 | " -e run command with event enabled\n" | 635 | " -e run command with event enabled\n" |
636 | " -p run command with plugin enabled\n" | 636 | " -p run command with plugin enabled\n" |
637 | " -d disable function tracer when running\n" | 637 | " -d disable function tracer when running\n" |
638 | " -o data output file [default trace.dat]\n" | 638 | " -o data output file [default trace.dat]\n" |
639 | " -O option to enable (or disable)\n" | 639 | " -O option to enable (or disable)\n" |
640 | " -s sleep interval between recording (in usecs) [default: 1000]\n" | ||
640 | "\n" | 641 | "\n" |
641 | " %s start [-e event][-p plugin] [-d] [-O option ]\n" | 642 | " %s start [-e event][-p plugin] [-d] [-O option ]\n" |
642 | " Uses same options as record, but does not run a command.\n" | 643 | " Uses same options as record, but does not run a command.\n" |
@@ -726,6 +727,9 @@ int main (int argc, char **argv) | |||
726 | option = optarg; | 727 | option = optarg; |
727 | set_option(option); | 728 | set_option(option); |
728 | break; | 729 | break; |
730 | case 's': | ||
731 | sleep_time = atoi(optarg); | ||
732 | break; | ||
729 | } | 733 | } |
730 | } | 734 | } |
731 | 735 | ||