summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Januszewski <spock@gentoo.org>2007-03-31 17:29:52 +0000
committerMichael Januszewski <spock@gentoo.org>2007-03-31 17:29:52 +0000
commitf62fc86c85f11684a551c4218a98949efc70387b (patch)
tree3b22fb3d3947bd588656fe7d613f0a87aea0c355 /dev-util/oprofile
parentfix mask entry (diff)
downloadgentoo-2-f62fc86c85f11684a551c4218a98949efc70387b.tar.gz
gentoo-2-f62fc86c85f11684a551c4218a98949efc70387b.tar.bz2
gentoo-2-f62fc86c85f11684a551c4218a98949efc70387b.zip
Add a patch to make oprofile work on amd64 (bug #171638).
(Portage version: 2.1.2.3)
Diffstat (limited to 'dev-util/oprofile')
-rw-r--r--dev-util/oprofile/ChangeLog6
-rw-r--r--dev-util/oprofile/files/oprofile-0.9.2-amd64.patch86
-rw-r--r--dev-util/oprofile/oprofile-0.9.2.ebuild8
3 files changed, 98 insertions, 2 deletions
diff --git a/dev-util/oprofile/ChangeLog b/dev-util/oprofile/ChangeLog
index 0739f201a2e6..8678e96de4fc 100644
--- a/dev-util/oprofile/ChangeLog
+++ b/dev-util/oprofile/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for dev-util/oprofile
# Copyright 2000-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/ChangeLog,v 1.37 2007/03/05 04:04:53 genone Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/ChangeLog,v 1.38 2007/03/31 17:29:52 spock Exp $
+
+ 31 Mar 2007; Michał Januszewski <spock@gentoo.org>
+ +files/oprofile-0.9.2-amd64.patch, oprofile-0.9.2.ebuild:
+ Add a patch to make oprofile work on amd64 (bug #171638).
05 Mar 2007; Marius Mauch <genone@gentoo.org> oprofile-0.9.1-r1.ebuild,
oprofile-0.9.2.ebuild:
diff --git a/dev-util/oprofile/files/oprofile-0.9.2-amd64.patch b/dev-util/oprofile/files/oprofile-0.9.2-amd64.patch
new file mode 100644
index 000000000000..06c5e9a7728f
--- /dev/null
+++ b/dev-util/oprofile/files/oprofile-0.9.2-amd64.patch
@@ -0,0 +1,86 @@
+--- a/libop/op_alloc_counter.c 2007-03-21 02:31:40.000000000 +0000
++++ b/libop/op_alloc_counter.c 2007-03-21 02:31:42.000000000 +0000
+@@ -12,6 +12,8 @@
+ */
+
+ #include <stdlib.h>
++#include <ctype.h>
++#include <dirent.h>
+
+ #include "op_events.h"
+ #include "op_libiberty.h"
+@@ -130,7 +132,7 @@
+ counter_arc const * arc = list_entry(pos, counter_arc, next);
+
+ if (allocated_mask & (1 << arc->counter))
+- return 0;
++ continue;
+
+ counter_map[depth] = arc->counter;
+
+@@ -143,6 +145,42 @@
+ return 0;
+ }
+
++/* determine which directories are counter directories
++ */
++static int perfcounterdir(const struct dirent * entry)
++{
++ return (isdigit(entry->d_name[0]));
++}
++
++/**
++ * @param mask pointer where to place bit mask of unavailable counters
++ *
++ * return >= 0 number of counters that are available
++ * < 0 could not determine number of counters
++ *
++ */
++static int op_get_counter_mask(u32 * mask)
++{
++ struct dirent **counterlist;
++ int count, i;
++ /* assume nothing is available */
++ u32 available=0;
++
++ count = scandir("/dev/oprofile", &counterlist, perfcounterdir,
++ alphasort);
++ if (count < 0)
++ /* unable to determine bit mask */
++ return -1;
++ /* convert to bit map (0 where counter exists) */
++ for (i=0; i<count; ++i) {
++ available |= 1 << atoi(counterlist[i]->d_name);
++ free(counterlist[i]);
++ }
++ *mask=~available;
++ free(counterlist);
++ return count;
++}
++
+
+ size_t * map_event_to_counter(struct op_event const * pev[], int nr_events,
+ op_cpu cpu_type)
+@@ -150,8 +188,11 @@
+ counter_arc_head * ctr_arc;
+ size_t * counter_map;
+ int nr_counters;
++ u32 unavailable_counters = 0;
+
+- nr_counters = op_get_nr_counters(cpu_type);
++ nr_counters = op_get_counter_mask(&unavailable_counters);
++ if (nr_counters < 0)
++ nr_counters = op_get_nr_counters(cpu_type);
+ if (nr_counters < nr_events)
+ return 0;
+
+@@ -159,7 +200,8 @@
+
+ counter_map = xmalloc(nr_counters * sizeof(size_t));
+
+- if (!allocate_counter(ctr_arc, nr_events, 0, 0, counter_map)) {
++ if (!allocate_counter(ctr_arc, nr_events, 0, unavailable_counters,
++ counter_map)) {
+ free(counter_map);
+ counter_map = 0;
+ }
diff --git a/dev-util/oprofile/oprofile-0.9.2.ebuild b/dev-util/oprofile/oprofile-0.9.2.ebuild
index 75f2c0f3e335..8ae01d9448e4 100644
--- a/dev-util/oprofile/oprofile-0.9.2.ebuild
+++ b/dev-util/oprofile/oprofile-0.9.2.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/oprofile-0.9.2.ebuild,v 1.3 2007/03/05 04:04:53 genone Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/oprofile-0.9.2.ebuild,v 1.4 2007/03/31 17:29:52 spock Exp $
inherit eutils qt3 linux-info
@@ -18,6 +18,12 @@ DEPEND=">=dev-libs/popt-1.7-r1
>=sys-libs/glibc-2.3.2-r1
qt3? ( $(qt_min_version 3.3) )"
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+ epatch ${FILESDIR}/oprofile-0.9.2-amd64.patch
+}
+
src_compile() {
local myconf=""