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

From: Gui Jianfeng
Date: Thu Jun 24 2010 - 22:20:30 EST


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@xxxxxxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/