Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 299937 Details for
Bug 438342
Oprofile does not work in R2 or MRG
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch to make oprofile only use counters that are available
available.diff (text/plain), 2.11 KB, created by
William Cohen
on 2008-04-01 18:16:12 UTC
(
hide
)
Description:
Patch to make oprofile only use counters that are available
Filename:
MIME Type:
Creator:
William Cohen
Created:
2008-04-01 18:16:12 UTC
Size:
2.11 KB
patch
obsolete
>Index: libop/op_alloc_counter.c >=================================================================== >RCS file: /cvsroot/oprofile/oprofile/libop/op_alloc_counter.c,v >retrieving revision 1.7 >diff -u -r1.7 op_alloc_counter.c >--- libop/op_alloc_counter.c 17 Nov 2006 18:20:38 -0000 1.7 >+++ libop/op_alloc_counter.c 17 Nov 2006 20:16:01 -0000 >@@ -12,6 +12,8 @@ > */ > > #include <stdlib.h> >+#include <ctype.h> >+#include <dirent.h> > > #include "op_events.h" > #include "op_libiberty.h" >@@ -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; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 438342
: 299937