[PATCH 3/3] perf: Fix the bug which fails to put memory mapping to record file

Gui Jianfeng
2010-06-25T02:20:27Z

If we execute perf record without -t or -p option, it fails to load
process memory map to record file. Here fix it.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
tools/perf/builtin-record.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 84d58b7..f834d21 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -685,9 +685,19 @@ static int __cmd_record(int argc, const char **argv)
if (perf_guest)
perf_session__process_machines(session, event__synthesize_guest_os);

- if (!system_wide && profile_cpu == -1)
- event__synthesize_thread(target_tid, process_synthesized_event,
- session);
+ if (!system_wide && profile_cpu == -1) {
+ int ret;
+
+ if (target_tid != -1) {
+ ret = event__synthesize_thread(target_tid,
+ process_synthesized_event,
+ session);
+ } else {
+ ret = event__synthesize_thread(all_tids[0],
+ process_synthesized_event,
+ session);
+ }
+ }
else
event__synthesize_threads(process_synthesized_event, session);

-- 1.6.5.2