mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <jolsa@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
	hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl,
	namhyung.kim@lge.com, jolsa@redhat.com, fweisbec@gmail.com,
	tglx@linutronix.de, cjashfor@linux.vnet.ibm.com, mingo@elte.hu
Subject: [tip:perf/core] perf tests: Factor attr tests WRITE_ASS macro
Date: Tue, 13 Nov 2012 23:26:11 -0800	[thread overview]
Message-ID: <tip-89f552d684925ef9f1dca8b4b2b18fb981dc3d8c@git.kernel.org> (raw)
In-Reply-To: <1352130579-13451-3-git-send-email-jolsa@redhat.com>

Commit-ID:  89f552d684925ef9f1dca8b4b2b18fb981dc3d8c
Gitweb:     http://git.kernel.org/tip/89f552d684925ef9f1dca8b4b2b18fb981dc3d8c
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Mon, 5 Nov 2012 16:49:37 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:03:59 -0300

perf tests: Factor attr tests WRITE_ASS macro

Changing WRITE_ASS macro per Namhyung's comments, so the main usage case
takes only attr field name and format string.

Suggested-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1352130579-13451-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr.c |   89 ++++++++++++++++++++++++-----------------------
 1 files changed, 45 insertions(+), 44 deletions(-)

diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index aacad82..1389d69 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -44,7 +44,7 @@ void test_attr__init(void)
 
 #define BUFSIZE 1024
 
-#define WRITE_ASS(str, fmt, data)					\
+#define __WRITE_ASS(str, fmt, data)					\
 do {									\
 	char buf[BUFSIZE];						\
 	size_t size;							\
@@ -58,6 +58,8 @@ do {									\
 									\
 } while (0)
 
+#define WRITE_ASS(field, fmt) __WRITE_ASS(field, fmt, attr->field)
+
 static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
 		       int fd, int group_fd, unsigned long flags)
 {
@@ -81,51 +83,50 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
 	}
 
 	/* syscall arguments */
-	WRITE_ASS(fd,       "d", fd);
-	WRITE_ASS(group_fd, "d", group_fd);
-	WRITE_ASS(cpu,      "d", cpu);
-	WRITE_ASS(pid,      "d", pid);
-	WRITE_ASS(flags,   "lu", flags);
+	__WRITE_ASS(fd,       "d", fd);
+	__WRITE_ASS(group_fd, "d", group_fd);
+	__WRITE_ASS(cpu,      "d", cpu);
+	__WRITE_ASS(pid,      "d", pid);
+	__WRITE_ASS(flags,   "lu", flags);
 
 	/* struct perf_event_attr */
-	WRITE_ASS(type,   PRIu32,  attr->type);
-	WRITE_ASS(size,   PRIu32,  attr->size);
-	WRITE_ASS(config,  "llu",  attr->config);
-	WRITE_ASS(sample_period, "llu", attr->sample_period);
-	WRITE_ASS(sample_type,   "llu", attr->sample_type);
-	WRITE_ASS(read_format,   "llu", attr->read_format);
-	WRITE_ASS(disabled,       "d", attr->disabled);
-	WRITE_ASS(inherit,        "d", attr->inherit);
-	WRITE_ASS(pinned,         "d", attr->pinned);
-	WRITE_ASS(exclusive,      "d", attr->exclusive);
-	WRITE_ASS(exclude_user,   "d", attr->exclude_user);
-	WRITE_ASS(exclude_kernel, "d", attr->exclude_kernel);
-	WRITE_ASS(exclude_hv,     "d", attr->exclude_hv);
-	WRITE_ASS(exclude_idle,   "d", attr->exclude_idle);
-	WRITE_ASS(mmap,           "d", attr->mmap);
-	WRITE_ASS(comm,           "d", attr->comm);
-	WRITE_ASS(freq,           "d", attr->freq);
-	WRITE_ASS(inherit_stat,   "d", attr->inherit_stat);
-	WRITE_ASS(enable_on_exec, "d", attr->enable_on_exec);
-	WRITE_ASS(task,           "d", attr->task);
-	WRITE_ASS(watermask,      "d", attr->watermark);
-	WRITE_ASS(precise_ip,     "d", attr->precise_ip);
-	WRITE_ASS(mmap_data,      "d", attr->mmap_data);
-	WRITE_ASS(sample_id_all,  "d", attr->sample_id_all);
-	WRITE_ASS(exclude_host,   "d", attr->exclude_host);
-	WRITE_ASS(exclude_guest,  "d", attr->exclude_guest);
-	WRITE_ASS(exclude_callchain_kernel, "d",
-		  attr->exclude_callchain_kernel);
-	WRITE_ASS(exclude_callchain_user, "d",
-		  attr->exclude_callchain_user);
-	WRITE_ASS(wakeup_events, PRIu32, attr->wakeup_events);
-	WRITE_ASS(bp_type, PRIu32, attr->bp_type);
-	WRITE_ASS(config1, "llu", attr->config1);
-	WRITE_ASS(config2, "llu", attr->config2);
-	WRITE_ASS(branch_sample_type, "llu", attr->branch_sample_type);
-	WRITE_ASS(sample_regs_user,   "llu", attr->sample_regs_user);
-	WRITE_ASS(sample_stack_user,  PRIu32, attr->sample_stack_user);
-	WRITE_ASS(optional, "d", 0);
+	WRITE_ASS(type,   PRIu32);
+	WRITE_ASS(size,   PRIu32);
+	WRITE_ASS(config,  "llu");
+	WRITE_ASS(sample_period, "llu");
+	WRITE_ASS(sample_type,   "llu");
+	WRITE_ASS(read_format,   "llu");
+	WRITE_ASS(disabled,       "d");
+	WRITE_ASS(inherit,        "d");
+	WRITE_ASS(pinned,         "d");
+	WRITE_ASS(exclusive,      "d");
+	WRITE_ASS(exclude_user,   "d");
+	WRITE_ASS(exclude_kernel, "d");
+	WRITE_ASS(exclude_hv,     "d");
+	WRITE_ASS(exclude_idle,   "d");
+	WRITE_ASS(mmap,           "d");
+	WRITE_ASS(comm,           "d");
+	WRITE_ASS(freq,           "d");
+	WRITE_ASS(inherit_stat,   "d");
+	WRITE_ASS(enable_on_exec, "d");
+	WRITE_ASS(task,           "d");
+	WRITE_ASS(watermask,      "d");
+	WRITE_ASS(precise_ip,     "d");
+	WRITE_ASS(mmap_data,      "d");
+	WRITE_ASS(sample_id_all,  "d");
+	WRITE_ASS(exclude_host,   "d");
+	WRITE_ASS(exclude_guest,  "d");
+	WRITE_ASS(exclude_callchain_kernel, "d");
+	WRITE_ASS(exclude_callchain_user, "d");
+	WRITE_ASS(wakeup_events, PRIu32);
+	WRITE_ASS(bp_type, PRIu32);
+	WRITE_ASS(config1, "llu");
+	WRITE_ASS(config2, "llu");
+	WRITE_ASS(branch_sample_type, "llu");
+	WRITE_ASS(sample_regs_user,   "llu");
+	WRITE_ASS(sample_stack_user,  PRIu32);
+
+	__WRITE_ASS(optional, "d", 0);
 
 	fclose(file);
 	return 0;

  reply	other threads:[~2012-11-14  7:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05 15:49 [PATCH 0/4] perf tests: Fixies for perf_event_attr tests Jiri Olsa
2012-11-05 15:49 ` [PATCH 1/4] perf tests: Add attr stat basic test Jiri Olsa
2012-11-14  7:25   ` [tip:perf/core] perf tests: Add missing " tip-bot for Jiri Olsa
2012-11-05 15:49 ` [PATCH 2/4] perf tests: Factor attr tests WRITE_ASS macro Jiri Olsa
2012-11-14  7:26   ` tip-bot for Jiri Olsa [this message]
2012-11-05 15:49 ` [PATCH 3/4] perf tests: Fix attr watermark field name typo Jiri Olsa
2012-11-14  7:27   ` [tip:perf/core] " tip-bot for Jiri Olsa
2012-11-05 15:49 ` [PATCH 4/4] perf tests: Removing 'optional' field Jiri Olsa
2012-11-14  7:28   ` [tip:perf/core] " tip-bot for Jiri Olsa

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=tip-89f552d684925ef9f1dca8b4b2b18fb981dc3d8c@git.kernel.org \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome