aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-20 09:58:01 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-20 11:36:49 -0400
commite33e0a43736307512422e41aee6e24d5a8c39181 (patch)
treeb1ae3e3287d51dfc33a33724eb00712496b13900 /Documentation
parent1d8c8b209e9351a7de1307d7b9b6df4222b8d742 (diff)
perf_counter tools: add 'perf record' command
Move perf-record.c into the perf suite of commands. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/perf_counter/Documentation/perf-record.txt63
-rw-r--r--Documentation/perf_counter/Makefile1
-rw-r--r--Documentation/perf_counter/builtin-record.c (renamed from Documentation/perf_counter/perf-record.c)30
-rw-r--r--Documentation/perf_counter/builtin.h3
-rw-r--r--Documentation/perf_counter/command-list.txt3
-rw-r--r--Documentation/perf_counter/perf.c3
6 files changed, 73 insertions, 30 deletions
diff --git a/Documentation/perf_counter/Documentation/perf-record.txt b/Documentation/perf_counter/Documentation/perf-record.txt
new file mode 100644
index 000000000000..d07700e35eb2
--- /dev/null
+++ b/Documentation/perf_counter/Documentation/perf-record.txt
@@ -0,0 +1,63 @@
1perf-record(1)
2==========
3
4NAME
5----
6perf-record - Run a command and record its profile into output.perf
7
8SYNOPSIS
9--------
10[verse]
11'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command>
12
13DESCRIPTION
14-----------
15This command runs a command and gathers a performance counter profile
16from it, into output.perf - without displaying anything.
17
18This file can then be inspected later on, using 'perf report'.
19
20
21OPTIONS
22-------
23<command>...::
24 Any command you can specify in a shell.
25
26-e::
27--event=::
28 0:0: cpu-cycles
29 0:0: cycles
30 0:1: instructions
31 0:2: cache-references
32 0:3: cache-misses
33 0:4: branch-instructions
34 0:4: branches
35 0:5: branch-misses
36 0:6: bus-cycles
37 1:0: cpu-clock
38 1:1: task-clock
39 1:2: page-faults
40 1:2: faults
41 1:5: minor-faults
42 1:6: major-faults
43 1:3: context-switches
44 1:3: cs
45 1:4: cpu-migrations
46 1:4: migrations
47 rNNN: raw PMU events (eventsel+umask)
48
49-a::
50 system-wide collection
51
52-l::
53 scale counter values
54
55Configuration
56-------------
57
58EXAMPLES
59--------
60
61SEE ALSO
62--------
63linkperf:git-stat[1]
diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile
index fb8b71744e59..b6c665eb22e4 100644
--- a/Documentation/perf_counter/Makefile
+++ b/Documentation/perf_counter/Makefile
@@ -309,6 +309,7 @@ LIB_OBJS += usage.o
309LIB_OBJS += wrapper.o 309LIB_OBJS += wrapper.o
310 310
311BUILTIN_OBJS += builtin-help.o 311BUILTIN_OBJS += builtin-help.o
312BUILTIN_OBJS += builtin-record.o
312BUILTIN_OBJS += builtin-stat.o 313BUILTIN_OBJS += builtin-stat.o
313BUILTIN_OBJS += builtin-top.o 314BUILTIN_OBJS += builtin-top.o
314 315
diff --git a/Documentation/perf_counter/perf-record.c b/Documentation/perf_counter/builtin-record.c
index 614de7c468b2..4a50abf843ee 100644
--- a/Documentation/perf_counter/perf-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -81,16 +81,12 @@
81 (void) (&_min1 == &_min2); \ 81 (void) (&_min1 == &_min2); \
82 _min1 < _min2 ? _min1 : _min2; }) 82 _min1 < _min2 ? _min1 : _min2; })
83 83
84asmlinkage int sys_perf_counter_open( 84extern asmlinkage int sys_perf_counter_open(
85 struct perf_counter_hw_event *hw_event_uptr __user, 85 struct perf_counter_hw_event *hw_event_uptr __user,
86 pid_t pid, 86 pid_t pid,
87 int cpu, 87 int cpu,
88 int group_fd, 88 int group_fd,
89 unsigned long flags) 89 unsigned long flags);
90{
91 return syscall(
92 __NR_perf_counter_open, hw_event_uptr, pid, cpu, group_fd, flags);
93}
94 90
95#define MAX_COUNTERS 64 91#define MAX_COUNTERS 64
96#define MAX_NR_CPUS 256 92#define MAX_NR_CPUS 256
@@ -119,26 +115,6 @@ const unsigned int default_count[] = {
119 10000, 115 10000,
120}; 116};
121 117
122static char *hw_event_names[] = {
123 "CPU cycles",
124 "instructions",
125 "cache references",
126 "cache misses",
127 "branches",
128 "branch misses",
129 "bus cycles",
130};
131
132static char *sw_event_names[] = {
133 "cpu clock ticks",
134 "task clock ticks",
135 "pagefaults",
136 "context switches",
137 "CPU migrations",
138 "minor faults",
139 "major faults",
140};
141
142struct event_symbol { 118struct event_symbol {
143 __u64 event; 119 __u64 event;
144 char *symbol; 120 char *symbol;
@@ -414,7 +390,7 @@ static void sigchld_handler(int sig)
414 done = 1; 390 done = 1;
415} 391}
416 392
417int main(int argc, char *argv[]) 393int cmd_record(int argc, const char **argv)
418{ 394{
419 struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS]; 395 struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS];
420 struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS]; 396 struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
diff --git a/Documentation/perf_counter/builtin.h b/Documentation/perf_counter/builtin.h
index 605323c691f1..5854b1715f54 100644
--- a/Documentation/perf_counter/builtin.h
+++ b/Documentation/perf_counter/builtin.h
@@ -14,6 +14,7 @@ extern void prune_packed_objects(int);
14extern int read_line_with_nul(char *buf, int size, FILE *file); 14extern int read_line_with_nul(char *buf, int size, FILE *file);
15extern int check_pager_config(const char *cmd); 15extern int check_pager_config(const char *cmd);
16 16
17extern int cmd_top(int argc, const char **argv, const char *prefix); 17extern int cmd_record(int argc, const char **argv, const char *prefix);
18extern int cmd_stat(int argc, const char **argv, const char *prefix); 18extern int cmd_stat(int argc, const char **argv, const char *prefix);
19extern int cmd_top(int argc, const char **argv, const char *prefix);
19#endif 20#endif
diff --git a/Documentation/perf_counter/command-list.txt b/Documentation/perf_counter/command-list.txt
index 52455d46bfb5..d15210aa0cae 100644
--- a/Documentation/perf_counter/command-list.txt
+++ b/Documentation/perf_counter/command-list.txt
@@ -1,5 +1,6 @@
1# List of known perf commands. 1# List of known perf commands.
2# command name category [deprecated] [common] 2# command name category [deprecated] [common]
3perf-top mainporcelain common 3perf-record mainporcelain common
4perf-stat mainporcelain common 4perf-stat mainporcelain common
5perf-top mainporcelain common
5 6
diff --git a/Documentation/perf_counter/perf.c b/Documentation/perf_counter/perf.c
index ff8658f2a2f1..e849dd66b5ef 100644
--- a/Documentation/perf_counter/perf.c
+++ b/Documentation/perf_counter/perf.c
@@ -248,8 +248,9 @@ static void handle_internal_command(int argc, const char **argv)
248{ 248{
249 const char *cmd = argv[0]; 249 const char *cmd = argv[0];
250 static struct cmd_struct commands[] = { 250 static struct cmd_struct commands[] = {
251 { "top", cmd_top, 0 }, 251 { "record", cmd_record, 0 },
252 { "stat", cmd_stat, 0 }, 252 { "stat", cmd_stat, 0 },
253 { "top", cmd_top, 0 },
253 }; 254 };
254 int i; 255 int i;
255 static const char ext[] = STRIP_EXTENSION; 256 static const char ext[] = STRIP_EXTENSION;