parent
443f3bb019
commit
624554548a
90
papi-granularity.patch
Normal file
90
papi-granularity.patch
Normal file
@ -0,0 +1,90 @@
|
||||
commit c754f3bf1763358aaf70c0d64bc6cc2df29d8fec
|
||||
Author: Vince Weaver <vincent.weaver@maine.edu>
|
||||
Date: Thu Jan 10 20:42:56 2019 -0500
|
||||
|
||||
perf_event: fix granularity setting for attached processes
|
||||
|
||||
the old code was setting the granularity wrong when attaching to a CPU.
|
||||
|
||||
diff --git a/src/components/perf_event/perf_event.c b/src/components/perf_event/perf_event.c
|
||||
index 1f4bbcee..2f2f380e 100644
|
||||
--- a/src/components/perf_event/perf_event.c
|
||||
+++ b/src/components/perf_event/perf_event.c
|
||||
@@ -684,11 +684,23 @@ open_pe_events( pe_context_t *ctx, pe_control_t *ctl )
|
||||
int i, ret = PAPI_OK;
|
||||
long pid;
|
||||
|
||||
- if (ctl->granularity==PAPI_GRN_SYS) {
|
||||
- pid = -1;
|
||||
+
|
||||
+ /* Set the pid setting */
|
||||
+ /* If attached, this is the pid of process we are attached to. */
|
||||
+ /* If GRN_THRD then it is 0 meaning current process only */
|
||||
+ /* If GRN_SYS then it is -1 meaning all procs on this CPU */
|
||||
+ /* Note if GRN_SYS then CPU must be specified, not -1 */
|
||||
+
|
||||
+ if (ctl->attached) {
|
||||
+ pid = ctl->tid;
|
||||
}
|
||||
else {
|
||||
- pid = ctl->tid;
|
||||
+ if (ctl->granularity==PAPI_GRN_SYS) {
|
||||
+ pid = -1;
|
||||
+ }
|
||||
+ else {
|
||||
+ pid = 0;
|
||||
+ }
|
||||
}
|
||||
|
||||
for( i = 0; i < ctl->num_events; i++ ) {
|
||||
@@ -1650,6 +1662,7 @@ _pe_ctl( hwd_context_t *ctx, int code, _papi_int_option_t *option )
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ pe_ctl->attached = 1;
|
||||
pe_ctl->tid = option->attach.tid;
|
||||
|
||||
/* If events have been already been added, something may */
|
||||
@@ -1662,7 +1675,9 @@ _pe_ctl( hwd_context_t *ctx, int code, _papi_int_option_t *option )
|
||||
case PAPI_DETACH:
|
||||
pe_ctl = ( pe_control_t *) ( option->attach.ESI->ctl_state );
|
||||
|
||||
+ pe_ctl->attached = 0;
|
||||
pe_ctl->tid = 0;
|
||||
+
|
||||
return PAPI_OK;
|
||||
|
||||
case PAPI_CPU_ATTACH:
|
||||
@@ -1676,11 +1691,6 @@ _pe_ctl( hwd_context_t *ctx, int code, _papi_int_option_t *option )
|
||||
}
|
||||
/* looks like we are allowed so set cpu number */
|
||||
|
||||
- /* this tells the kernel not to count for a thread */
|
||||
- /* should we warn if we try to set both? perf_event */
|
||||
- /* will reject it. */
|
||||
- pe_ctl->tid = -1;
|
||||
-
|
||||
pe_ctl->cpu = option->cpu.cpu_num;
|
||||
|
||||
return PAPI_OK;
|
||||
@@ -1696,7 +1706,7 @@ _pe_ctl( hwd_context_t *ctx, int code, _papi_int_option_t *option )
|
||||
return ret;
|
||||
}
|
||||
/* looks like we are allowed, so set event set level counting domains */
|
||||
- pe_ctl->domain = option->domain.domain;
|
||||
+ pe_ctl->domain = option->domain.domain;
|
||||
return PAPI_OK;
|
||||
|
||||
case PAPI_GRANUL:
|
||||
diff --git a/src/components/perf_event/perf_event_lib.h b/src/components/perf_event/perf_event_lib.h
|
||||
index f4ad0c5d..0c50ab9f 100644
|
||||
--- a/src/components/perf_event/perf_event_lib.h
|
||||
+++ b/src/components/perf_event/perf_event_lib.h
|
||||
@@ -30,6 +30,7 @@ typedef struct {
|
||||
unsigned int overflow; /* overflow enable */
|
||||
unsigned int inherit; /* inherit enable */
|
||||
unsigned int overflow_signal; /* overflow signal */
|
||||
+ unsigned int attached; /* attached to a process */
|
||||
int cidx; /* current component */
|
||||
int cpu; /* which cpu to measure */
|
||||
pid_t tid; /* thread we are monitoring */
|
@ -8,7 +8,7 @@
|
||||
Summary: Performance Application Programming Interface
|
||||
Name: papi
|
||||
Version: 5.6.0
|
||||
Release: 18%{?dist}
|
||||
Release: 19%{?dist}
|
||||
License: BSD
|
||||
Group: Development/System
|
||||
Requires: papi-libs = %{version}-%{release}
|
||||
@ -27,6 +27,7 @@ Patch20: papi-fastread.patch
|
||||
Patch21: papi-arm64fastread.patch
|
||||
Patch30: papi-560_600eventupdate.patch
|
||||
Patch31: papi-701eventupdate.patch
|
||||
Patch40: papi-granularity.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: doxygen
|
||||
BuildRequires: ncurses-devel
|
||||
@ -103,6 +104,7 @@ the PAPI user-space libraries and interfaces.
|
||||
%patch21 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch40 -p1
|
||||
|
||||
%build
|
||||
%if %{without bundled_libpfm}
|
||||
@ -185,6 +187,9 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so*
|
||||
%{_libdir}/*.a
|
||||
|
||||
%changelog
|
||||
* Wed Jul 19 2023 William Cohen <wcohen@redhat.com> - 5.6.0-19
|
||||
- Fix granularity setting (rhbz2221846)
|
||||
|
||||
* Fri May 5 2023 William Cohen <wcohen@redhat.com> - 5.6.0-18
|
||||
- Add event presets for Arm Neoverse processors (rhbz2111982, rhbz2111988)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user