linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
	Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 04/38] perf record: Remove old evsel_list usage
Date: Mon, 13 Jan 2014 17:47:05 -0300	[thread overview]
Message-ID: <1389646059-24881-5-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1389646059-24881-1-git-send-email-acme@infradead.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

To be consistent with other places, use just 'evlist' for the evsel list
variable, and since we have it in 'struct record', use it directly from
there.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-396bnfvmlxrsj3o2tk47b8t1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 43 +++++++++++++++++++------------------------
 1 file changed, 19 insertions(+), 24 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ea7c3060e8e7..6dcb8aae908c 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -324,7 +324,6 @@ out:
 
 static void record__init_features(struct record *rec)
 {
-	struct perf_evlist *evsel_list = rec->evlist;
 	struct perf_session *session = rec->session;
 	int feat;
 
@@ -334,7 +333,7 @@ static void record__init_features(struct record *rec)
 	if (rec->no_buildid)
 		perf_header__clear_feat(&session->header, HEADER_BUILD_ID);
 
-	if (!have_tracepoints(&evsel_list->entries))
+	if (!have_tracepoints(&rec->evlist->entries))
 		perf_header__clear_feat(&session->header, HEADER_TRACING_DATA);
 
 	if (!rec->opts.branch_stack)
@@ -365,7 +364,6 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 	struct machine *machine;
 	struct perf_tool *tool = &rec->tool;
 	struct record_opts *opts = &rec->opts;
-	struct perf_evlist *evsel_list = rec->evlist;
 	struct perf_data_file *file = &rec->file;
 	struct perf_session *session;
 	bool disabled = false;
@@ -388,7 +386,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 	record__init_features(rec);
 
 	if (forks) {
-		err = perf_evlist__prepare_workload(evsel_list, &opts->target,
+		err = perf_evlist__prepare_workload(rec->evlist, &opts->target,
 						    argv, file->is_pipe,
 						    workload_exec_failed_signal);
 		if (err < 0) {
@@ -402,7 +400,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 		goto out_delete_session;
 	}
 
-	if (!evsel_list->nr_groups)
+	if (!rec->evlist->nr_groups)
 		perf_header__clear_feat(&session->header, HEADER_GROUP_DESC);
 
 	/*
@@ -415,7 +413,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 		if (err < 0)
 			goto out_delete_session;
 	} else {
-		err = perf_session__write_header(session, evsel_list,
+		err = perf_session__write_header(session, rec->evlist,
 						 file->fd, false);
 		if (err < 0)
 			goto out_delete_session;
@@ -439,7 +437,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 			goto out_delete_session;
 		}
 
-		if (have_tracepoints(&evsel_list->entries)) {
+		if (have_tracepoints(&rec->evlist->entries)) {
 			/*
 			 * FIXME err <= 0 here actually means that
 			 * there were no tracepoints so its not really
@@ -448,7 +446,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 			 * return this more properly and also
 			 * propagate errors that now are calling die()
 			 */
-			err = perf_event__synthesize_tracing_data(tool, file->fd, evsel_list,
+			err = perf_event__synthesize_tracing_data(tool, file->fd, rec->evlist,
 								  process_synthesized_event);
 			if (err <= 0) {
 				pr_err("Couldn't record tracing data.\n");
@@ -480,7 +478,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 					 perf_event__synthesize_guest_os, tool);
 	}
 
-	err = __machine__synthesize_threads(machine, tool, &opts->target, evsel_list->threads,
+	err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
 					    process_synthesized_event, opts->sample_address);
 	if (err != 0)
 		goto out_delete_session;
@@ -502,13 +500,13 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 	 * so don't spoil it by prematurely enabling them.
 	 */
 	if (!target__none(&opts->target))
-		perf_evlist__enable(evsel_list);
+		perf_evlist__enable(rec->evlist);
 
 	/*
 	 * Let the child rip
 	 */
 	if (forks)
-		perf_evlist__start_workload(evsel_list);
+		perf_evlist__start_workload(rec->evlist);
 
 	for (;;) {
 		int hits = rec->samples;
@@ -521,7 +519,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 		if (hits == rec->samples) {
 			if (done)
 				break;
-			err = poll(evsel_list->pollfd, evsel_list->nr_fds, -1);
+			err = poll(rec->evlist->pollfd, rec->evlist->nr_fds, -1);
 			waking++;
 		}
 
@@ -531,7 +529,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 		 * disable events in this case.
 		 */
 		if (done && !disabled && !target__none(&opts->target)) {
-			perf_evlist__disable(evsel_list);
+			perf_evlist__disable(rec->evlist);
 			disabled = true;
 		}
 	}
@@ -901,16 +899,13 @@ const struct option record_options[] = {
 int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	int err = -ENOMEM;
-	struct perf_evlist *evsel_list;
 	struct record *rec = &record;
 	char errbuf[BUFSIZ];
 
-	evsel_list = perf_evlist__new();
-	if (evsel_list == NULL)
+	rec->evlist = perf_evlist__new();
+	if (rec->evlist == NULL)
 		return -ENOMEM;
 
-	rec->evlist = evsel_list;
-
 	argc = parse_options(argc, argv, record_options, record_usage,
 			    PARSE_OPT_STOP_AT_NON_OPTION);
 	if (!argc && target__none(&rec->opts.target))
@@ -937,8 +932,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (rec->no_buildid_cache || rec->no_buildid)
 		disable_buildid_cache();
 
-	if (evsel_list->nr_entries == 0 &&
-	    perf_evlist__add_default(evsel_list) < 0) {
+	if (rec->evlist->nr_entries == 0 &&
+	    perf_evlist__add_default(rec->evlist) < 0) {
 		pr_err("Not enough memory for event selector list\n");
 		goto out_symbol_exit;
 	}
@@ -964,7 +959,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
 	}
 
 	err = -ENOMEM;
-	if (perf_evlist__create_maps(evsel_list, &rec->opts.target) < 0)
+	if (perf_evlist__create_maps(rec->evlist, &rec->opts.target) < 0)
 		usage_with_options(record_usage, record_options);
 
 	if (record_opts__config(&rec->opts)) {
@@ -974,10 +969,10 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	err = __cmd_record(&record, argc, argv);
 
-	perf_evlist__munmap(evsel_list);
-	perf_evlist__close(evsel_list);
+	perf_evlist__munmap(rec->evlist);
+	perf_evlist__close(rec->evlist);
 out_free_fd:
-	perf_evlist__delete_maps(evsel_list);
+	perf_evlist__delete_maps(rec->evlist);
 out_symbol_exit:
 	symbol__exit();
 	return err;
-- 
1.8.1.4


  parent reply	other threads:[~2014-01-13 20:48 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 20:47 [GIT PULL 00/38] perf/core improvements and fixes Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 01/38] perf stat: Don't show counter information when workload fails Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 02/38] perf evlist: Send the errno in the signal " Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 03/38] perf evlist: Move the SIGUSR1 error reporting logic to prepare_workload Arnaldo Carvalho de Melo
2014-01-13 20:47 ` Arnaldo Carvalho de Melo [this message]
2014-01-13 20:47 ` [PATCH 05/38] perf evlist: Move destruction of maps to evlist destructor Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 06/38] perf evlist: Close fds on destructor Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 07/38] perf evlist: Auto unmap " Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 08/38] perf tests: Fixup leak on error path in parse events test Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 09/38] perf stat: Remove misplaced __maybe_unused Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 10/38] perf tools: Move arch setup into seprate Makefile Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 11/38] perf tests: Fix installation tests path setup Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 12/38] tools lib traceevent: Replace tabs with spaces for all non-commands statements Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 13/38] tools lib traceevent: Shut up plugins make message Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 14/38] perf header: Pack 'struct perf_session_env' Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 15/38] perf trace: Pack 'struct trace' Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 16/38] perf tools: Automate setup of FEATURE_CHECK_(C|LD)FLAGS-all variables Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 17/38] perf machine: Fix id_hdr_size initialization Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 18/38] perf tools: Make perf_event__synthesize_mmap_events global Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 19/38] perf stat: Fix --delay option in man page Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 20/38] tools perf: Comment typo fix Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 21/38] perf report: Move logic to warn about kptr_restrict'ed kernels to separate function Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 22/38] perf report: Move hist browser selection code " Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 23/38] perf report: Move histogram entries collapsing " Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 24/38] perf evlist: Introduce evlist__for_each() & friends Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 25/38] tools include: Move perf's linux/compiler.h to a generic place Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 26/38] tools include: Define likely/unlikely in linux/compiler.h Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 27/38] tools include: Move perf's bug.h to a generic place Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 28/38] perf tools: Include tools/lib/api/ in MANIFEST Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 29/38] perf tools: Add test for building detached source tarballs Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 30/38] perf tools: Use the DWARF unwind info only if loaded Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 31/38] perf record: Add --initial-delay option Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 32/38] tools include: Include <linux/compiler.h> from asm/bug.h Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 33/38] perf tools: Generalize percent_color_snprintf() Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 34/38] perf diff: Color the Delta column Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 35/38] perf diff: Color the Ratio column Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 36/38] perf diff: Color the Weighted Diff column Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 37/38] perf probe: Fix build when DWARF support libraries not present Arnaldo Carvalho de Melo
2014-01-13 20:47 ` [PATCH 38/38] perf tools: Remove unused test-volatile-register-var.c Arnaldo Carvalho de Melo
2014-01-14 13:41 ` [GIT PULL 00/38] perf/core improvements and fixes Ingo Molnar
2014-01-14 14:03   ` Arnaldo Carvalho de Melo
2014-01-14 16:24     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389646059-24881-5-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).