aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-11-10 22:51:03 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-11 01:30:17 -0500
commit8671dab9d5b2f0b444b8d09792384dccbfd43d14 (patch)
tree399d45fd784e7210bc1847ab2643731243f67f1d /tools/perf/builtin-record.c
parentde8967214d8ce536161a1ad6538ad1cb82e7428d (diff)
perf tools: Move the build-id storage operations to headers
So that it makes easier to control it. Especially because we plan to give it a feature section. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> LKML-Reference: <1257911467-28276-2-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 9f98b86e747c..c35e61b30988 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -378,39 +378,11 @@ static void open_counters(int cpu, pid_t pid)
378 nr_cpu++; 378 nr_cpu++;
379} 379}
380 380
381static bool write_buildid_table(void)
382{
383 struct dso *pos;
384 bool have_buildid = false;
385
386 list_for_each_entry(pos, &dsos, node) {
387 struct build_id_event b;
388 size_t len;
389
390 if (filename__read_build_id(pos->long_name,
391 &b.build_id,
392 sizeof(b.build_id)) < 0)
393 continue;
394 have_buildid = true;
395 memset(&b.header, 0, sizeof(b.header));
396 len = strlen(pos->long_name) + 1;
397 len = ALIGN(len, 64);
398 b.header.size = sizeof(b) + len;
399 write_output(&b, sizeof(b));
400 write_output(pos->long_name, len);
401 }
402
403 return have_buildid;
404}
405
406static void atexit_header(void) 381static void atexit_header(void)
407{ 382{
408 header->data_size += bytes_written; 383 header->data_size += bytes_written;
409 384
410 if (write_buildid_table()) 385 perf_header__write(header, output, true);
411 perf_header__set_feat(header, HEADER_BUILD_ID);
412
413 perf_header__write(header, output);
414} 386}
415 387
416static int __cmd_record(int argc, const char **argv) 388static int __cmd_record(int argc, const char **argv)
@@ -487,7 +459,7 @@ static int __cmd_record(int argc, const char **argv)
487 } 459 }
488 460
489 if (file_new) 461 if (file_new)
490 perf_header__write(header, output); 462 perf_header__write(header, output, false);
491 463
492 if (!system_wide) 464 if (!system_wide)
493 event__synthesize_thread(pid, process_synthesized_event); 465 event__synthesize_thread(pid, process_synthesized_event);