PAPI 7.1.0.0
Loading...
Searching...
No Matches
aix.c
Go to the documentation of this file.
1/* This file handles the OS dependent part of the POWER5 and POWER6 architectures.
2 It supports both AIX 4 and AIX 5. The switch between AIX 4 and 5 is driven by the
3 system defined value _AIX_VERSION_510.
4 Other routines also include minor conditionally compiled differences.
5*/
6
7#include <sys/utsname.h>
8
9#include "papi.h"
10#include "papi_internal.h"
11#include "papi_lock.h"
12
13#include "papi_memory.h"
14
15#include "extras.h"
16
17#include "aix.h"
18#include "papi_vector.h"
19
20/* Advance declarations */
22
23/* Locking variables */
24volatile int lock_var[PAPI_MAX_LOCK] = { 0 };
26
27/*
28 some heap information, start_of_text, start_of_data .....
29 ref: http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/genprogc/sys_mem_alloc.htm#HDRA9E4A4C9921SYLV
30*/
31#define START_OF_TEXT &_text
32#define END_OF_TEXT &_etext
33#define START_OF_DATA &_data
34#define END_OF_DATA &_edata
35#define START_OF_BSS &_edata
36#define END_OF_BSS &_end
37
38static int maxgroups = 0;
39struct utsname AixVer;
40
42
44pm_groups_info_t pmgroups;
48
49/* to initialize the native_table */
50void
52{
53 int i, j;
54
55 memset( native_table, 0,
57 memset( native_name_map, 0,
59 for ( i = 0; i < PAPI_MAX_NATIVE_EVENTS; i++ ) {
61 for ( j = 0; j < MAX_COUNTERS; j++ )
62 native_table[i].resources.counter_cmd[j] = -1;
63 }
64}
65
66/* to setup native_table group value */
67static void
69{
70 int i, j, gnum;
71
72 for ( i = 0; i < total; i++ ) {
73 for ( j = 0; j < MAX_COUNTERS; j++ ) {
74 /* native_table[i].resources.rgg[j]=-1; */
75 if ( native_table[i].resources.selector & ( 1 << j ) ) {
76 for ( gnum = 0; gnum < pmgroups.maxgroups; gnum++ ) {
77 if ( native_table[i].resources.counter_cmd[j] ==
78 pmgroups.event_groups[gnum].events[j] ) {
79 /* could use gnum instead of pmgroups.event_groups[gnum].group_id */
81 event_groups[gnum].
82 group_id / 32] |=
83 1 << ( pmgroups.event_groups[gnum].group_id % 32 );
84 }
85 }
86 }
87 }
88 }
89
90 for ( gnum = 0; gnum < pmgroups.maxgroups; gnum++ ) {
91 for ( i = 0; i < MAX_COUNTERS; i++ ) {
92 /*group_map[gnum].counter_cmd[i] = pmgroups.event_groups[gnum].events[i]; */
93 if (pmgroups.event_groups[gnum].group_id >=MAX_GROUPS) {
94 fprintf(stderr,"ERROR, group number trying to go past MAX GROUPS\n");
95 continue;
96 }
97
98 group_map[pmgroups.event_groups[gnum].group_id].counter_cmd[i] =
99 pmgroups.event_groups[gnum].events[i];
100 }
101 }
102}
103
104/* to setup native_table values, and return number of entries */
105int
107{
108 hwd_pmevents_t *wevp;
109 hwd_pminfo_t *info;
110 int pmc, ev, i, j, index;
111
112 info = &pminfo;
113 index = 0;
115 for ( pmc = 0; pmc < info->maxpmcs; pmc++ ) {
116 wevp = info->list_events[pmc];
117 for ( ev = 0; ev < info->maxevents[pmc]; ev++, wevp++ ) {
118 for ( i = 0; i < index; i++ ) {
119 if ( strcmp( wevp->short_name, native_table[i].name ) == 0 ) {
120 native_table[i].resources.selector |= 1 << pmc;
121 native_table[i].resources.counter_cmd[pmc] = wevp->event_id;
122 break;
123 }
124 }
125 if ( i == index ) {
126 /*native_table[i].index=i; */
127 native_table[i].resources.selector |= 1 << pmc;
128 native_table[i].resources.counter_cmd[pmc] = wevp->event_id;
129 native_table[i].name = wevp->short_name;
130 native_table[i].description = wevp->description;
133 index++;
134 }
135 }
136 }
137 aix_ppc64_setup_gps( index );
138
139 return index;
140}
141
142/* Reports the elements of the hwd_register_t struct as an array of names and a matching array of values.
143 Maximum string length is name_len; Maximum number of values is count.
144*/
145static void
146copy_value( unsigned int val, char *nam, char *names, unsigned int *values,
147 int len )
148{
149 *values = val;
150 strncpy( names, nam, len );
151 names[len - 1] = '\0';
152}
153
154
155/* this function recusively does Modified Bipartite Graph counter allocation
156 success return 1
157 fail return 0
158*/
159static int
161{
162 int i, j, group = -1;
163 unsigned int map[GROUP_INTS];
164
165 for ( i = 0; i < GROUP_INTS; i++ )
166 map[i] = event_list[0].ra_group[i];
167
168 for ( i = 1; i < size; i++ ) {
169 for ( j = 0; j < GROUP_INTS; j++ )
170 map[j] &= event_list[i].ra_group[j];
171 }
172
173 for ( i = 0; i < GROUP_INTS; i++ ) {
174 if ( map[i] ) {
175 group = ffs( map[i] ) - 1 + i * 32;
176 break;
177 }
178 }
179
180 if ( group < 0 )
181 return group; /* allocation fail */
182 else {
183 for ( i = 0; i < size; i++ ) {
184 for ( j = 0; j < MAX_COUNTERS; j++ ) {
185 if ( event_list[i].ra_counter_cmd[j] >= 0
186 && event_list[i].ra_counter_cmd[j] ==
187 group_map[group].counter_cmd[j] )
188 event_list[i].ra_position = j;
189 }
190 }
191 return group;
192 }
193}
194
195
196/* this function will be called when there are counters available
197 success return 1
198 fail return 0
199*/
200int
202{
203 hwd_control_state_t *this_state = ESI->ctl_state;
204 unsigned char selector;
205 int i, j, natNum, index;
207 int position, group;
208
209
210 /* not yet successfully mapped, but have enough slots for events */
211
212 /* Initialize the local structure needed
213 for counter allocation and optimization. */
214 natNum = ESI->NativeCount;
215 for ( i = 0; i < natNum; i++ ) {
216 /* CAUTION: Since this is in the hardware layer, it's ok
217 to access the native table directly, but in general this is a bad idea */
218 event_list[i].ra_position = -1;
219 /* calculate native event rank, which is number of counters it can live on, this is power3 specific */
220 for ( j = 0; j < MAX_COUNTERS; j++ ) {
221 if ( ( index =
223 ni_event & PAPI_NATIVE_AND_MASK].index ) <
224 0 )
225 return PAPI_ECNFLCT;
226 event_list[i].ra_counter_cmd[j] =
228 }
229 for ( j = 0; j < GROUP_INTS; j++ ) {
230 if ( ( index =
232 ni_event & PAPI_NATIVE_AND_MASK].index ) <
233 0 )
234 return PAPI_ECNFLCT;
235 event_list[i].ra_group[j] = native_table[index].resources.group[j];
236 }
237 /*event_list[i].ra_mod = -1; */
238 }
239
240 if ( ( group = do_counter_allocation( event_list, natNum ) ) >= 0 ) { /* successfully mapped */
241 /* copy counter allocations info back into NativeInfoArray */
242 this_state->group_id = group;
243 for ( i = 0; i < natNum; i++ )
244 ESI->NativeInfoArray[i].ni_position = event_list[i].ra_position;
245 /* update the control structure based on the NativeInfoArray */
246 /*_papi_hwd_update_control_state(this_state, ESI->NativeInfoArray, natNum);*/
247 return PAPI_OK;
248 } else {
249 return PAPI_ECNFLCT;
250 }
251}
252
253int
255{
256 int i;
257
258 for ( i = 0; i < _aix_vector.cmp_info.num_cntrs; i++ ) {
259 ptr->counter_cmd.events[i] = COUNT_NOTHING;
260 }
261 ptr->counter_cmd.mode.b.is_group = 1;
262
265 /*setup_native_table(); */
266 return ( PAPI_OK );
267}
268
269
270/* This function updates the control structure with whatever resources are allocated
271 for all the native events in the native info structure array. */
272int
275 hwd_context_t * context )
276{
277
278 this_state->counter_cmd.events[0] = this_state->group_id;
279 return PAPI_OK;
280}
281
282
283/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
284 /* The following is for any POWER hardware */
285
286/* Trims trailing blank space and line endings from a string (in place).
287 Returns pointer to start address */
288static char *
289trim_string( char *in )
290{
291 int len, i = 0;
292 char *start = in;
293
294 if ( in == NULL )
295 return ( in );
296 len = strlen( in );
297 if ( len == 0 )
298 return ( in );
299 /* Trim right */
300 i = strlen( start ) - 1;
301 while ( i >= 0 ) {
302 if ( isblank( start[i] ) || ( start[i] == '\r' ) ||
303 ( start[i] == '\n' ) )
304 start[i] = '\0';
305 else
306 break;
307 i--;
308 }
309 return ( start );
310}
311
312
313/* Routines to support an opaque native event table */
314int
315_aix_ntv_code_to_name( unsigned int EventCode, char *ntv_name, int len )
316{
317 if ( ( EventCode & PAPI_NATIVE_AND_MASK ) >=
319 return ( PAPI_ENOEVNT );
320 strncpy( ntv_name,
321 native_name_map[EventCode & PAPI_NATIVE_AND_MASK].name, len );
322 trim_string( ntv_name );
323 if ( strlen( native_name_map[EventCode & PAPI_NATIVE_AND_MASK].name ) >
324 len - 1 )
325 return ( PAPI_EBUF );
326 return ( PAPI_OK );
327}
328
329int
330_aix_ntv_code_to_descr( unsigned int EventCode, char *ntv_descr, int len )
331{
332 if ( ( EventCode & PAPI_NATIVE_AND_MASK ) >=
334 return ( PAPI_ENOEVNT );
335 strncpy( ntv_descr,
337 index].description, len );
338 trim_string( ntv_descr );
339 if ( strlen
341 [native_name_map[EventCode & PAPI_NATIVE_AND_MASK].index].
342 description ) > len - 1 )
343 return ( PAPI_EBUF );
344 return ( PAPI_OK );
345}
346
347int
348_aix_ntv_code_to_bits( unsigned int EventCode, hwd_register_t * bits )
349{
350 bits = &native_table[EventCode & PAPI_NATIVE_AND_MASK].resources; /* it is not right, different type */
351 return ( PAPI_OK );
352}
353
354/* this function return the next native event code.
355 modifier = PAPI_ENUM_FIRST returns first native event code
356 modifier = PAPI_ENUM_EVENTS returns next native event code
357 modifier = PAPI_NTV_ENUM_GROUPS return groups in which this
358 native event lives, in bits 16 - 23 of event code
359 terminating with PAPI_ENOEVNT at the end of the list.
360 function return value:
361 PAPI_OK successful, event code is valid
362 PAPI_EINVAL bad modifier
363 PAPI_ENOEVNT end of list or fail, event code is invalid
364*/
365int
366_aix_ntv_enum_events( unsigned int *EventCode, int modifier )
367{
368 if ( modifier == PAPI_ENUM_FIRST ) {
369 *EventCode = PAPI_NATIVE_MASK;
370 return ( PAPI_OK );
371 }
372 if ( modifier == PAPI_ENUM_EVENTS ) {
373 int index = *EventCode & PAPI_NATIVE_AND_MASK;
374
375 if ( native_table[index + 1].resources.selector ) {
376 *EventCode = *EventCode + 1;
377 return ( PAPI_OK );
378 } else
379 return ( PAPI_ENOEVNT );
380 } else if ( modifier == PAPI_NTV_ENUM_GROUPS ) {
381#if defined(_POWER5) || defined(_POWER6)
382 unsigned int group =
384 int index = *EventCode & 0x000000FF;
385 int i;
386 unsigned int tmpg;
387
388 *EventCode = *EventCode & ( ~PAPI_NTV_GROUP_SHIFT );
389 for ( i = 0; i < GROUP_INTS; i++ ) {
390 tmpg = native_table[index].resources.group[i];
391 if ( group != 0 ) {
392 while ( ( ffs( tmpg ) + i * 32 ) <= group && tmpg != 0 )
393 tmpg = tmpg ^ ( 1 << ( ffs( tmpg ) - 1 ) );
394 }
395 if ( tmpg != 0 ) {
396 group = ffs( tmpg ) + i * 32;
397 *EventCode = *EventCode | ( group << PAPI_NTV_GROUP_SHIFT );
398 return ( PAPI_OK );
399 }
400 }
401#endif
402 return ( PAPI_ENOEVNT );
403 } else
404 return ( PAPI_EINVAL );
405}
406
407static void
408set_config( hwd_control_state_t * ptr, int arg1, int arg2 )
409{
410 ptr->counter_cmd.events[arg1] = arg2;
411}
412
413static void
415{
416 ptr->counter_cmd.events[arg1] = 0;
417}
418
419int
421{
422 int domain = 0;
423
425#ifdef PM_INITIALIZE
426#ifdef _AIXVERSION_510
427 if ( pminfo.proc_feature.b.hypervisor ) {
428 domain |= PAPI_DOM_SUPERVISOR;
429 }
430#endif
431#endif
432 return ( domain );
433}
434
435static int
436_aix_set_domain( hwd_control_state_t * this_state, int domain )
437{
438 pm_mode_t *mode = &( this_state->counter_cmd.mode );
439 int did = 0;
440
441 mode->b.user = 0;
442 mode->b.kernel = 0;
443 if ( domain & PAPI_DOM_USER ) {
444 did++;
445 mode->b.user = 1;
446 }
447 if ( domain & PAPI_DOM_KERNEL ) {
448 did++;
449 mode->b.kernel = 1;
450 }
451#ifdef PM_INITIALIZE
452#ifdef _AIXVERSION_510
453 if ( ( domain & PAPI_DOM_SUPERVISOR ) && pminfo.proc_feature.b.hypervisor ) {
454 did++;
455 mode->b.hypervisor = 1;
456 }
457#endif
458#endif
459 if ( did )
460 return ( PAPI_OK );
461 else
462 return ( PAPI_EINVAL );
463/*
464 switch (domain)
465 {
466 case PAPI_DOM_USER:
467 mode->b.user = 1;
468 mode->b.kernel = 0;
469 break;
470 case PAPI_DOM_KERNEL:
471 mode->b.user = 0;
472 mode->b.kernel = 1;
473 break;
474 case PAPI_DOM_ALL:
475 mode->b.user = 1;
476 mode->b.kernel = 1;
477 break;
478 default:
479 return(PAPI_EINVAL);
480 }
481 return(PAPI_OK);
482*/
483}
484
485int
486_aix_set_granularity( hwd_control_state_t * this_state, int domain )
487{
488 pm_mode_t *mode = &( this_state->counter_cmd.mode );
489
490 switch ( domain ) {
491 case PAPI_GRN_THR:
492 mode->b.process = 0;
493 mode->b.proctree = 0;
494 break;
495 /* case PAPI_GRN_PROC:
496 mode->b.process = 1;
497 mode->b.proctree = 0;
498 break;
499 case PAPI_GRN_PROCG:
500 mode->b.process = 0;
501 mode->b.proctree = 1;
502 break; */
503 default:
504 return ( PAPI_EINVAL );
505 }
506 return ( PAPI_OK );
507}
508
509static int
511{
512 hwd_control_state_t *current_state = zero->ctl_state;
513 return ( _aix_set_domain( current_state, domain ) );
514}
515
516static int
517set_default_granularity( EventSetInfo_t * zero, int granularity )
518{
519 hwd_control_state_t *current_state = zero->ctl_state;
520 return ( _aix_set_granularity( current_state, granularity ) );
521}
522
523/* Initialize the system-specific settings */
524/* Machine info structure. -1 is unused. */
525int
527{
528 int retval;
529
530 if ( ( retval = uname( &AixVer ) ) < 0 )
531 return ( PAPI_ESYS );
532 if ( AixVer.version[0] == '4' ) {
544 ( vptr_t ) END_OF_BSS;
545 } else {
547 }
548
549/* _papi_hwi_system_info.supports_64bit_counters = 1;
550 _papi_hwi_system_info.supports_real_usec = 1;
551 _papi_hwi_system_info.sub_info.fast_real_timer = 1;
552 _papi_hwi_system_info.sub_info->available_domains = init_domain();*/
553
554
555 return ( PAPI_OK );
556}
557
558
559static int
561{
562 int retval;
563 /* pm_info_t pminfo; */
564 struct procsinfo psi = { 0 };
565 pid_t pid;
566 char maxargs[PAPI_HUGE_STR_LEN];
567 char pname[PAPI_HUGE_STR_LEN];
568
569 pid = getpid( );
570 if ( pid == -1 )
571 return ( PAPI_ESYS );
573 psi.pi_pid = pid;
574 retval = getargs( &psi, sizeof ( psi ), maxargs, PAPI_HUGE_STR_LEN );
575 if ( retval == -1 )
576 return ( PAPI_ESYS );
577
578 if ( realpath( maxargs, pname ) )
581 else
582 strncpy( _papi_hwi_system_info.exe_info.fullname, maxargs,
584
586 basename( maxargs ) );
587
588#ifdef _POWER7
589 /* we pass PM_POWER7 for the same reasons as below (power6 case) */
590 retval = pm_initialize( PM_INIT_FLAGS , &pminfo, &pmgroups, PM_POWER7);
591#elif defined(_POWER6)
592 /* problem with pm_initialize(): it cannot be called multiple times with
593 PM_CURRENT; use instead the actual proc type - here PM_POWER6 -
594 and multiple invocations are no longer a problem */
595 retval = pm_initialize( PM_INIT_FLAGS, &pminfo, &pmgroups, PM_POWER6 );
596#else
597#ifdef _AIXVERSION_510
598#ifdef PM_INITIALIZE
599 SUBDBG( "Calling AIX 5 version of pm_initialize...\n" );
600/*#if defined(_POWER5)
601 retval = pm_initialize(PM_INIT_FLAGS, &pminfo, &pmgroups, PM_POWER5);
602#endif*/
603 retval = pm_initialize( PM_INIT_FLAGS, &pminfo, &pmgroups, PM_CURRENT );
604#else
605 SUBDBG( "Calling AIX 5 version of pm_init...\n" );
606 retval = pm_init( PM_INIT_FLAGS, &pminfo, &pmgroups );
607#endif
608
609#else
610 SUBDBG( "Calling AIX 4 version of pm_init...\n" );
611 retval = pm_init( PM_INIT_FLAGS, &pminfo );
612#endif
613#endif
614 SUBDBG( "...Back from pm_init\n" );
615
616 if ( retval > 0 )
617 return ( retval );
618
619 _aix_mdi_init( );
620
622 _papi_hwi_system_info.hw_info.ncpu = _system_configuration.ncpus;
628 _papi_hwi_system_info.hw_info.model = _system_configuration.implementation;
631 ( float ) _system_configuration.version;
632 _papi_hwi_system_info.hw_info.mhz = ( float ) ( pm_cycles( ) / 1000000.0 );
635
636/* _papi_hwi_system_info.num_gp_cntrs = pminfo.maxpmcs;*/
639
641/* This field doesn't appear to exist in the PAPI 3.0 structure
642 _papi_hwi_system_info.cpunum = mycpu();
643*/
645 return PAPI_OK;
646}
647
648/* Low level functions, should not handle errors, just return codes. */
649
650/* At init time, the higher level library should always allocate and
651 reserve EventSet zero. */
652
653long long
655{
656 timebasestruct_t t;
657 long long retval;
658
659 read_real_time( &t, TIMEBASE_SZ );
660 time_base_to_time( &t, TIMEBASE_SZ );
661 retval = ( t.tb_high * 1000000 ) + t.tb_low / 1000;
662 return ( retval );
663}
664
665long long
667{
668 return ( _aix_get_real_usec( ) *
670}
671
672long long
674{
675 long long retval;
676 struct tms buffer;
677
678 times( &buffer );
679 SUBDBG( "user %d system %d\n", ( int ) buffer.tms_utime,
680 ( int ) buffer.tms_stime );
681 retval =
682 ( long long ) ( ( buffer.tms_utime + buffer.tms_stime ) *
683 ( 1000000 / CLK_TCK ) );
684 return ( retval );
685}
686
687static void
689{
690 int i;
691 for ( i = 0; i < PAPI_MAX_LOCK; i++ )
692 lock[i] = ( int * ) ( lock_var + i );
693}
694
695int
697{
698 return ( PAPI_OK );
699}
700
701int
703{
704 int retval = PAPI_OK, procidx;
705
706 /* Fill in what we can of the papi_system_info. */
708 if ( retval )
709 return ( retval );
710
711 /* Setup memory info */
713 if ( retval )
714 return ( retval );
715
716 SUBDBG( "Found %d %s %s CPUs at %d Mhz.\n",
721
724
725 procidx = pm_get_procindex( );
726 switch ( procidx ) {
727 case PM_POWER5:
728 _papi_load_preset_table( "POWER5", 0, cidx );
729 break;
730 case PM_POWER5_II:
731 _papi_load_preset_table( "POWER5+", 0, cidx );
732 break;
733 case PM_POWER6:
734 _papi_load_preset_table( "POWER6", 0, cidx );
735 break;
736 case PM_PowerPC970:
737 _papi_load_preset_table( "PPC970", 0, cidx );
738 break;
739 case PM_POWER7:
740 _papi_load_preset_table( "POWER7", 0, cidx );
741 break;
742 default:
743 fprintf( stderr, "%s is not supported!\n", pminfo.proc_name );
744 return PAPI_ENOIMPL;
745 }
746
748
749 return ( retval );
750}
751
752
753int
755{
756 int retval;
757 /* Initialize our global control state. */
758
759 _aix_init_control_state( &context->cntrl );
760}
761
762/* Go from highest counter to lowest counter. Why? Because there are usually
763 more counters on #1, so we try the least probable first. */
764
765static int
766get_avail_hwcntr_bits( int cntr_avail_bits )
767{
768 int tmp = 0, i = 1 << ( POWER_MAX_COUNTERS - 1 );
769
770 while ( i ) {
771 tmp = i & cntr_avail_bits;
772 if ( tmp )
773 return ( tmp );
774 i = i >> 1;
775 }
776 return ( 0 );
777}
778
779static void
780set_hwcntr_codes( int selector, unsigned char *from, int *to )
781{
782 int useme, i;
783
784 for ( i = 0; i < _aix_vector.cmp_info.num_cntrs; i++ ) {
785 useme = ( 1 << i ) & selector;
786 if ( useme ) {
787 to[i] = from[i];
788 }
789 }
790}
791
792
793#ifdef DEBUG
794void
795dump_cmd( pm_prog_t * t )
796{
797 SUBDBG( "mode.b.threshold %d\n", t->mode.b.threshold );
798 SUBDBG( "mode.b.spare %d\n", t->mode.b.spare );
799 SUBDBG( "mode.b.process %d\n", t->mode.b.process );
800 SUBDBG( "mode.b.kernel %d\n", t->mode.b.kernel );
801 SUBDBG( "mode.b.user %d\n", t->mode.b.user );
802 SUBDBG( "mode.b.count %d\n", t->mode.b.count );
803 SUBDBG( "mode.b.proctree %d\n", t->mode.b.proctree );
804 SUBDBG( "events[0] %d\n", t->events[0] );
805 SUBDBG( "events[1] %d\n", t->events[1] );
806 SUBDBG( "events[2] %d\n", t->events[2] );
807 SUBDBG( "events[3] %d\n", t->events[3] );
808 SUBDBG( "events[4] %d\n", t->events[4] );
809 SUBDBG( "events[5] %d\n", t->events[5] );
810 SUBDBG( "events[6] %d\n", t->events[6] );
811 SUBDBG( "events[7] %d\n", t->events[7] );
812 SUBDBG( "reserved %d\n", t->reserved );
813}
814
815void
816dump_data( long long *vals )
817{
818 int i;
819
820 for ( i = 0; i < MAX_COUNTERS; i++ ) {
821 SUBDBG( "counter[%d] = %lld\n", i, vals[i] );
822 }
823}
824#endif
825
826int
828{
829 int retval = pm_reset_data_mythread( );
830 if ( retval > 0 ) {
832 pm_error( "PAPI Error: pm_reset_data_mythread", retval );
833 return ( retval );
834 }
835 return ( PAPI_OK );
836}
837
838
839int
841 long long **vals, int flags )
842{
843 int retval;
844
845 retval = pm_get_data_mythread( &spc->state );
846 if ( retval > 0 ) {
848 pm_error( "PAPI Error: pm_get_data_mythread", retval );
849 return ( retval );
850 }
851
852 *vals = spc->state.accu;
853
854#ifdef DEBUG
855 if ( ISLEVEL( DEBUG_SUBSTRATE ) )
856 dump_data( *vals );
857#endif
858
859 return ( PAPI_OK );
860}
861
862static int
864{
865 if ( ns <= _papi_os_info.itimer_res_ns ) {
867 } else {
868 int leftover_ns = ns % _papi_os_info.itimer_res_ns;
869 return ( ns - leftover_ns + _papi_os_info.itimer_res_ns );
870 }
871}
872
873int
874_aix_ctl( hwd_context_t * ctx, int code, _papi_int_option_t * option )
875{
876 switch ( code ) {
877/* I don't understand what it means to set the default domain
878 case PAPI_DEFDOM:
879 return(set_default_domain(zero, option->domain.domain));
880*/
881 case PAPI_DOMAIN:
882 return ( _aix_set_domain
883 ( option->domain.ESI->ctl_state, option->domain.domain ) );
884/* I don't understand what it means to set the default granularity
885 case PAPI_DEFGRN:
886 return(set_default_granularity(zero, option->granularity.granularity));
887*/
888 case PAPI_GRANUL:
889 return ( _aix_set_granularity
890 ( option->domain.ESI->ctl_state,
891 option->granularity.granularity ) );
892#if 0
893 case PAPI_INHERIT:
894 return ( set_inherit( option->inherit.inherit ) );
895#endif
896 case PAPI_DEF_ITIMER:
897 {
898 /* flags are currently ignored, eventually the flags will be able
899 to specify whether or not we use POSIX itimers (clock_gettimer) */
900 if ( ( option->itimer.itimer_num == ITIMER_REAL ) &&
901 ( option->itimer.itimer_sig != SIGALRM ) )
902 return PAPI_EINVAL;
903 if ( ( option->itimer.itimer_num == ITIMER_VIRTUAL ) &&
904 ( option->itimer.itimer_sig != SIGVTALRM ) )
905 return PAPI_EINVAL;
906 if ( ( option->itimer.itimer_num == ITIMER_PROF ) &&
907 ( option->itimer.itimer_sig != SIGPROF ) )
908 return PAPI_EINVAL;
909 if ( option->itimer.ns > 0 )
910 option->itimer.ns = round_requested_ns( option->itimer.ns );
911 /* At this point, we assume the user knows what he or
912 she is doing, they maybe doing something arch specific */
913 return PAPI_OK;
914 }
915 case PAPI_DEF_MPX_NS:
916 {
917 option->multiplex.ns = round_requested_ns( option->multiplex.ns );
918 return ( PAPI_OK );
919 }
921 {
922 option->itimer.ns = round_requested_ns( option->itimer.ns );
923 return ( PAPI_OK );
924 }
925 default:
926 return ( PAPI_ENOSUPP );
927 }
928}
929
930void
932{
934 ThreadInfo_t *t = NULL;
935 vptr_t address;
936
937 ctx.si = si;
938 ctx.ucontext = ( hwd_ucontext_t * ) i;
939
940 address = ( vptr_t ) GET_OVERFLOW_ADDRESS( ( &ctx ) );
941 _papi_hwi_dispatch_overflow_signal( ( void * ) &ctx, address, NULL, 0, 0,
943}
944
945int
946_aix_set_overflow( EventSetInfo_t * ESI, int EventIndex, int threshold )
947{
948 hwd_control_state_t *this_state = ESI->ctl_state;
949
950 return ( PAPI_OK );
951}
952
953void *
955{
956 void *location;
957 struct sigcontext *info = ( struct sigcontext * ) context;
958 location = ( void * ) info->sc_jmpbuf.jmp_context.iar;
959
960 return ( location );
961}
962
963
964/* Copy the current control_state into the new thread context */
965/*int _papi_hwd_start(EventSetInfo_t *ESI, EventSetInfo_t *zero)*/
966int
968{
969 int i, retval;
970 hwd_control_state_t *current_state = &ctx->cntrl;
971
972 /* If we are nested, merge the global counter structure
973 with the current eventset */
974
975 SUBDBG( "Start\n" );
976
977 /* Copy the global counter structure to the current eventset */
978
979 SUBDBG( "Copying states\n" );
980 memcpy( current_state, cntrl, sizeof ( hwd_control_state_t ) );
981
982 retval = pm_set_program_mythread( &current_state->counter_cmd );
983 if ( retval > 0 ) {
984 if ( retval == 13 ) {
985 retval = pm_delete_program_mythread( );
986 if ( retval > 0 ) {
988 pm_error( "PAPI Error: pm_delete_program_mythread",
989 retval );
990 return ( retval );
991 }
992 retval = pm_set_program_mythread( &current_state->counter_cmd );
993 if ( retval > 0 ) {
995 pm_error( "PAPI Error: pm_set_program_mythread", retval );
996 return ( retval );
997 }
998 } else {
1000 pm_error( "PAPI Error: pm_set_program_mythread", retval );
1001 return ( retval );
1002 }
1003 }
1004
1005 /* Set up the new merged control structure */
1006
1007#if 0
1008 dump_cmd( &current_state->counter_cmd );
1009#endif
1010
1011 /* Start the counters */
1012
1013 retval = pm_start_mythread( );
1014 if ( retval > 0 ) {
1016 pm_error( "pm_start_mythread()", retval );
1017 return ( retval );
1018 }
1019
1020 return ( PAPI_OK );
1021}
1022
1023int
1025{
1026 int retval;
1027
1028 retval = pm_stop_mythread( );
1029 if ( retval > 0 ) {
1031 pm_error( "pm_stop_mythread()", retval );
1032 return ( retval );
1033 }
1034
1035 retval = pm_delete_program_mythread( );
1036 if ( retval > 0 ) {
1038 pm_error( "pm_delete_program_mythread()", retval );
1039 return ( retval );
1040 }
1041
1042 return ( PAPI_OK );
1043}
1044
1045int
1047{
1048#if ( ( defined( _AIXVERSION_510) || defined(_AIXVERSION_520)))
1049 struct ma_msg_s
1050 {
1051 long flag;
1052 char *name;
1053 } ma_msgs[] = {
1054 {
1055 MA_MAINEXEC, "MAINEXEC"}, {
1056 MA_KERNTEXT, "KERNTEXT"}, {
1057 MA_READ, "READ"}, {
1058 MA_WRITE, "WRITE"}, {
1059 MA_EXEC, "EXEC"}, {
1060 MA_SHARED, "SHARED"}, {
1061 MA_BREAK, "BREAK"}, {
1062 MA_STACK, "STACK"},};
1063
1064 char fname[80], name[PAPI_HUGE_STR_LEN];
1065 prmap_t newp;
1066 int count, t_index, retval, i, j, not_first_flag_bit;
1067 FILE *map_f;
1068 void *vaddr;
1069 prmap_t *tmp1 = NULL;
1070 PAPI_address_map_t *tmp2 = NULL;
1071
1072 sprintf( fname, "/proc/%d/map", getpid( ) );
1073 map_f = fopen( fname, "r" );
1074 if ( !map_f ) {
1075 PAPIERROR( "fopen(%s) returned < 0", fname );
1076 return ( PAPI_OK );
1077 }
1078
1079 /* count the entries we need */
1080 count = 0;
1081 t_index = 0;
1082 while ( ( retval = fread( &newp, sizeof ( prmap_t ), 1, map_f ) ) > 0 ) {
1083 if ( newp.pr_pathoff > 0 && newp.pr_mapname[0] != '\0' ) {
1084 if ( newp.pr_mflags & MA_STACK )
1085 continue;
1086
1087 count++;
1088 SUBDBG( "count=%d offset=%ld map=%s\n", count,
1089 newp.pr_pathoff, newp.pr_mapname );
1090
1091 if ( ( newp.pr_mflags & MA_READ ) && ( newp.pr_mflags & MA_EXEC ) )
1092 t_index++;
1093 }
1094 }
1095 rewind( map_f );
1096 tmp1 = ( prmap_t * ) papi_calloc( ( count + 1 ), sizeof ( prmap_t ) );
1097 if ( tmp1 == NULL )
1098 return ( PAPI_ENOMEM );
1099
1100 tmp2 =
1101 ( PAPI_address_map_t * ) papi_calloc( t_index,
1102 sizeof ( PAPI_address_map_t ) );
1103 if ( tmp2 == NULL )
1104 return ( PAPI_ENOMEM );
1105
1106 i = 0;
1107 t_index = -1;
1108 while ( ( retval = fread( &tmp1[i], sizeof ( prmap_t ), 1, map_f ) ) > 0 ) {
1109 if ( tmp1[i].pr_pathoff > 0 && tmp1[i].pr_mapname[0] != '\0' )
1110 if ( !( tmp1[i].pr_mflags & MA_STACK ) )
1111 i++;
1112 }
1113 for ( i = 0; i < count; i++ ) {
1114 char c;
1115 int cc = 0;
1116
1117 retval = fseek( map_f, tmp1[i].pr_pathoff, SEEK_SET );
1118 if ( retval != 0 )
1119 return ( PAPI_ESYS );
1120 while ( fscanf( map_f, "%c", &c ) != EOF ) {
1121 name[cc] = c;
1122 /* how many char are hold in /proc/xxxx/map */
1123 cc++;
1124 if ( c == '\0' )
1125 break;
1126 }
1127
1128
1129 /* currently /proc/xxxx/map file holds only 33 char per line (incl NULL char);
1130 * if executable name > 32 char, compare first 32 char only */
1132 basename( name ), cc - 1 ) == 0 ) {
1134 cc - 1 )
1135 PAPIERROR
1136 ( "executable name too long (%d char). Match of first %d char only",
1138 name ), cc - 1 );
1139
1140 if ( tmp1[i].pr_mflags & MA_READ ) {
1141 if ( tmp1[i].pr_mflags & MA_EXEC ) {
1143 text_start = ( vptr_t ) tmp1[i].pr_vaddr;
1145 text_end =
1146 ( vptr_t ) ( tmp1[i].pr_vaddr + tmp1[i].pr_size );
1147 } else if ( tmp1[i].pr_mflags & MA_WRITE ) {
1149 data_start = ( vptr_t ) tmp1[i].pr_vaddr;
1151 data_end =
1152 ( vptr_t ) ( tmp1[i].pr_vaddr + tmp1[i].pr_size );
1153 }
1154 }
1155
1156 } else {
1159 0 ) &&
1162 0 ) )
1163 PAPIERROR( "executable name not recognized" );
1164
1165 if ( tmp1[i].pr_mflags & MA_READ ) {
1166 if ( tmp1[i].pr_mflags & MA_EXEC ) {
1167 t_index++;
1168 tmp2[t_index].text_start = ( vptr_t ) tmp1[i].pr_vaddr;
1169 tmp2[t_index].text_end =
1170 ( vptr_t ) ( tmp1[i].pr_vaddr + tmp1[i].pr_size );
1171 strncpy( tmp2[t_index].name, name, PAPI_MAX_STR_LEN );
1172 } else if ( tmp1[i].pr_mflags & MA_WRITE ) {
1173 tmp2[t_index].data_start = ( vptr_t ) tmp1[i].pr_vaddr;
1174 tmp2[t_index].data_end =
1175 ( vptr_t ) ( tmp1[i].pr_vaddr + tmp1[i].pr_size );
1176 }
1177 }
1178
1179 }
1180 }
1181 fclose( map_f );
1182
1187 papi_free( tmp1 );
1188
1189 return PAPI_OK;
1190#else
1191 return PAPI_ENOIMPL;
1192#endif
1193}
1194
1195int
1196_aix_ntv_name_to_code( const char *name, unsigned int *evtcode )
1197{
1198 int i;
1199
1200 for ( i = 0; i < PAPI_MAX_NATIVE_EVENTS; i++ )
1201 if ( strcmp( name, native_name_map[i].name ) == 0 ) {
1203 return PAPI_OK;
1204 }
1205
1206 return PAPI_ENOEVNT;
1207}
1208
1209
1211
1212int
1214
1215 struct utsname uname_buffer;
1216
1217 uname(&uname_buffer);
1218
1219 strncpy(_papi_os_info.name,uname_buffer.sysname,PAPI_MAX_STR_LEN);
1220
1221 strncpy(_papi_os_info.version,uname_buffer.release,PAPI_MAX_STR_LEN);
1222
1227
1228 return PAPI_OK;
1229
1230}
1231
1232
1234 .cmp_info = {
1235 /* default component information (unspecified values are initialized to 0) */
1236
1237 .name = "aix",
1238 .description = "AIX pmapi CPU counters",
1239 .default_domain = PAPI_DOM_USER,
1240 .available_domains = PAPI_DOM_USER | PAPI_DOM_KERNEL,
1241 .default_granularity = PAPI_GRN_THR,
1242 .available_granularities = PAPI_GRN_THR,
1243 .hardware_intr_sig = PAPI_INT_SIGNAL,
1244
1245 /* component specific cmp_info initializations */
1246 .fast_real_timer = 1,
1247 .fast_virtual_timer = 1,
1248 .attach = 1,
1249 .attach_must_ptrace = 1,
1250 .cntr_umasks = 1,
1251 }
1252 ,
1253
1254 /* sizes of framework-opaque component-private structures
1255 these are remapped in pmapi_ppc64.h, ppc64_events.h */
1256 .size = {
1257 .context = sizeof ( hwd_context_t ),
1258 .control_state = sizeof ( hwd_control_state_t ),
1259 .reg_value = sizeof ( hwd_register_t ),
1260 .reg_alloc = sizeof ( hwd_reg_alloc_t ),
1261 }
1262 ,
1263
1264 /* function pointers in this component */
1265 .init_control_state = _aix_init_control_state,
1266 .start = _aix_start,
1267 .stop = _aix_stop,
1268 .read = _aix_read,
1269 .allocate_registers = _aix_allocate_registers,
1270 .update_control_state = _aix_update_control_state,
1271 .set_domain = _aix_set_domain,
1272 .reset = _aix_reset,
1273 .set_overflow = _aix_set_overflow,
1274/* .stop_profiling = _aix_stop_profiling, */
1275 .ntv_enum_events = _aix_ntv_enum_events,
1276 .ntv_name_to_code = _aix_ntv_name_to_code,
1277 .ntv_code_to_name = _aix_ntv_code_to_name,
1278 .ntv_code_to_descr = _aix_ntv_code_to_descr,
1279 .ntv_code_to_bits = _aix_ntv_code_to_bits,
1280
1281 .init_component = _aix_init_component,
1282 .ctl = _aix_ctl,
1283 .dispatch_timer = _aix_dispatch_timer,
1284 .init_thread = _aix_init_thread,
1285 .shutdown_thread = _aix_shutdown_thread,
1286};
1287
1290 .get_dmem_info = _aix_get_dmem_info,
1291 .get_real_usec = _aix_get_real_usec,
1292 .get_real_cycles = _aix_get_real_cycles,
1293 .get_virt_usec = _aix_get_virt_usec,
1294 .update_shlib_info = _aix_update_shlib_info,
1295 .get_system_info = _aix_get_system_info,
1296};
double tmp
int i
#define GET_OVERFLOW_ADDRESS(ctx)
Definition: aix-context.h:12
int _aix_get_memory_info(PAPI_hw_info_t *mem_info, int type)
Definition: aix-memory.c:16
int _aix_get_dmem_info(PAPI_dmem_info_t *d)
Definition: aix-memory.c:64
int _aix_reset(hwd_context_t *ESI, hwd_control_state_t *zero)
Definition: aix.c:827
int _aix_init_component(int cidx)
Definition: aix.c:702
int _aix_start(hwd_context_t *ctx, hwd_control_state_t *cntrl)
Definition: aix.c:967
int _aix_update_shlib_info(papi_mdi_t *mdi)
Definition: aix.c:1046
int _aix_ntv_name_to_code(const char *name, unsigned int *evtcode)
Definition: aix.c:1196
int _aix_mdi_init()
Definition: aix.c:526
pm_groups_info_t pmgroups
Definition: aix.c:44
atomic_p lock[PAPI_MAX_LOCK]
Definition: aix.c:25
long long _aix_get_real_cycles(void)
Definition: aix.c:666
int _aix_ntv_code_to_descr(unsigned int EventCode, char *ntv_descr, int len)
Definition: aix.c:330
static void set_hwcntr_codes(int selector, unsigned char *from, int *to)
Definition: aix.c:780
int _aix_init_thread(hwd_context_t *context)
Definition: aix.c:754
hwd_groups_t group_map[MAX_GROUPS]
Definition: aix.c:47
void * _aix_get_overflow_address(void *context)
Definition: aix.c:954
#define START_OF_BSS
Definition: aix.c:35
PPC64_native_map_t native_name_map[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:46
struct utsname AixVer
Definition: aix.c:39
#define START_OF_DATA
Definition: aix.c:33
int _aix_set_granularity(hwd_control_state_t *this_state, int domain)
Definition: aix.c:486
#define END_OF_BSS
Definition: aix.c:36
static int maxgroups
Definition: aix.c:38
static int _aix_set_domain(hwd_control_state_t *this_state, int domain)
Definition: aix.c:436
int _aix_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
Definition: aix.c:874
#define END_OF_TEXT
Definition: aix.c:32
#define END_OF_DATA
Definition: aix.c:34
static int set_default_granularity(EventSetInfo_t *zero, int granularity)
Definition: aix.c:517
long long _aix_get_virt_usec(void)
Definition: aix.c:673
int _aix_set_overflow(EventSetInfo_t *ESI, int EventIndex, int threshold)
Definition: aix.c:946
#define START_OF_TEXT
Definition: aix.c:31
int _aix_read(hwd_context_t *ctx, hwd_control_state_t *spc, long long **vals, int flags)
Definition: aix.c:840
static void unset_config(hwd_control_state_t *ptr, int arg1)
Definition: aix.c:414
int _aix_init_control_state(hwd_control_state_t *ptr)
Definition: aix.c:254
volatile int lock_var[PAPI_MAX_LOCK]
Definition: aix.c:24
int _papi_hwi_init_os(void)
Definition: aix.c:1213
int _aix_ntv_enum_events(unsigned int *EventCode, int modifier)
Definition: aix.c:366
papi_vector_t _aix_vector
Definition: aix.c:21
native_event_entry_t native_table[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:41
void aix_initialize_native_table()
Definition: aix.c:51
static void aix_ppc64_setup_gps(int total)
Definition: aix.c:68
PAPI_os_info_t _papi_os_info
Definition: aix.c:1210
static void copy_value(unsigned int val, char *nam, char *names, unsigned int *values, int len)
Definition: aix.c:146
void dump_cmd(pm_prog_t *t)
Definition: aix.c:795
static int set_default_domain(EventSetInfo_t *zero, int domain)
Definition: aix.c:510
static int do_counter_allocation(ppc64_reg_alloc_t *event_list, int size)
Definition: aix.c:160
int _aix_stop(hwd_context_t *ctx, hwd_control_state_t *cntrl)
Definition: aix.c:1024
hwd_pminfo_t pminfo
Definition: aix.c:43
int _aix_ntv_code_to_name(unsigned int EventCode, char *ntv_name, int len)
Definition: aix.c:315
static int round_requested_ns(int ns)
Definition: aix.c:863
static void set_config(hwd_control_state_t *ptr, int arg1, int arg2)
Definition: aix.c:408
long long _aix_get_real_usec(void)
Definition: aix.c:654
int _aix_shutdown_thread(hwd_context_t *ctx)
Definition: aix.c:696
static void _aix_lock_init(void)
Definition: aix.c:688
void _aix_dispatch_timer(int signal, siginfo_t *si, void *i)
Definition: aix.c:931
static char * trim_string(char *in)
Definition: aix.c:289
int aix_ppc64_setup_native_table()
Definition: aix.c:106
int _aix_update_control_state(hwd_control_state_t *this_state, NativeInfo_t *native, int count, hwd_context_t *context)
Definition: aix.c:273
static int get_avail_hwcntr_bits(int cntr_avail_bits)
Definition: aix.c:766
int _aix_allocate_registers(EventSetInfo_t *ESI)
Definition: aix.c:201
void dump_data(long long *vals)
Definition: aix.c:816
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
int _aix_ntv_code_to_bits(unsigned int EventCode, hwd_register_t *bits)
Definition: aix.c:348
static int _aix_get_system_info(papi_mdi_t *mdi)
Definition: aix.c:560
int init_domain()
Definition: aix.c:420
pm_events_t hwd_pmevents_t
Definition: aix.h:82
pm_info_t hwd_pminfo_t
Definition: aix.h:81
#define POWER_MAX_COUNTERS
Definition: aix.h:43
#define PM_INIT_FLAGS
Definition: aix.h:75
#define MAX_MPX_COUNTERS
Definition: aix.h:45
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: appio.c:279
const char * names[NUM_EVENTS]
static long count
int _papi_hwi_dispatch_overflow_signal(void *papiContext, vptr_t address, int *isHardware, long long overflow_bit, int genOverflowBit, ThreadInfo_t **t, int cidx)
Definition: extras.c:216
#define PAPI_DOM_USER
Definition: f90papi.h:174
#define PAPI_ENUM_EVENTS
Definition: f90papi.h:224
#define PAPI_DOM_OTHER
Definition: f90papi.h:21
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NTV_GROUP_AND_MASK
Definition: f90papi.h:30
#define PAPI_ENUM_FIRST
Definition: f90papi.h:85
#define PAPI_QUIET
Definition: f90papi.h:132
#define PAPI_GRANUL
Definition: f90papi.h:179
#define PAPI_ECNFLCT
Definition: f90papi.h:234
#define PAPI_DOM_KERNEL
Definition: f90papi.h:254
#define PAPI_ENOEVNT
Definition: f90papi.h:139
#define PAPI_DOM_SUPERVISOR
Definition: f90papi.h:109
#define PAPI_EINVAL
Definition: f90papi.h:115
#define PAPI_ENOSUPP
Definition: f90papi.h:244
#define PAPI_MAX_STR_LEN
Definition: f90papi.h:77
#define PAPI_DOMAIN
Definition: f90papi.h:159
#define PAPI_DEF_MPX_NS
Definition: f90papi.h:235
#define PAPI_ESYS
Definition: f90papi.h:136
#define PAPI_INHERIT
Definition: f90papi.h:76
#define PAPI_NTV_GROUP_SHIFT
Definition: f90papi.h:162
#define PAPI_ENOMEM
Definition: f90papi.h:16
#define PAPI_EBUF
Definition: f90papi.h:253
#define PAPI_ENOIMPL
Definition: f90papi.h:219
#define PAPI_GRN_THR
Definition: f90papi.h:265
#define PAPI_HUGE_STR_LEN
Definition: f90papi.h:120
#define PAPI_DEF_ITIMER
Definition: papi.h:462
#define PAPI_DEF_ITIMER_NS
Definition: papi.h:463
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
static int threshold
static struct timeval start
static double c[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:40
uint16_t location
#define PAPI_NATIVE_AND_MASK
#define PAPI_NATIVE_MASK
Return codes and api definitions.
@ PAPI_NTV_ENUM_GROUPS
Definition: papi.h:514
void * vptr_t
Definition: papi.h:576
#define DEBUG_SUBSTRATE
Definition: papi_debug.h:27
#define SUBDBG(format, args...)
Definition: papi_debug.h:64
#define ISLEVEL(a)
Definition: papi_debug.h:55
__sighandler_t signal(int __sig, __sighandler_t __handler) __attribute__((__nothrow__
FILE * stderr
int fclose(FILE *__stream)
void PAPIERROR(char *format,...)
int _papi_hwi_error_level
Definition: papi_internal.c:54
#define PAPI_INT_MPX_SIGNAL
Definition: papi_internal.h:51
#define PAPI_INT_MPX_DEF_US
Definition: papi_internal.h:64
#define hwd_context_t
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:52
#define PAPI_INT_ITIMER
Definition: papi_internal.h:53
#define hwd_register_t
#define PAPI_MAX_LOCK
Definition: papi_lock.h:18
#define papi_calloc(a, b)
Definition: papi_memory.h:37
#define papi_free(a)
Definition: papi_memory.h:35
int _papi_load_preset_table(char *pmu_str, int pmu_type, int cidx)
Definition: papi_preset.c:771
static int native
static int cidx
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:56
#define MAX_COUNTERS
Definition: perfctr-x86.h:8
static int set_inherit(int arg)
static int total
Definition: rapl_overflow.c:9
const char * name
Definition: rocs.c:225
long long int long long
Definition: sde_internal.h:85
static int pid
hwd_control_state_t * ctl_state
NativeInfo_t * NativeInfoArray
get the executable's address space info
Definition: papi.h:684
vptr_t text_start
Definition: papi.h:686
char name[PAPI_HUGE_STR_LEN]
Definition: papi.h:685
vptr_t text_end
Definition: papi.h:687
vptr_t bss_start
Definition: papi.h:690
vptr_t data_end
Definition: papi.h:689
vptr_t data_start
Definition: papi.h:688
vptr_t bss_end
Definition: papi.h:691
int default_granularity
Definition: papi.h:644
int available_granularities
Definition: papi.h:645
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:627
char fullname[PAPI_HUGE_STR_LEN]
Definition: papi.h:697
PAPI_address_map_t address_info
Definition: papi.h:698
char vendor_string[PAPI_MAX_STR_LEN]
Definition: papi.h:782
float mhz
Definition: papi.h:801
int nnodes
Definition: papi.h:779
int model
Definition: papi.h:783
int totalcpus
Definition: papi.h:780
int vendor
Definition: papi.h:781
float revision
Definition: papi.h:785
int cpu_min_mhz
Definition: papi.h:791
int ncpu
Definition: papi.h:775
char model_string[PAPI_MAX_STR_LEN]
Definition: papi.h:784
int cpu_max_mhz
Definition: papi.h:790
char version[PAPI_MAX_STR_LEN]
char name[PAPI_MAX_STR_LEN]
PAPI_address_map_t * map
Definition: papi.h:703
unsigned int counter_cmd[MAX_COUNTERS]
Definition: ppc64_events.h:52
unsigned int selector
Definition: perfctr-x86.h:74
hwd_siginfo_t * si
hwd_ucontext_t * ucontext
EventSetInfo_t * ESI
papi_cpc_event_t counter_cmd
Definition: solaris-ultra.h:61
Definition: perfctr-x86.h:134
char * description
Definition: perfctr-x86.h:136
X86_register_t resources
Definition: perfctr-x86.h:137
char name[PAPI_MAX_STR_LEN]
Definition: perfctr-x86.h:135
PAPI_exe_info_t exe_info
PAPI_hw_info_t hw_info
PAPI_shlib_info_t shlib_info
int(* get_system_info)(papi_mdi_t *mdi)
Definition: papi_vector.h:68
int(* get_memory_info)(PAPI_hw_info_t *, int)
Definition: papi_vector.h:69
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
int(* set_domain)(hwd_control_state_t *, int)
Definition: papi_vector.h:42
int ra_counter_cmd[MAX_COUNTERS]
Definition: aix.h:100
unsigned int ra_group[GROUP_INTS]
Definition: aix.h:99
int ra_position
Definition: aix.h:98
_papi_int_domain_t domain
_papi_int_multiplex_t multiplex
_papi_int_granularity_t granularity
_papi_int_inherit_t inherit
_papi_int_itimer_t itimer
int retval
Definition: zero_fork.c:53