|
Packit |
577717 |
C From Dave McNamara at PSRV. Thanks!
|
|
Packit |
577717 |
C Ported to Fortran by Kevin London
|
|
Packit |
577717 |
C If you try to add an event that doesn't exist, you get the correct error
|
|
Packit |
577717 |
C message, yet you get subsequent Seg. Faults when you try to do PAPI_start
|
|
Packit |
577717 |
C and PAPI_stop. I would expect some bizarre behavior if I had no events
|
|
Packit |
577717 |
C added to the event set and then tried to PAPI_start but if I had
|
|
Packit |
577717 |
C successfully added one event, then the 2nd one get an error when I
|
|
Packit |
577717 |
C tried to add it, is it possible for PAPI_start to work but just
|
|
Packit |
577717 |
C count the first event?
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include "fpapi_test.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
program case1
|
|
Packit |
577717 |
IMPLICIT integer (p)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
INTEGER EventSet
|
|
Packit |
577717 |
INTEGER retval
|
|
Packit |
577717 |
INTEGER i,j
|
|
Packit |
577717 |
INTEGER*8 gl(2)
|
|
Packit |
577717 |
INTEGER n
|
|
Packit |
577717 |
REAL c,a,b
|
|
Packit |
577717 |
|
|
Packit |
577717 |
INTEGER last_char
|
|
Packit |
577717 |
EXTERNAL last_char
|
|
Packit |
577717 |
integer tests_quiet, get_quiet
|
|
Packit |
577717 |
external get_quiet
|
|
Packit |
577717 |
|
|
Packit |
577717 |
tests_quiet = get_quiet()
|
|
Packit |
577717 |
|
|
Packit |
577717 |
n = 1000
|
|
Packit |
577717 |
a = 0.999
|
|
Packit |
577717 |
b = 1.001
|
|
Packit |
577717 |
j = 0
|
|
Packit |
577717 |
i = 0
|
|
Packit |
577717 |
EventSet = PAPI_NULL
|
|
Packit |
577717 |
|
|
Packit |
577717 |
retval = PAPI_VER_CURRENT
|
|
Packit |
577717 |
call PAPIf_library_init( retval )
|
|
Packit |
577717 |
if ( retval.NE.PAPI_VER_CURRENT) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPI_library_init', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_create_eventset( EventSet, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_create_eventset',
|
|
Packit |
577717 |
*retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_query_event(PAPI_L2_TCM, retval)
|
|
Packit |
577717 |
if (retval .EQ. PAPI_OK) then
|
|
Packit |
577717 |
j = j + 1
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
if (j .NE. 0) then
|
|
Packit |
577717 |
call PAPIf_add_event( EventSet, PAPI_L2_TCM, retval )
|
|
Packit |
577717 |
if (retval .NE. PAPI_OK) then
|
|
Packit |
577717 |
if (retval .NE. PAPI_ECNFLCT) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_add_event',
|
|
Packit |
577717 |
*retval)
|
|
Packit |
577717 |
else
|
|
Packit |
577717 |
j = j - 1
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
i = j
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_query_event(PAPI_L2_DCM, retval)
|
|
Packit |
577717 |
if (retval .EQ. PAPI_OK) then
|
|
Packit |
577717 |
j = j + 1
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
if (j .EQ. i+1) then
|
|
Packit |
577717 |
call PAPIf_add_event( EventSet, PAPI_L2_DCM, retval )
|
|
Packit |
577717 |
if (retval .NE. PAPI_OK) then
|
|
Packit |
577717 |
if (retval .NE. PAPI_ECNFLCT) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_add_event',
|
|
Packit |
577717 |
*retval)
|
|
Packit |
577717 |
else
|
|
Packit |
577717 |
j = j - 1
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
if (J .GT. 0) then
|
|
Packit |
577717 |
call PAPIf_start( EventSet, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_start', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
do i=1, n
|
|
Packit |
577717 |
c = a * b
|
|
Packit |
577717 |
end do
|
|
Packit |
577717 |
|
|
Packit |
577717 |
if (j .GT. 0) then
|
|
Packit |
577717 |
call PAPIf_stop( EventSet, gl, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_stop', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call ftests_pass(__FILE__)
|
|
Packit |
577717 |
end
|