From: tip-bot for Frederic Weisbecker <fweisbec@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, acme@redhat.com,
hpa@zytor.com, mingo@redhat.com, efault@gmx.de,
peterz@infradead.org, mitake@dcl.info.waseda.ac.jp,
fweisbec@gmail.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/core] perf tools: Use perf_header__set/has_feat whenever possible
Date: Wed, 11 Nov 2009 07:43:56 GMT [thread overview]
Message-ID: <tip-3e13ab2d83b6867a20663c73c184f29c2fde1558@git.kernel.org> (raw)
In-Reply-To: <1257911467-28276-5-git-send-email-fweisbec@gmail.com>
Commit-ID: 3e13ab2d83b6867a20663c73c184f29c2fde1558
Gitweb: http://git.kernel.org/tip/3e13ab2d83b6867a20663c73c184f29c2fde1558
Author: Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Wed, 11 Nov 2009 04:51:06 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 11 Nov 2009 07:30:19 +0100
perf tools: Use perf_header__set/has_feat whenever possible
And drop the alternate checks/sets using set_bit or other kind
of helpers.
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-5-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/builtin-record.c | 4 ++--
| 12 ++----------
| 1 -
3 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index c35e61b..326e8a7 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -431,11 +431,11 @@ static int __cmd_record(int argc, const char **argv)
header = perf_header__new();
if (raw_samples) {
- perf_header__feat_trace_info(header);
+ perf_header__set_feat(header, HEADER_TRACE_INFO);
} else {
for (i = 0; i < nr_counters; i++) {
if (attrs[i].sample_type & PERF_SAMPLE_RAW) {
- perf_header__feat_trace_info(header);
+ perf_header__set_feat(header, HEADER_TRACE_INFO);
break;
}
}
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 915b56e..9709d38 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -148,11 +148,6 @@ struct perf_file_header {
DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
};
-void perf_header__feat_trace_info(struct perf_header *header)
-{
- set_bit(HEADER_TRACE_INFO, header->adds_features);
-}
-
void perf_header__set_feat(struct perf_header *self, int feat)
{
set_bit(feat, self->adds_features);
@@ -195,9 +190,8 @@ perf_header__adds_write(struct perf_header *self, int fd, bool at_exit)
{
struct perf_file_section trace_sec;
u64 cur_offset = lseek(fd, 0, SEEK_CUR);
- unsigned long *feat_mask = self->adds_features;
- if (test_bit(HEADER_TRACE_INFO, feat_mask)) {
+ if (perf_header__has_feat(self, HEADER_TRACE_INFO)) {
/* Write trace info */
trace_sec.offset = lseek(fd, sizeof(trace_sec), SEEK_CUR);
read_tracing_data(fd, attrs, nr_counters);
@@ -314,9 +308,7 @@ static void do_read(int fd, void *buf, size_t size)
static void perf_header__adds_read(struct perf_header *self, int fd)
{
- const unsigned long *feat_mask = self->adds_features;
-
- if (test_bit(HEADER_TRACE_INFO, feat_mask)) {
+ if (perf_header__has_feat(self, HEADER_TRACE_INFO)) {
struct perf_file_section trace_sec;
do_read(fd, &trace_sec, sizeof(trace_sec));
--git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 77186c9..a22d70b 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -49,7 +49,6 @@ void perf_header_attr__add_id(struct perf_header_attr *self, u64 id);
u64 perf_header__sample_type(struct perf_header *header);
struct perf_event_attr *
perf_header__find_attr(u64 id, struct perf_header *header);
-void perf_header__feat_trace_info(struct perf_header *header);
void perf_header__set_feat(struct perf_header *self, int feat);
bool perf_header__has_feat(const struct perf_header *self, int feat);
next prev parent reply other threads:[~2009-11-11 7:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-11 3:51 [PATCH 1/6] perf tools: Synthetize the targeted process Frederic Weisbecker
2009-11-11 3:51 ` [PATCH 2/6] perf tools: Move the build-id storage operations to headers Frederic Weisbecker
2009-11-11 7:43 ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2009-11-11 3:51 ` [PATCH 3/6] perf tools: Split up build id saving into fetch and write Frederic Weisbecker
2009-11-11 7:43 ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2009-11-11 3:51 ` [PATCH 4/6] perf tools: Read the build-ids from the header layer Frederic Weisbecker
2009-11-11 7:43 ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2009-11-11 3:51 ` [PATCH 5/6] perf tools: Use perf_header__set/has_feat whenever possible Frederic Weisbecker
2009-11-11 7:43 ` tip-bot for Frederic Weisbecker [this message]
2009-11-11 3:51 ` [PATCH 6/6] perf tools: Bring linear set of section headers for features Frederic Weisbecker
2009-11-11 6:20 ` Peter Zijlstra
2009-11-11 16:49 ` Frederic Weisbecker
2009-11-11 17:32 ` Arnaldo Carvalho de Melo
2009-11-11 7:44 ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2009-11-11 7:42 ` [tip:perf/core] perf tools: Synthetize the targeted process tip-bot for Frederic Weisbecker
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-3e13ab2d83b6867a20663c73c184f29c2fde1558@git.kernel.org \
--to=fweisbec@gmail.com \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=mitake@dcl.info.waseda.ac.jp \
--cc=paulus@samba.org \
--cc=peterz@infradead.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