Re: [PATCH 2/9] perf top: make use of perf_record_opts
On 10/30/12 1:27 AM, Namhyung Kim wrote: On Mon, 29 Oct 2012 10:31:42 -0600, David Ahern wrote: Changes top code to use the perf_record_opts struct. Stepping stone to consolidating the open counters code. Maybe time to rename perf_record_opts to perf_open_opts or just perf_opts? It's still the record time opts. Either way, a rename is for a different patch series. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/9] perf top: make use of perf_record_opts
On Mon, 29 Oct 2012 10:31:42 -0600, David Ahern wrote: > Changes top code to use the perf_record_opts struct. Stepping stone to > consolidating the open counters code. Maybe time to rename perf_record_opts to perf_open_opts or just perf_opts? Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/9] perf top: make use of perf_record_opts
Changes top code to use the perf_record_opts struct. Stepping stone to consolidating the open counters code. Signed-off-by: David Ahern Cc: Arnaldo Carvalho de Melo Cc: Ingo Molnar Cc: Frederic Weisbecker Cc: Peter Zijlstra --- tools/perf/builtin-top.c | 84 -- tools/perf/util/top.c| 20 +-- tools/perf/util/top.h|9 + 3 files changed, 54 insertions(+), 59 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index f2ecd49..a6954ba8 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -591,7 +591,7 @@ static void *display_thread_tui(void *arg) * via --uid. */ list_for_each_entry(pos, &top->evlist->entries, node) - pos->hists.uid_filter_str = top->target.uid_str; + pos->hists.uid_filter_str = top->opts.target.uid_str; perf_evlist__tui_browse_hists(top->evlist, help, perf_top__sort_new_samples, @@ -891,7 +891,7 @@ static void perf_top__start_counters(struct perf_top *top) struct perf_evsel *counter; struct perf_evlist *evlist = top->evlist; - if (top->group) + if (top->opts.group) perf_evlist__set_leader(evlist); list_for_each_entry(counter, &evlist->entries, node) { @@ -899,10 +899,10 @@ static void perf_top__start_counters(struct perf_top *top) attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; - if (top->freq) { + if (top->opts.freq) { attr->sample_type |= PERF_SAMPLE_PERIOD; attr->freq= 1; - attr->sample_freq = top->freq; + attr->sample_freq = top->opts.freq; } if (evlist->nr_entries > 1) { @@ -910,7 +910,7 @@ static void perf_top__start_counters(struct perf_top *top) attr->read_format |= PERF_FORMAT_ID; } - if (perf_target__has_cpu(&top->target)) + if (perf_target__has_cpu(&top->opts.target)) attr->sample_type |= PERF_SAMPLE_CPU; if (symbol_conf.use_callchain) @@ -918,12 +918,12 @@ static void perf_top__start_counters(struct perf_top *top) attr->mmap = 1; attr->comm = 1; - attr->inherit = top->inherit; + attr->inherit = !top->opts.no_inherit; fallback_missing_features: - if (top->exclude_guest_missing) + if (top->opts.exclude_guest_missing) attr->exclude_guest = attr->exclude_host = 0; retry_sample_id: - attr->sample_id_all = top->sample_id_all_missing ? 0 : 1; + attr->sample_id_all = top->opts.sample_id_all_missing ? 0 : 1; try_again: if (perf_evsel__open(counter, top->evlist->cpus, top->evlist->threads) < 0) { @@ -933,17 +933,17 @@ try_again: ui__error_paranoid(); goto out_err; } else if (err == EINVAL) { - if (!top->exclude_guest_missing && + if (!top->opts.exclude_guest_missing && (attr->exclude_guest || attr->exclude_host)) { pr_debug("Old kernel, cannot exclude " "guest or host samples.\n"); - top->exclude_guest_missing = true; + top->opts.exclude_guest_missing = true; goto fallback_missing_features; - } else if (!top->sample_id_all_missing) { + } else if (!top->opts.sample_id_all_missing) { /* * Old kernel, no attr->sample_id_type_all field */ - top->sample_id_all_missing = true; + top->opts.sample_id_all_missing = true; goto retry_sample_id; } } @@ -992,7 +992,7 @@ try_again: } } - if (perf_evlist__mmap(evlist, top->mmap_pages, false) < 0) { + if (perf_evlist__mmap(evlist, top->opts.mmap_pages, false) < 0) { ui__error("Failed to mmap with %d (%s)\n", errno, strerror(errno)); goto out_err; @@ -1038,7 +1038,7 @@ static int __cmd_top(struct perf_top *top) if (ret) goto out_delete; - if (perf_target__has_task(&top->target)) + if (perf_target__has_task(&top->opts.target))
[PATCH 2/9] perf top: make use of perf_record_opts
Changes top code to use the perf_record_opts struct. Stepping stone to consolidating the open counters code. Signed-off-by: David Ahern Cc: Arnaldo Carvalho de Melo Cc: Ingo Molnar Cc: Frederic Weisbecker Cc: Peter Zijlstra --- tools/perf/builtin-top.c | 84 -- tools/perf/util/top.c| 20 +-- tools/perf/util/top.h|9 + 3 files changed, 54 insertions(+), 59 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index fb9da71..33c3825 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -591,7 +591,7 @@ static void *display_thread_tui(void *arg) * via --uid. */ list_for_each_entry(pos, &top->evlist->entries, node) - pos->hists.uid_filter_str = top->target.uid_str; + pos->hists.uid_filter_str = top->opts.target.uid_str; perf_evlist__tui_browse_hists(top->evlist, help, perf_top__sort_new_samples, @@ -891,7 +891,7 @@ static void perf_top__start_counters(struct perf_top *top) struct perf_evsel *counter; struct perf_evlist *evlist = top->evlist; - if (top->group) + if (top->opts.group) perf_evlist__set_leader(evlist); list_for_each_entry(counter, &evlist->entries, node) { @@ -899,10 +899,10 @@ static void perf_top__start_counters(struct perf_top *top) attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; - if (top->freq) { + if (top->opts.freq) { attr->sample_type |= PERF_SAMPLE_PERIOD; attr->freq= 1; - attr->sample_freq = top->freq; + attr->sample_freq = top->opts.freq; } if (evlist->nr_entries > 1) { @@ -910,7 +910,7 @@ static void perf_top__start_counters(struct perf_top *top) attr->read_format |= PERF_FORMAT_ID; } - if (perf_target__has_cpu(&top->target)) + if (perf_target__has_cpu(&top->opts.target)) attr->sample_type |= PERF_SAMPLE_CPU; if (symbol_conf.use_callchain) @@ -918,12 +918,12 @@ static void perf_top__start_counters(struct perf_top *top) attr->mmap = 1; attr->comm = 1; - attr->inherit = top->inherit; + attr->inherit = !top->opts.no_inherit; fallback_missing_features: - if (top->exclude_guest_missing) + if (top->opts.exclude_guest_missing) attr->exclude_guest = attr->exclude_host = 0; retry_sample_id: - attr->sample_id_all = top->sample_id_all_missing ? 0 : 1; + attr->sample_id_all = top->opts.sample_id_all_missing ? 0 : 1; try_again: if (perf_evsel__open(counter, top->evlist->cpus, top->evlist->threads) < 0) { @@ -933,17 +933,17 @@ try_again: ui__error_paranoid(); goto out_err; } else if (err == EINVAL) { - if (!top->exclude_guest_missing && + if (!top->opts.exclude_guest_missing && (attr->exclude_guest || attr->exclude_host)) { pr_debug("Old kernel, cannot exclude " "guest or host samples.\n"); - top->exclude_guest_missing = true; + top->opts.exclude_guest_missing = true; goto fallback_missing_features; - } else if (!top->sample_id_all_missing) { + } else if (!top->opts.sample_id_all_missing) { /* * Old kernel, no attr->sample_id_type_all field */ - top->sample_id_all_missing = true; + top->opts.sample_id_all_missing = true; goto retry_sample_id; } } @@ -988,7 +988,7 @@ try_again: } } - if (perf_evlist__mmap(evlist, top->mmap_pages, false) < 0) { + if (perf_evlist__mmap(evlist, top->opts.mmap_pages, false) < 0) { ui__error("Failed to mmap with %d (%s)\n", errno, strerror(errno)); goto out_err; @@ -1034,7 +1034,7 @@ static int __cmd_top(struct perf_top *top) if (ret) goto out_delete; - if (perf_target__has_task(&top->target)) + if (perf_target__has_task(&top->opts.target))