mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: acme@redhat.com, a.p.zijlstra@chello.nl, mingo@elte.hu,
	paulus@samba.org, cjashfor@linux.vnet.ibm.com,
	fweisbec@gmail.com
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 3/8] perf, tool: Add bitmap_or function into bitmap object
Date: Thu, 16 Feb 2012 13:00:47 +0100	[thread overview]
Message-ID: <1329393652-6055-4-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1329393652-6055-1-git-send-email-jolsa@redhat.com>

Adding implementation os bitmap_or function to the bitmap
object. It is stolen from the kernel lib/bitmap.o object.

It is used in upcomming patches.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/util/bitmap.c               |   10 ++++++++++
 tools/perf/util/include/linux/bitmap.h |   11 +++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/bitmap.c b/tools/perf/util/bitmap.c
index 5e230ac..0a1adc1 100644
--- a/tools/perf/util/bitmap.c
+++ b/tools/perf/util/bitmap.c
@@ -19,3 +19,13 @@ int __bitmap_weight(const unsigned long *bitmap, int bits)
 
 	return w;
 }
+
+void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
+		 const unsigned long *bitmap2, int bits)
+{
+	int k;
+	int nr = BITS_TO_LONGS(bits);
+
+	for (k = 0; k < nr; k++)
+		dst[k] = bitmap1[k] | bitmap2[k];
+}
diff --git a/tools/perf/util/include/linux/bitmap.h b/tools/perf/util/include/linux/bitmap.h
index eda4416..bb162e4 100644
--- a/tools/perf/util/include/linux/bitmap.h
+++ b/tools/perf/util/include/linux/bitmap.h
@@ -5,6 +5,8 @@
 #include <linux/bitops.h>
 
 int __bitmap_weight(const unsigned long *bitmap, int bits);
+void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
+		 const unsigned long *bitmap2, int bits);
 
 #define BITMAP_LAST_WORD_MASK(nbits)					\
 (									\
@@ -32,4 +34,13 @@ static inline int bitmap_weight(const unsigned long *src, int nbits)
 	return __bitmap_weight(src, nbits);
 }
 
+static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
+			     const unsigned long *src2, int nbits)
+{
+	if (small_const_nbits(nbits))
+		*dst = *src1 | *src2;
+	else
+		__bitmap_or(dst, src1, src2, nbits);
+}
+
 #endif /* _PERF_BITOPS_H */
-- 
1.7.4.4


  parent reply	other threads:[~2012-02-16 12:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16 12:00 [PATCHv5 0/8] perf tool: parser generator for events parsing Jiri Olsa
2012-02-16 12:00 ` [PATCH 1/8] perf, tool: Remove unused functions from debugfs object Jiri Olsa
2012-02-16 12:00 ` [PATCH 2/8] perf, tool: Add sysfs mountpoint interface Jiri Olsa
2012-02-16 12:00 ` Jiri Olsa [this message]
2012-02-16 12:00 ` [PATCH 4/8] perf: Adding sysfs group format attribute for pmu device Jiri Olsa
2012-02-16 12:00 ` [PATCH 5/8] perf, tool: Add parser generator for events parsing Jiri Olsa
2012-02-16 12:00 ` [PATCH 6/8] perf, tool: Add config options support for event parsing Jiri Olsa
2012-02-16 12:00 ` [PATCH 7/8] perf, tool: Add perf pmu object to access pmu format definition Jiri Olsa
2012-02-16 12:00 ` [PATCH 8/8] perf, tool: Add support to specify pmu style event Jiri Olsa
2012-02-16 17:03 ` [PATCHv5 0/8] perf tool: parser generator for events parsing Peter Zijlstra
2012-02-16 17:35   ` Arnaldo Carvalho de Melo

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=1329393652-6055-4-git-send-email-jolsa@redhat.com \
    --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=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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

all inboxes | Powered by JetHome®