453 #ifdef MPX_DEBUG_OVERHEAD 458 #ifdef MPX_DEBUG_TIMER 464 MPXDBG(
"Handler in thread\n" );
501 if ( threads_responding == 0 ) {
503 #ifdef MPX_DEBUG_TIMER 504 thiscall = _papi_hwd_get_real_usec( );
505 MPXDBG(
"last signal was %lld usec ago\n", thiscall - lastcall );
508 MPXDBG(
"%#x caught it, tlist is %p\n",
self,
tlist );
509 for ( t =
tlist; t != NULL; t = t->
next ) {
510 if ( pthread_equal( t->thr,
self ) == 0 ) {
511 ++threads_responding;
514 #ifdef MPX_DEBUG_SIGNALS 515 MPXDBG(
"%#x signaling %#x\n",
self, t->thr );
520 #ifdef MPX_DEBUG_SIGNALS 521 MPXDBG(
"%#x was tapped, tr = %d\n",
self, threads_responding );
523 --threads_responding;
526 lastthread = ( threads_responding == 0 );
533 if ( head != NULL ) {
546 if ( me != NULL && me->
cur_event != NULL ) {
549 long long cycles = 0, total_cycles = 0;
552 MPXDBG(
"retval=%d, cur_event=%p, I'm tid=%lx\n",
556 MPXDBG(
"counts[0] = %lld counts[1] = %lld\n", counts[0],
559 cur_event->
count += counts[0];
561 ? counts[0] : counts[1];
569 cur_event->
cycles += cycles;
572 ( double ) counts[0] / (
double ) cycles;
575 (
long long ) ( (
double ) total_cycles *
577 MPXDBG(
"New estimate = %lld (%lld cycles * %lf rate)\n",
588 cur_event->
count -= counts[0];
593 MPXDBG(
"%lx value = %lld cycles = %lld\n\n",
598 (
"tid(%lx): value = %lld (%lld) cycles = %lld (%lld) rate = %lf\n\n",
611 ( cur_event->
next == NULL ) ? head : cur_event->
next;
613 mev = ( mev->
next == NULL ) ? head : mev->
next ) {
625 #ifdef MPX_DEBUG_OVERHEAD 630 #ifdef ANY_THREAD_GETS_SIGNAL 633 for ( t =
tlist; t != NULL; t = t->
next ) {
635 ( t->
head == NULL ) )
637 MPXDBG(
"forwarding signal to thread %lx\n", t->
tid );
640 MPXDBG(
"forwarding signal to thread %lx returned %d\n",
662 #ifdef MPX_DEBUG_TIMER 663 MPXDBG(
"timer restarted by %lx\n", me->
tid );
668 #ifdef MPX_DEBUG_OVERHEAD 669 usec = _papi_hwd_get_real_usec( ) - usec;
670 MPXDBG(
"handler %#x did %swork in %lld usec\n",
671 self, ( didwork ?
"" :
"no " ), usec );
int PAPI_stop(int EventSet, long long *values)
unsigned long int(* _papi_hwi_thread_id_fn)(void)
static Threadlist * tlist
inline_static int _papi_hwi_lock(int lck)
PAPI_os_info_t _papi_os_info
inline_static int _papi_hwi_unlock(int lck)
struct _masterevent * next
__sighandler_t signal(int __sig, __sighandler_t __handler) __attribute__((__nothrow__
#define MPXDBG(format, args...)
int pthread_kill(pthread_t __threadid, int __signo) __attribute__((__nothrow__
long long PAPI_get_real_usec(void)
struct _threadlist * next
static MasterEvent * get_my_threads_master_event_list(void)
int PAPI_start(int EventSet)
static struct itimerval itime
struct _threadlist * mythr