PAPI  5.3.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
solaris-ultra.c
Go to the documentation of this file.
1 /*
2 * File: solaris-ultra.c
3 * Author: Philip Mucci
4 * mucci@cs.utk.edu
5 * Mods: Kevin London
6 * london@cs.utk.edu
7 * Mods: Min Zhou
8 * min@cs.utk.edu
9 * Mods: Larry Meadows(helped us to build the native table dynamically)
10 * Mods: Brian Sheely
11 * bsheely@eecs.utk.edu
12 * Mods: Vince Weaver
13 * vweaver1@eecs.utk.edu
14 */
15 
16 /* to understand this program, first you should read the user's manual
17  about UltraSparc II and UltraSparc III, then the man pages
18  about cpc_take_sample(cpc_event_t *event)
19 */
20 
21 #include "papi.h"
22 #include "papi_internal.h"
23 #include "papi_vector.h"
24 #include "papi_memory.h"
25 #include <sys/utsname.h>
26 
27 #include "solaris-common.h"
28 #include "solaris-memory.h"
29 
30 #ifdef CPC_ULTRA3_I
31 #define LASTULTRA3 CPC_ULTRA3_I
32 #else
33 #define LASTULTRA3 CPC_ULTRA3_PLUS
34 #endif
35 
36 #define MAX_ENAME 40
37 
38 static void action( void *arg, int regno, const char *name, uint8_t bits );
39 
40 /* Probably could dispense with this and just use native_table */
41 typedef struct ctr_info
42 {
43  char *name; /* Counter name */
44  int bits[2]; /* bits for register */
45  int bitmask; /* 1 = pic0; 2 = pic1; 3 = both */
46 } ctr_info_t;
47 
48 typedef struct einfo
49 {
50  unsigned int papi_event;
51  char *event_str;
52 } einfo_t;
53 static einfo_t us3info[] = {
54  {PAPI_FP_INS, "FA_pipe_completion+FM_pipe_completion"},
55  {PAPI_FAD_INS, "FA_pipe_completion"},
56  {PAPI_FML_INS, "FM_pipe_completion"},
57  {PAPI_TLB_IM, "ITLB_miss"},
58  {PAPI_TLB_DM, "DTLB_miss"},
59  {PAPI_TOT_CYC, "Cycle_cnt"},
60  {PAPI_TOT_IIS, "Instr_cnt"},
61  {PAPI_TOT_INS, "Instr_cnt"},
62  {PAPI_L2_TCM, "EC_misses"},
63  {PAPI_L2_ICM, "EC_ic_miss"},
64  {PAPI_L1_ICM, "IC_miss"},
65  {PAPI_L1_LDM, "DC_rd_miss"},
66  {PAPI_L1_STM, "DC_wr_miss"},
67  {PAPI_L2_LDM, "EC_rd_miss"},
68  {PAPI_BR_MSP, "IU_Stat_Br_miss_taken+IU_Stat_Br_miss_untaken"},
69  {PAPI_L1_DCR, "DC_rd"},
70  {PAPI_L1_DCW, "DC_wr"},
71  {PAPI_L1_ICH, "IC_ref-IC_miss"}, /* Is this really hits only? */
72  {PAPI_L1_ICA, "IC_ref"}, /* Ditto? */
73  {PAPI_L2_TCH, "EC_ref-EC_misses"},
74  {PAPI_L2_TCA, "EC_ref"},
75 };
76 
77 static einfo_t us2info[] = {
78  {PAPI_L1_ICM, "IC_ref-IC_hit"},
79  {PAPI_L2_TCM, "EC_ref-EC_hit"},
80  {PAPI_CA_SNP, "EC_snoop_cb"},
81  {PAPI_CA_INV, "EC_snoop_inv"},
82  {PAPI_L1_LDM, "DC_rd-DC_rd_hit"},
83  {PAPI_L1_STM, "DC_wr-DC_wr_hit"},
84  {PAPI_L2_LDM, "EC_rd_miss"},
85  {PAPI_BR_MSP, "Dispatch0_mispred"},
86  {PAPI_TOT_IIS, "Instr_cnt"},
87  {PAPI_TOT_INS, "Instr_cnt"},
88  {PAPI_LD_INS, "DC_rd"},
89  {PAPI_SR_INS, "DC_wr"},
90  {PAPI_TOT_CYC, "Cycle_cnt"},
91  {PAPI_L1_DCR, "DC_rd"},
92  {PAPI_L1_DCW, "DC_wr"},
93  {PAPI_L1_ICH, "IC_hit"},
94  {PAPI_L2_ICH, "EC_ic_hit"},
95  {PAPI_L1_ICA, "IC_ref"},
96  {PAPI_L2_TCH, "EC_hit"},
97  {PAPI_L2_TCA, "EC_ref"},
98 };
99 
101 
104 
105 static struct ctr_info *ctrs;
106 static int nctrs;
107 
108 static int build_tables( void );
109 static void add_preset( hwi_search_t * tab, int *np, einfo_t e );
110 
111 /* Globals used to access the counter registers. */
112 
113 static int cpuver;
114 static int pcr_shift[2];
115 
117 
118 #ifdef DEBUG
119 static void
121 {
122  SUBDBG( "cpc_event_t.ce_cpuver %d\n", t->cmd.ce_cpuver );
123  SUBDBG( "ce_tick %llu\n", t->cmd.ce_tick );
124  SUBDBG( "ce_pic[0] %llu ce_pic[1] %llu\n", t->cmd.ce_pic[0],
125  t->cmd.ce_pic[1] );
126  SUBDBG( "ce_pcr 0x%llx\n", t->cmd.ce_pcr );
127  SUBDBG( "flags %#x\n", t->flags );
128 }
129 #endif
130 
131 static void
132 dispatch_emt( int signal, siginfo_t * sip, void *arg )
133 {
134  int event_counter;
136  caddr_t address;
137  ctx.si = sip;
138  ctx.ucontext = arg;
139  SUBDBG( "%d, %p, %p\n", signal, sip, arg );
140 
141  if ( sip->si_code == EMT_CPCOVF ) {
142  papi_cpc_event_t *sample;
143  EventSetInfo_t *ESI;
144  ThreadInfo_t *thread = NULL;
145  int t, overflow_vector, readvalue;
146 
147  thread = _papi_hwi_lookup_thread( 0 );
148  ESI = ( EventSetInfo_t * ) thread->running_eventset;
149  int cidx = ESI->CmpIdx;
150 
151  if ( ( ESI == NULL ) || ( ( ESI->state & PAPI_OVERFLOWING ) == 0 ) ) {
152  OVFDBG( "Either no eventset or eventset not set to overflow.\n" );
153  return;
154  }
155 
156  if ( ESI->master != thread ) {
157  PAPIERROR
158  ( "eventset->thread 0x%lx vs. current thread 0x%lx mismatch",
159  ESI->master, thread );
160  return;
161  }
162 
163  event_counter = ESI->overflow.event_counter;
164  sample = &( ESI->ctl_state->counter_cmd );
165 
166  /* GROSS! This is a hack to 'push' the correct values
167  back into the hardware, such that when PAPI handles
168  the overflow and reads the values, it gets the correct ones.
169  */
170 
171  /* Find which HW counter overflowed */
172 
173  if ( ESI->EventInfoArray[ESI->overflow.EventIndex[0]].pos[0] == 0 )
174  t = 0;
175  else
176  t = 1;
177 
178  if ( cpc_take_sample( &sample->cmd ) == -1 )
179  return;
180  if ( event_counter == 1 ) {
181  /* only one event is set to be the overflow monitor */
182 
183  /* generate the overflow vector */
184  overflow_vector = 1 << t;
185  /* reset the threshold */
186  sample->cmd.ce_pic[t] = UINT64_MAX - ESI->overflow.threshold[0];
187  } else {
188  /* two events are set to be the overflow monitors */
189  overflow_vector = 0;
190  readvalue = sample->cmd.ce_pic[0];
191  if ( readvalue >= 0 ) {
192  /* the first counter overflowed */
193 
194  /* generate the overflow vector */
195  overflow_vector = 1;
196  /* reset the threshold */
197  if ( t == 0 )
198  sample->cmd.ce_pic[0] =
199  UINT64_MAX - ESI->overflow.threshold[0];
200  else
201  sample->cmd.ce_pic[0] =
202  UINT64_MAX - ESI->overflow.threshold[1];
203  }
204  readvalue = sample->cmd.ce_pic[1];
205  if ( readvalue >= 0 ) {
206  /* the second counter overflowed */
207 
208  /* generate the overflow vector */
209  overflow_vector ^= 1 << 1;
210  /* reset the threshold */
211  if ( t == 0 )
212  sample->cmd.ce_pic[1] =
213  UINT64_MAX - ESI->overflow.threshold[1];
214  else
215  sample->cmd.ce_pic[1] =
216  UINT64_MAX - ESI->overflow.threshold[0];
217  }
218  SUBDBG( "overflow_vector, = %d\n", overflow_vector );
219  /* something is wrong here */
220  if ( overflow_vector == 0 ) {
221  PAPIERROR( "BUG! overflow_vector is 0, dropping interrupt" );
222  return;
223  }
224  }
225 
226  /* Call the regular overflow function in extras.c */
227  if ( thread->running_eventset[cidx]->overflow.
229  address = GET_OVERFLOW_ADDRESS(ctx);
230  _papi_hwi_dispatch_overflow_signal( ( void * ) &ctx, address, NULL,
231  overflow_vector, 0, &thread,
232  cidx );
233  } else {
234  PAPIERROR( "Additional implementation needed in dispatch_emt!" );
235  }
236 
237 #if DEBUG
238  dump_cmd( sample );
239 #endif
240  /* push back the correct values and start counting again */
241  if ( cpc_bind_event( &sample->cmd, sample->flags ) == -1 )
242  return;
243  } else {
244  SUBDBG( "dispatch_emt() dropped, si_code = %d\n", sip->si_code );
245  return;
246  }
247 }
248 
249 static int
250 scan_prtconf( char *cpuname, int len_cpuname, int *hz, int *ver )
251 {
252  /* This code courtesy of our friends in Germany. Thanks Rudolph Berrendorf! */
253  /* See the PCL home page for the German version of PAPI. */
254  /* Modified by Nils Smeds, all new bugs are my fault */
255  /* The routine now looks for the first "Node" with the following: */
256  /* "device_type" = 'cpu' */
257  /* "name" = (Any value) */
258  /* "sparc-version" = (Any value) */
259  /* "clock-frequency" = (Any value) */
260  int ihz, version;
261  char line[256], cmd[80], name[256];
262  FILE *f = NULL;
263  char cmd_line[PAPI_HUGE_STR_LEN + PAPI_HUGE_STR_LEN], fname[L_tmpnam];
264  unsigned int matched;
265 
266  /*??? system call takes very long */
267  /* get system configuration and put output into file */
268 
269  tmpnam( fname );
270  SUBDBG( "Temporary name %s\n", fname );
271 
272  sprintf( cmd_line, "/usr/sbin/prtconf -vp > %s", fname );
273  SUBDBG( "Executing %s\n", cmd_line );
274  if ( system( cmd_line ) == -1 ) {
275  remove( fname );
276  return -1;
277  }
278 
279  f = fopen( fname, "r" );
280  /* open output file */
281  if ( f == NULL ) {
282  remove( fname );
283  return -1;
284  }
285 
286  /* ignore all lines until we reach something with a sparc line */
287  matched = 0x0;
288  ihz = -1;
289  while ( fgets( line, 256, f ) != NULL ) {
290  /*SUBDBG(">>> %s",line); */
291  if ( ( sscanf( line, "%s", cmd ) == 1 )
292  && strstr( line, "Node 0x" ) ) {
293  matched = 0x0;
294  /*SUBDBG("Found 'Node' -- search reset. (0x%2.2x)\n",matched); */
295  } else {
296  if ( strstr( cmd, "device_type:" ) && strstr( line, "'cpu'" ) ) {
297  matched |= 0x1;
298  SUBDBG( "Found 'cpu'. (0x%2.2x)\n", matched );
299  } else if ( !strcmp( cmd, "sparc-version:" ) &&
300  ( sscanf( line, "%s %#x", cmd, &version ) == 2 ) ) {
301  matched |= 0x2;
302  SUBDBG( "Found version=%d. (0x%2.2x)\n", version, matched );
303  } else if ( !strcmp( cmd, "clock-frequency:" ) &&
304  ( sscanf( line, "%s %#x", cmd, &ihz ) == 2 ) ) {
305  matched |= 0x4;
306  SUBDBG( "Found ihz=%d. (0x%2.2x)\n", ihz, matched );
307  } else if ( !strcmp( cmd, "name:" ) &&
308  ( sscanf( line, "%s %s", cmd, name ) == 2 ) ) {
309  matched |= 0x8;
310  SUBDBG( "Found name: %s. (0x%2.2x)\n", name, matched );
311  }
312  }
313  if ( ( matched & 0xF ) == 0xF )
314  break;
315  }
316  SUBDBG( "Parsing found name=%s, speed=%dHz, version=%d\n", name, ihz,
317  version );
318 
319  if ( matched ^ 0x0F )
320  ihz = -1;
321  else {
322  *hz = ( float ) ihz;
323  *ver = version;
324  strncpy( cpuname, name, len_cpuname );
325  }
326 
327  return ihz;
328 
329  /* End stolen code */
330 }
331 
332 int
333 _ultra_set_domain( hwd_control_state_t * this_state, int domain )
334 {
335  papi_cpc_event_t *command = &this_state->counter_cmd;
336  cpc_event_t *event = &command->cmd;
337  uint64_t pcr = event->ce_pcr;
338  int did = 0;
339 
340  pcr = pcr | 0x7;
341  pcr = pcr ^ 0x7;
342 
343  if ( domain & PAPI_DOM_USER ) {
344  pcr = pcr | 1 << CPC_ULTRA_PCR_USR;
345  did = 1;
346  }
347  if ( domain & PAPI_DOM_KERNEL ) {
348  pcr = pcr | 1 << CPC_ULTRA_PCR_SYS;
349  did = 1;
350  }
351  /* DOMAIN ERROR */
352  if ( !did ) {
353  return ( PAPI_EINVAL );
354  }
355 
356  event->ce_pcr = pcr;
357 
358  return ( PAPI_OK );
359 }
360 
361 static int
362 set_granularity( hwd_control_state_t * this_state, int domain )
363 {
364  switch ( domain ) {
365  case PAPI_GRN_PROCG:
366  case PAPI_GRN_SYS:
367  case PAPI_GRN_SYS_CPU:
368  case PAPI_GRN_PROC:
369  return PAPI_ECMP;
370  case PAPI_GRN_THR:
371  break;
372  default:
373  return ( PAPI_EINVAL );
374  }
375  return ( PAPI_OK );
376 }
377 
378 /* Utility functions */
379 
380 /* This is a wrapper arount fprintf(stderr,...) for cpc_walk_events() */
381 void
382 print_walk_names( void *arg, int regno, const char *name, uint8_t bits )
383 {
384  SUBDBG( arg, regno, name, bits );
385 }
386 
387 
388 static int
390 {
391  int i;
392  int regno;
393  int npic;
394  einfo_t *ep;
395  int n;
396  int npresets;
397  npic = cpc_getnpic( cpuver );
398  nctrs = 0;
399  for ( regno = 0; regno < npic; ++regno ) {
400  cpc_walk_names( cpuver, regno, 0, action );
401  }
402  SUBDBG( "%d counters\n", nctrs );
403  if ( ( ctrs = papi_malloc( nctrs * sizeof ( struct ctr_info ) ) ) == 0 ) {
404  return PAPI_ENOMEM;
405  }
406  nctrs = 0;
407  for ( regno = 0; regno < npic; ++regno ) {
408  cpc_walk_names( cpuver, regno, ( void * ) 1, action );
409  }
410  SUBDBG( "%d counters\n", nctrs );
411 #if DEBUG
412  if ( ISLEVEL( DEBUG_SUBSTRATE ) ) {
413  for ( i = 0; i < nctrs; ++i ) {
414  SUBDBG( "%s: bits (%#x,%#x) pics %#x\n", ctrs[i].name, ctrs[i].bits[0],
415  ctrs[i].bits[1], ctrs[i].bitmask );
416  }
417  }
418 #endif
419  /* Build the native event table */
420  if ( ( native_table =
421  papi_malloc( nctrs * sizeof ( native_info_t ) ) ) == 0 ) {
422  papi_free( ctrs );
423  return PAPI_ENOMEM;
424  }
425  for ( i = 0; i < nctrs; ++i ) {
426  native_table[i].name[39] = 0;
427  strncpy( native_table[i].name, ctrs[i].name, 39 );
428  if ( ctrs[i].bitmask & 1 )
429  native_table[i].encoding[0] = ctrs[i].bits[0];
430  else
431  native_table[i].encoding[0] = -1;
432  if ( ctrs[i].bitmask & 2 )
433  native_table[i].encoding[1] = ctrs[i].bits[1];
434  else
435  native_table[i].encoding[1] = -1;
436  }
437  papi_free( ctrs );
438 
439  /* Build the preset table */
440  if ( cpuver <= CPC_ULTRA2 ) {
441  n = sizeof ( us2info ) / sizeof ( einfo_t );
442  ep = us2info;
443  } else if ( cpuver <= LASTULTRA3 ) {
444  n = sizeof ( us3info ) / sizeof ( einfo_t );
445  ep = us3info;
446  } else
447  return PAPI_ECMP;
448  preset_table = papi_malloc( ( n + 1 ) * sizeof ( hwi_search_t ) );
449  npresets = 0;
450  for ( i = 0; i < n; ++i ) {
451  add_preset( preset_table, &npresets, ep[i] );
452  }
453  memset( &preset_table[npresets], 0, sizeof ( hwi_search_t ) );
454 
455 #ifdef DEBUG
456  if ( ISLEVEL( DEBUG_SUBSTRATE ) ) {
457  SUBDBG( "Native table: %d\n", nctrs );
458  for ( i = 0; i < nctrs; ++i ) {
459  SUBDBG( "%40s: %8x %8x\n", native_table[i].name,
460  native_table[i].encoding[0], native_table[i].encoding[1] );
461  }
462  SUBDBG( "\nPreset table: %d\n", npresets );
463  for ( i = 0; preset_table[i].event_code != 0; ++i ) {
464  SUBDBG( "%8x: op %2d e0 %8x e1 %8x\n",
465  preset_table[i].event_code,
466  preset_table[i].data.derived,
467  preset_table[i].data.native[0],
468  preset_table[i].data.native[1] );
469  }
470  }
471 #endif
472 
473  _solaris_vector.cmp_info.num_native_events = nctrs;
474 
475  return PAPI_OK;
476 }
477 
478 static int
479 srch_event( char *e1 )
480 {
481  int i;
482 
483  for ( i = 0; i < nctrs; ++i ) {
484  if ( strcmp( e1, native_table[i].name ) == 0 )
485  break;
486  }
487  if ( i >= nctrs )
488  return -1;
489  return i;
490 }
491 
492 /* we should read from the CSV file and make this all unnecessary */
493 
494 static void
495 add_preset( hwi_search_t * tab, int *np, einfo_t e )
496 {
497  /* Parse the event info string and build the PAPI preset.
498  * If parse fails, just return, otherwise increment the table
499  * size. We assume that the table is big enough.
500  */
501  char *p;
502  char *q;
503  char op;
504  char e1[MAX_ENAME], e2[MAX_ENAME];
505  int i;
506  int ne;
507  int ne2;
508 
509  p = e.event_str;
510  /* Assume p is the name of a native event, the sum of two
511  * native events, or the difference of two native events.
512  * This could be extended with a real parser (hint).
513  */
514  while ( isspace( *p ) )
515  ++p;
516  q = p;
517  i = 0;
518  while ( isalnum( *p ) || ( *p == '_' ) ) {
519  if ( i >= MAX_ENAME - 1 )
520  break;
521  e1[i] = *p++;
522  ++i;
523  }
524  e1[i] = 0;
525  if ( *p == '+' || *p == '-' )
526  op = *p++;
527  else
528  op = 0;
529  while ( isspace( *p ) )
530  ++p;
531  q = p;
532  i = 0;
533  while ( isalnum( *p ) || ( *p == '_' ) ) {
534  if ( i >= MAX_ENAME - 1 )
535  break;
536  e2[i] = *p++;
537  ++i;
538  }
539  e2[i] = 0;
540 
541  if ( e2[0] == 0 && e1[0] == 0 ) {
542  return;
543  }
544  if ( e2[0] == 0 || op == 0 ) {
545  ne = srch_event( e1 );
546  if ( ne == -1 )
547  return;
548  tab[*np].event_code = e.papi_event;
549  tab[*np].data.derived = 0;
550  tab[*np].data.native[0] = PAPI_NATIVE_MASK | ne;
551  tab[*np].data.native[1] = PAPI_NULL;
552  memset( tab[*np].data.operation, 0,
553  sizeof ( tab[*np].data.operation ) );
554  ++*np;
555  return;
556  }
557  ne = srch_event( e1 );
558  ne2 = srch_event( e2 );
559  if ( ne == -1 || ne2 == -1 )
560  return;
561  tab[*np].event_code = e.papi_event;
562  tab[*np].data.derived = ( op == '-' ) ? DERIVED_SUB : DERIVED_ADD;
563  tab[*np].data.native[0] = PAPI_NATIVE_MASK | ne;
564  tab[*np].data.native[1] = PAPI_NATIVE_MASK | ne2;
565  tab[*np].data.native[2] = PAPI_NULL;
566  memset( tab[*np].data.operation, 0, sizeof ( tab[*np].data.operation ) );
567  ++*np;
568 }
569 
570 void
571 action( void *arg, int regno, const char *name, uint8_t bits )
572 {
573  int i;
574 
575  if ( arg == 0 ) {
576  ++nctrs;
577  return;
578  }
579  assert( regno == 0 || regno == 1 );
580  for ( i = 0; i < nctrs; ++i ) {
581  if ( strcmp( ctrs[i].name, name ) == 0 ) {
582  ctrs[i].bits[regno] = bits;
583  ctrs[i].bitmask |= ( 1 << regno );
584  return;
585  }
586  }
587  memset( &ctrs[i], 0, sizeof ( ctrs[i] ) );
588  ctrs[i].name = papi_strdup( name );
589  ctrs[i].bits[regno] = bits;
590  ctrs[i].bitmask = ( 1 << regno );
591  ++nctrs;
592 }
593 
594 /* This function should tell your kernel extension that your children
595  inherit performance register information and propagate the values up
596  upon child exit and parent wait. */
597 
598 static int
599 set_inherit( EventSetInfo_t * global, int arg )
600 {
601  return PAPI_ECMP;
602 
603 /*
604  hwd_control_state_t *machdep = (hwd_control_state_t *)global->machdep;
605  papi_cpc_event_t *command= &machdep->counter_cmd;
606 
607  return(PAPI_EINVAL);
608 */
609 
610 #if 0
611  if ( arg == 0 ) {
612  if ( command->flags & CPC_BIND_LWP_INHERIT )
613  command->flags = command->flags ^ CPC_BIND_LWP_INHERIT;
614  } else if ( arg == 1 ) {
615  command->flags = command->flags | CPC_BIND_LWP_INHERIT;
616  } else
617  return ( PAPI_EINVAL );
618 
619  return ( PAPI_OK );
620 #endif
621 }
622 
623 static int
624 set_default_domain( hwd_control_state_t * ctrl_state, int domain )
625 {
626  /* This doesn't exist on this platform */
627 
628  if ( domain == PAPI_DOM_OTHER )
629  return ( PAPI_EINVAL );
630 
631  return ( _ultra_set_domain( ctrl_state, domain ) );
632 }
633 
634 static int
635 set_default_granularity( hwd_control_state_t * current_state, int granularity )
636 {
637  return ( set_granularity( current_state, granularity ) );
638 }
639 
640 rwlock_t lock[PAPI_MAX_LOCK];
641 
642 static void
643 lock_init( void )
644 {
645  memset( lock, 0x0, sizeof ( rwlock_t ) * PAPI_MAX_LOCK );
646 }
647 
648 int
650 {
651  ( void ) cpc_rele( );
652  return ( PAPI_OK );
653 }
654 
655 int
657 {
658  int retval;
659  /* retval = _papi_hwi_setup_vector_table(vtable, _solaris_ultra_table);
660  if ( retval != PAPI_OK ) return(retval); */
661 
662  /* Fill in what we can of the papi_system_info. */
664  if ( retval )
665  return ( retval );
666 
667  /* Setup memory info */
669  0 );
670  if ( retval )
671  return ( retval );
672 
673 
674  lock_init( );
675 
676  SUBDBG( "Found %d %s %s CPUs at %d Mhz.\n",
681 
682  return ( PAPI_OK );
683 }
684 
685 /* reset the hardware counter */
686 int
688 {
689  int retval;
690 
691  /* reset the hardware counter */
692  ctrl->counter_cmd.cmd.ce_pic[0] = 0;
693  ctrl->counter_cmd.cmd.ce_pic[1] = 0;
694  /* let's rock and roll */
695  retval = cpc_bind_event( &ctrl->counter_cmd.cmd, ctrl->counter_cmd.flags );
696  if ( retval == -1 )
697  return ( PAPI_ESYS );
698 
699  return ( PAPI_OK );
700 }
701 
702 
703 int
705  long long **events, int flags )
706 {
707  int retval;
708 
709  retval = cpc_take_sample( &ctrl->counter_cmd.cmd );
710  if ( retval == -1 )
711  return ( PAPI_ESYS );
712 
713  *events = ( long long * ) ctrl->counter_cmd.cmd.ce_pic;
714 
715  return PAPI_OK;
716 }
717 
718 int
719 _ultra_hwd_ctl( hwd_context_t * ctx, int code, _papi_int_option_t * option )
720 {
721 
722  switch ( code ) {
723  case PAPI_DEFDOM:
724  return ( set_default_domain
725  ( option->domain.ESI->ctl_state, option->domain.domain ) );
726  case PAPI_DOMAIN:
727  return ( _ultra_set_domain
728  ( option->domain.ESI->ctl_state, option->domain.domain ) );
729  case PAPI_DEFGRN:
730  return ( set_default_granularity
731  ( option->domain.ESI->ctl_state,
732  option->granularity.granularity ) );
733  case PAPI_GRANUL:
734  return ( set_granularity
735  ( option->granularity.ESI->ctl_state,
736  option->granularity.granularity ) );
737  default:
738  return ( PAPI_EINVAL );
739  }
740 }
741 
742 void
743 _ultra_hwd_dispatch_timer( int signal, siginfo_t * si, void *context )
744 {
745 
747  ThreadInfo_t *master = NULL;
748  int isHardware = 0;
749  caddr_t address;
750  int cidx = _solaris_vector.cmp_info.CmpIdx;
751 
752  ctx.si = si;
753  ctx.ucontext = ( ucontext_t * ) context;
754 
755  address = GET_OVERFLOW_ADDRESS( ctx );
756  _papi_hwi_dispatch_overflow_signal( ( void * ) &ctx, address, &isHardware,
757  0, 0, &master, _solaris_vector.cmp_info.CmpIdx );
758 
759  /* We are done, resume interrupting counters */
760  if ( isHardware ) {
761  // errno = vperfctr_iresume( master->context[cidx]->perfctr );
762  //if ( errno < 0 ) {
763  // PAPIERROR( "vperfctr_iresume errno %d", errno );
764  //}
765  }
766 
767 
768 #if 0
769  EventSetInfo_t *ESI = NULL;
770  ThreadInfo_t *thread = NULL;
771  int overflow_vector = 0;
772  hwd_control_state_t *ctrl = NULL;
773  long_long results[MAX_COUNTERS];
774  int i;
776  caddr_t address;
777  int cidx = _solaris_vector.cmp_info.CmpIdx;
778 
779  ctx.si = si;
780  ctx.ucontext = ( hwd_ucontext_t * ) info;
781 
782  thread = _papi_hwi_lookup_thread( 0 );
783 
784  if ( thread == NULL ) {
785  PAPIERROR( "thread == NULL in _papi_hwd_dispatch_timer");
786  return;
787  }
788 
789  ESI = ( EventSetInfo_t * ) thread->running_eventset[cidx];
790 
791 
792  if ( ESI == NULL || ESI->master != thread || ESI->ctl_state == NULL ||
793  ( ( ESI->state & PAPI_OVERFLOWING ) == 0 ) ) {
794 
795  if ( ESI == NULL )
796  PAPIERROR( "ESI is NULL\n");
797 
798  if ( ESI->master != thread )
799  PAPIERROR( "Thread mismatch, ESI->master=%#x thread=%#x\n",
800  ESI->master, thread );
801 
802  if ( ESI->ctl_state == NULL )
803  PAPIERROR( "Counter state invalid\n");
804 
805  if ( ( ( ESI->state & PAPI_OVERFLOWING ) == 0 ) )
806  PAPIERROR( "Overflow flag missing");
807  }
808 
809  ctrl = ESI->ctl_state;
810 
811  if ( thread->running_eventset[cidx]->overflow.flags & PAPI_OVERFLOW_FORCE_SW ) {
812  address = GET_OVERFLOW_ADDRESS( ctx );
813  _papi_hwi_dispatch_overflow_signal( ( void * ) &ctx, address, NULL, 0,
814  0, &thread, cidx );
815  } else {
816  PAPIERROR ( "Need to implement additional code in _papi_hwd_dispatch_timer!" );
817  }
818 #endif
819 }
820 
821 int
822 _ultra_hwd_set_overflow( EventSetInfo_t * ESI, int EventIndex, int threshold )
823 {
824  hwd_control_state_t *this_state = ESI->ctl_state;
825  papi_cpc_event_t *arg = &this_state->counter_cmd;
826  int hwcntr;
827 
828  if ( threshold == 0 ) {
829  if ( this_state->overflow_num == 1 ) {
830  arg->flags ^= CPC_BIND_EMT_OVF;
831  if ( sigaction
832  ( _solaris_vector.cmp_info.hardware_intr_sig, NULL,
833  NULL ) == -1 )
834  return ( PAPI_ESYS );
835  this_state->overflow_num = 0;
836  } else
837  this_state->overflow_num--;
838 
839  } else {
840  struct sigaction act;
841  /* increase the counter for overflow events */
842  this_state->overflow_num++;
843 
844  act.sa_sigaction = dispatch_emt;
845  memset( &act.sa_mask, 0x0, sizeof ( act.sa_mask ) );
846  act.sa_flags = SA_RESTART | SA_SIGINFO;
847  if ( sigaction
848  ( _solaris_vector.cmp_info.hardware_intr_sig, &act,
849  NULL ) == -1 )
850  return ( PAPI_ESYS );
851 
852  arg->flags |= CPC_BIND_EMT_OVF;
853  hwcntr = ESI->EventInfoArray[EventIndex].pos[0];
854  if ( hwcntr == 0 )
855  arg->cmd.ce_pic[0] = UINT64_MAX - ( uint64_t ) threshold;
856  else if ( hwcntr == 1 )
857  arg->cmd.ce_pic[1] = UINT64_MAX - ( uint64_t ) threshold;
858  }
859 
860  return ( PAPI_OK );
861 }
862 
863 
865 {
866 
867  return PAPI_OK;
868 }
869 
870 
871 /*
872 int _papi_hwd_stop_profiling(ThreadInfo_t * master, EventSetInfo_t * ESI)
873 {
874  ESI->profile.overflowcount = 0;
875  return (PAPI_OK);
876 }
877 */
878 
879 void *
881 {
882  void *location;
883  ucontext_t *info = ( ucontext_t * ) context;
884  location = ( void * ) info->uc_mcontext.gregs[REG_PC];
885 
886  return ( location );
887 }
888 
889 int
891 {
892  int retval;
893 
894  /* reset the hardware counter */
895  if ( ctrl->overflow_num == 0 ) {
896  ctrl->counter_cmd.cmd.ce_pic[0] = 0;
897  ctrl->counter_cmd.cmd.ce_pic[1] = 0;
898  }
899  /* let's rock and roll */
900  retval = cpc_bind_event( &ctrl->counter_cmd.cmd, ctrl->counter_cmd.flags );
901  if ( retval == -1 )
902  return ( PAPI_ESYS );
903 
904  return ( PAPI_OK );
905 }
906 
907 int
909 {
910  cpc_bind_event( NULL, 0 );
911  return PAPI_OK;
912 }
913 
914 int
916  unsigned int hardware_index, hwd_control_state_t * out )
917 {
918  return PAPI_OK;
919 }
920 
921 int
922 _ultra_hwd_encode_native( char *name, int *code )
923 {
924  return ( PAPI_OK );
925 }
926 
927 int
928 _ultra_hwd_ntv_enum_events( unsigned int *EventCode, int modifier )
929 {
930  int index = *EventCode & PAPI_NATIVE_AND_MASK;
931 
932  if ( modifier == PAPI_ENUM_FIRST ) {
933  *EventCode = PAPI_NATIVE_MASK + 1;
934 
935  return PAPI_OK;
936  }
937 
938  if ( cpuver <= CPC_ULTRA2 ) {
939  if ( index < MAX_NATIVE_EVENT_USII - 1 ) {
940  *EventCode = *EventCode + 1;
941  return ( PAPI_OK );
942  } else
943  return ( PAPI_ENOEVNT );
944  } else if ( cpuver <= LASTULTRA3 ) {
945  if ( index < MAX_NATIVE_EVENT - 1 ) {
946  *EventCode = *EventCode + 1;
947  return ( PAPI_OK );
948  } else
949  return ( PAPI_ENOEVNT );
950  };
951  return ( PAPI_ENOEVNT );
952 }
953 
954 int
955 _ultra_hwd_ntv_code_to_name( unsigned int EventCode, char *ntv_name, int len )
956 {
957 
958  int event_code = EventCode & PAPI_NATIVE_AND_MASK;
959 
960  if ( event_code >= 0 && event_code < nctrs ) {
961  strlcpy( ntv_name, native_table[event_code].name, len );
962  return PAPI_OK;
963  }
964  return PAPI_ENOEVNT;
965 }
966 
967 
968 int
969 _ultra_hwd_ntv_code_to_descr( unsigned int EventCode, char *hwd_descr, int len )
970 {
971  return ( _ultra_hwd_ntv_code_to_name( EventCode, hwd_descr, len ) );
972 }
973 
974 static void
975 copy_value( unsigned int val, char *nam, char *names, unsigned int *values,
976  int len )
977 {
978  *values = val;
979  strncpy( names, nam, len );
980  names[len - 1] = 0;
981 }
982 
983 int
984 _ultra_hwd_ntv_code_to_bits( unsigned int EventCode, hwd_register_t * bits )
985 {
986  int index = EventCode & PAPI_NATIVE_AND_MASK;
987 
988  if ( cpuver <= CPC_ULTRA2 ) {
989  if ( index >= MAX_NATIVE_EVENT_USII ) {
990  return ( PAPI_ENOEVNT );
991  }
992  } else if ( cpuver <= LASTULTRA3 ) {
993  if ( index >= MAX_NATIVE_EVENT ) {
994  return ( PAPI_ENOEVNT );
995  }
996  } else
997  return ( PAPI_ENOEVNT );
998 
999  bits->event[0] = native_table[index].encoding[0];
1000  bits->event[1] = native_table[index].encoding[1];
1001  return ( PAPI_OK );
1002 }
1003 
1004 int
1006 {
1007  ptr->counter_cmd.flags = 0x0;
1008  ptr->counter_cmd.cmd.ce_cpuver = cpuver;
1009  ptr->counter_cmd.cmd.ce_pcr = 0x0;
1010  ptr->counter_cmd.cmd.ce_pic[0] = 0;
1011  ptr->counter_cmd.cmd.ce_pic[1] = 0;
1012 
1013  _ultra_set_domain( ptr, _solaris_vector.cmp_info.default_domain );
1014  set_granularity( ptr, _solaris_vector.cmp_info.default_granularity );
1015 
1016  return PAPI_OK;
1017 }
1018 
1019 int
1021  NativeInfo_t * native, int count,
1022  hwd_context_t * zero )
1023 {
1024  int nidx1, nidx2, hwcntr;
1025  uint64_t tmp = 0;
1026  uint64_t pcr;
1027  int64_t cmd0, cmd1;
1028 
1029 /* save the last three bits */
1030  pcr = this_state->counter_cmd.cmd.ce_pcr & 0x7;
1031 
1032 /* clear the control register */
1033  this_state->counter_cmd.cmd.ce_pcr = pcr;
1034 
1035 /* no native events left */
1036  if ( count == 0 )
1037  return ( PAPI_OK );
1038 
1039  cmd0 = -1;
1040  cmd1 = -1;
1041 /* one native event */
1042  if ( count == 1 ) {
1043  nidx1 = native[0].ni_event & PAPI_NATIVE_AND_MASK;
1044  hwcntr = 0;
1045  cmd0 = native_table[nidx1].encoding[0];
1046  native[0].ni_position = 0;
1047  if ( cmd0 == -1 ) {
1048  cmd1 = native_table[nidx1].encoding[1];
1049  native[0].ni_position = 1;
1050  }
1051  }
1052 
1053 /* two native events */
1054  if ( count == 2 ) {
1055  int avail1, avail2;
1056 
1057  avail1 = 0;
1058  avail2 = 0;
1059  nidx1 = native[0].ni_event & PAPI_NATIVE_AND_MASK;
1060  nidx2 = native[1].ni_event & PAPI_NATIVE_AND_MASK;
1061  if ( native_table[nidx1].encoding[0] != -1 )
1062  avail1 = 0x1;
1063  if ( native_table[nidx1].encoding[1] != -1 )
1064  avail1 += 0x2;
1065  if ( native_table[nidx2].encoding[0] != -1 )
1066  avail2 = 0x1;
1067  if ( native_table[nidx2].encoding[1] != -1 )
1068  avail2 += 0x2;
1069  if ( ( avail1 | avail2 ) != 0x3 )
1070  return ( PAPI_ECNFLCT );
1071  if ( avail1 == 0x3 ) {
1072  if ( avail2 == 0x1 ) {
1073  cmd0 = native_table[nidx2].encoding[0];
1074  cmd1 = native_table[nidx1].encoding[1];
1075  native[0].ni_position = 1;
1076  native[1].ni_position = 0;
1077  } else {
1078  cmd1 = native_table[nidx2].encoding[1];
1079  cmd0 = native_table[nidx1].encoding[0];
1080  native[0].ni_position = 0;
1081  native[1].ni_position = 1;
1082  }
1083  } else {
1084  if ( avail1 == 0x1 ) {
1085  cmd0 = native_table[nidx1].encoding[0];
1086  cmd1 = native_table[nidx2].encoding[1];
1087  native[0].ni_position = 0;
1088  native[1].ni_position = 1;
1089  } else {
1090  cmd0 = native_table[nidx2].encoding[0];
1091  cmd1 = native_table[nidx1].encoding[1];
1092  native[0].ni_position = 1;
1093  native[1].ni_position = 0;
1094  }
1095  }
1096  }
1097 
1098 /* set the control register */
1099  if ( cmd0 != -1 ) {
1100  tmp = ( ( uint64_t ) cmd0 << pcr_shift[0] );
1101  }
1102  if ( cmd1 != -1 ) {
1103  tmp = tmp | ( ( uint64_t ) cmd1 << pcr_shift[1] );
1104  }
1105  this_state->counter_cmd.cmd.ce_pcr = tmp | pcr;
1106 #if DEBUG
1107  dump_cmd( &this_state->counter_cmd );
1108 #endif
1109 
1110  return ( PAPI_OK );
1111 }
1112 
1113 
1114 
1115 
1116 papi_vector_t _solaris_vector = {
1117  .cmp_info = {
1118  .name = "solaris.ultra",
1119  .description = "Solaris CPU counters",
1120  .num_cntrs = MAX_COUNTERS,
1121  .num_mpx_cntrs = MAX_COUNTERS,
1122  .default_domain = PAPI_DOM_USER,
1123  .available_domains = PAPI_DOM_USER | PAPI_DOM_KERNEL,
1124  .default_granularity = PAPI_GRN_THR,
1125  .available_granularities = PAPI_GRN_THR,
1126  .fast_real_timer = 1,
1127  .fast_virtual_timer = 1,
1128  .attach = 1,
1129  .attach_must_ptrace = 1,
1130  .hardware_intr = 0,
1131  .hardware_intr_sig = PAPI_INT_SIGNAL,
1132  .precise_intr = 0,
1133  }
1134  ,
1135 
1136  /* component data structure sizes */
1137  .size = {
1138  .context = sizeof ( hwd_context_t ),
1139  .control_state = sizeof ( hwd_control_state_t ),
1140  .reg_value = sizeof ( hwd_register_t ),
1141  .reg_alloc = sizeof ( hwd_reg_alloc_t ),
1142  }
1143  ,
1144 
1145  /* component interface functions */
1146  .init_control_state = _ultra_hwd_init_control_state,
1147  .start = _ultra_hwd_start,
1148  .stop = _ultra_hwd_stop,
1149  .read = _ultra_hwd_read,
1150  .shutdown = _ultra_shutdown,
1151  .shutdown_component = _ultra_hwd_shutdown_component,
1152  .ctl = _ultra_hwd_ctl,
1153  .update_control_state = _ultra_hwd_update_control_state,
1154  .set_domain = _ultra_set_domain,
1155  .reset = _ultra_hwd_reset,
1156  .set_overflow = _ultra_hwd_set_overflow,
1157  /* .set_profile */
1158  /* .stop_profiling = _papi_hwd_stop_profiling, */
1159  .ntv_enum_events = _ultra_hwd_ntv_enum_events,
1160  /* .ntv_name_to_code */
1161  .ntv_code_to_name = _ultra_hwd_ntv_code_to_name,
1162  .ntv_code_to_descr = _ultra_hwd_ntv_code_to_descr,
1163  .ntv_code_to_bits = _ultra_hwd_ntv_code_to_bits,
1164  .init_component = _ultra_hwd_init_component,
1165  .dispatch_timer = _ultra_hwd_dispatch_timer,
1166 
1167 };
1168 
1170 
1171  /* OS dependent local routines */
1173  .get_dmem_info = _solaris_get_dmem_info,
1174  .update_shlib_info = _solaris_update_shlib_info,
1175  .get_system_info = _solaris_get_system_info,
1176  .get_real_usec = _solaris_get_real_usec,
1177  .get_real_cycles = _solaris_get_real_cycles,
1178  .get_virt_usec = _solaris_get_virt_usec,
1179 };
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:625
#define PAPI_HUGE_STR_LEN
Definition: fpapi.h:42
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
#define PAPI_TLB_IM
Definition: fpapi.h:156
#define PAPI_NATIVE_MASK
int val
Definition: libbif.c:235
#define PAPI_L2_TCM
Definition: fpapi.h:142
#define DERIVED_SUB
Definition: papi_internal.h:74
#define PAPI_CA_SNP
Definition: fpapi.h:144
#define PAPI_LD_INS
Definition: fpapi.h:188
double f(double a)
Definition: cpi.c:23
#define PAPI_ENOMEM
Definition: fpapi.h:107
#define PAPI_GRN_SYS_CPU
Definition: fpapi.h:72
int _solaris_update_shlib_info(papi_mdi_t *mdi)
long long _solaris_get_virt_usec(void)
static void copy_value(unsigned int val, char *nam, char *names, unsigned int *values, int len)
long long _solaris_get_real_cycles(void)
long long flags
Definition: iozone.c:12330
papi_vector_t _solaris_vector
#define PAPI_NULL
Definition: fpapi.h:13
#define PAPI_L1_ICA
Definition: fpapi.h:211
EventSetInfo_t * ESI
#define papi_free(a)
Definition: papi_memory.h:35
#define PAPI_L1_ICM
Definition: fpapi.h:136
unsigned int event_code
Definition: papi_preset.h:14
#define papi_malloc(a)
Definition: papi_memory.h:34
int _ultra_hwd_encode_native(char *name, int *code)
int default_granularity
Definition: papi.h:641
_ultra_shutdown(hwd_context_t *ctx)
#define PAPI_ENOEVNT
Definition: fpapi.h:112
#define PAPI_TOT_INS
Definition: fpapi.h:185
hwi_search_t * preset_table
#define PAPI_L1_DCW
Definition: fpapi.h:205
int _ultra_hwd_update_control_state(hwd_control_state_t *this_state, NativeInfo_t *native, int count, hwd_context_t *zero)
#define MAX_COUNTERS
Definition: perfctr-x86.h:8
char name[40]
Definition: solaris-ultra.h:71
#define PAPI_TLB_DM
Definition: fpapi.h:155
#define PAPI_L1_ICH
Definition: fpapi.h:208
int _ultra_hwd_ntv_code_to_descr(unsigned int EventCode, char *hwd_descr, int len)
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
int event[MAX_COUNTERS]
Definition: solaris-ultra.h:47
#define papi_strdup(a)
Definition: papi_memory.h:39
#define DERIVED_ADD
Definition: papi_internal.h:70
#define PAPI_GRN_SYS
Definition: fpapi.h:71
static einfo_t us3info[]
Definition: solaris-ultra.c:53
#define PAPI_DOM_OTHER
Definition: fpapi.h:23
static int pcr_shift[2]
#define PAPI_DOM_KERNEL
Definition: fpapi.h:22
#define PAPI_GRN_PROC
Definition: fpapi.h:69
void
Definition: iozone.c:18627
return PAPI_EINVAL
Definition: linux-nvml.c:408
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
int _solaris_get_memory_info(PAPI_hw_info_t *hw, int id)
static void add_preset(hwi_search_t *tab, int *np, einfo_t e)
static int cpuver
int encoding[MAX_COUNTERS]
Definition: solaris-ultra.h:73
#define PAPI_OVERFLOWING
Definition: fpapi.h:33
#define PAPI_ECNFLCT
Definition: fpapi.h:113
void print_walk_names(void *arg, int regno, const char *name, uint8_t bits)
Return codes and api definitions.
int _ultra_hwd_init_control_state(hwd_control_state_t *ptr)
#define PAPI_MAX_LOCK
Definition: papi_lock.h:18
char command[512]
Definition: iozone.c:21329
#define PAPI_L1_DCR
Definition: fpapi.h:202
#define MAX_NATIVE_EVENT_USII
Definition: solaris-ultra.h:33
t
Definition: iozone.c:23562
int _ultra_hwd_remove_event(hwd_register_map_t *chosen, unsigned int hardware_index, hwd_control_state_t *out)
#define PAPI_CA_INV
Definition: fpapi.h:147
#define LASTULTRA3
Definition: solaris-ultra.c:33
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
cpc_event_t cmd
Definition: solaris-ultra.h:53
int i
Definition: fileop.c:140
static int scan_prtconf(char *cpuname, int len_cpuname, int *hz, int *ver)
EventSetOverflowInfo_t overflow
static int set_granularity(hwd_control_state_t *this_state, int domain)
#define PAPI_GRN_PROCG
Definition: fpapi.h:70
static void action(void *arg, int regno, const char *name, uint8_t bits)
long long _solaris_get_real_usec(void)
#define PAPI_TOT_CYC
Definition: fpapi.h:194
#define PAPI_SR_INS
Definition: fpapi.h:189
struct _ThreadInfo * master
int _ultra_hwd_stop(hwd_context_t *ctx, hwd_control_state_t *ctrl)
#define MAX_NATIVE_EVENT
native_event_entry_t native_table[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:41
static int cidx
Definition: event_info.c:40
#define hwd_context_t
#define PAPI_ECMP
Definition: fpapi.h:109
#define OVFDBG(format, args...)
Definition: papi_debug.h:68
int _ultra_hwd_read(hwd_context_t *ctx, hwd_control_state_t *ctrl, long long **events, int flags)
#define PAPI_FML_INS
Definition: fpapi.h:232
hwd_ucontext_t * ucontext
static int native
Definition: event_info.c:39
static void lock_init(void)
static int nctrs
void * thread(void *arg)
Definition: kufrin.c:31
int native[PAPI_EVENTS_IN_DERIVED_EVENT]
Definition: papi_preset.h:16
#define PAPI_DEFDOM
Definition: fpapi.h:49
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
char * name
Definition: solaris-ultra.c:43
_papi_int_granularity_t granularity
char * event_str
Definition: solaris-ultra.c:51
int hwd_register_map_t
EventSetInfo_t * ESI
void PAPIERROR(char *format,...)
#define PAPI_DOMAIN
Definition: fpapi.h:50
char events[MAX_EVENTS][BUFSIZ]
static einfo_t us2info[]
Definition: solaris-ultra.c:77
#define PAPI_BR_MSP
Definition: fpapi.h:181
#define PAPI_DEFGRN
Definition: fpapi.h:51
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:53
char operation[PAPI_2MAX_STR_LEN]
Definition: papi_preset.h:17
#define PAPI_FP_INS
Definition: fpapi.h:187
#define PAPI_GRANUL
Definition: fpapi.h:52
char version[]
Definition: fileop.c:134
static int build_tables(void)
EventInfo_t * EventInfoArray
int _ultra_hwd_ntv_code_to_bits(unsigned int EventCode, hwd_register_t *bits)
int _ultra_set_domain(hwd_control_state_t *this_state, int domain)
atomic_p lock[]
Definition: aix.c:25
#define PAPI_ESYS
Definition: fpapi.h:108
int threshold
hwi_search_t * preset_search_map
int _ultra_hwd_set_overflow(EventSetInfo_t *ESI, int EventIndex, int threshold)
char vendor_string[PAPI_MAX_STR_LEN]
Definition: papi.h:783
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
PAPI_hw_info_t hw_info
again struct sockaddr sizeof(struct sockaddr_in))
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
static int set_default_domain(hwd_control_state_t *ctrl_state, int domain)
#define PAPI_FAD_INS
Definition: fpapi.h:233
#define PAPI_TOT_IIS
Definition: fpapi.h:184
void * _ultra_hwd_get_overflow_address(void *context)
struct sigcontext hwd_ucontext_t
Definition: aix-context.h:10
#define PAPI_OVERFLOW_FORCE_SW
Definition: papi.h:409
sscanf(mnc->m_child_port,"%d",&mc.m_child_port)
EventSetInfo_t ** running_eventset
Definition: threads.h:30
int _solaris_get_system_info(papi_mdi_t *mdi)
char * name
Definition: iozone.c:23648
int _ultra_hwd_reset(hwd_context_t *ctx, hwd_control_state_t *ctrl)
int _ultra_hwd_init_component(int cidx)
int _ultra_hwd_start(hwd_context_t *ctx, hwd_control_state_t *ctrl)
int cpu_max_mhz
Definition: papi.h:791
int _ultra_hwd_ntv_enum_events(unsigned int *EventCode, int modifier)
#define long_long
Definition: papi.h:549
void _ultra_hwd_dispatch_timer(int signal, siginfo_t *si, void *context)
#define PAPI_L2_TCH
Definition: fpapi.h:221
#define ISLEVEL(a)
Definition: papi_debug.h:54
inline_static ThreadInfo_t * _papi_hwi_lookup_thread(int custom_tid)
Definition: threads.h:92
#define PAPI_NATIVE_AND_MASK
int totalcpus
Definition: papi.h:781
_papi_int_domain_t domain
char model_string[PAPI_MAX_STR_LEN]
Definition: papi.h:785
#define PAPI_L1_STM
Definition: fpapi.h:159
hwd_siginfo_t * si
static void dispatch_emt(int signal, siginfo_t *sip, void *arg)
int _solaris_get_dmem_info(PAPI_dmem_info_t *d)
#define PAPI_L2_ICM
Definition: fpapi.h:138
#define PAPI_DOM_USER
Definition: fpapi.h:21
int _papi_hwi_dispatch_overflow_signal(void *papiContext, caddr_t address, int *isHardware, long long overflow_bit, int genOverflowBit, ThreadInfo_t **t, int cidx)
Definition: extras.c:214
static int set_inherit(EventSetInfo_t *global, int arg)
#define PAPI_L1_LDM
Definition: fpapi.h:158
static int srch_event(char *e1)
#define PAPI_L2_TCA
Definition: fpapi.h:224
return
Definition: iozone.c:22170
hwd_control_state_t * ctl_state
int _ultra_hwd_shutdown_component(void)
int system()
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338
long long tmp
Definition: iozone.c:12031
static int set_default_granularity(hwd_control_state_t *current_state, int granularity)
int(* get_memory_info)(PAPI_hw_info_t *, int)
Definition: papi_vector.h:69
int _ultra_hwd_ntv_code_to_name(unsigned int EventCode, char *ntv_name, int len)
static struct ctr_info * ctrs
#define GET_OVERFLOW_ADDRESS(ctx)
Definition: aix-context.h:12
const char * names[NUM_EVENTS]
#define PAPI_L2_LDM
Definition: fpapi.h:160
#define hwd_register_t
#define PAPI_GRN_THR
Definition: fpapi.h:67
void dump_cmd(pm_prog_t *t)
Definition: aix.c:795
signal(SIGINT, signal_handler)
papi_cpc_event_t counter_cmd
Definition: solaris-ultra.h:61
#define PAPI_L2_ICH
Definition: fpapi.h:209
if(gettimeofday(&tp,(struct timezone *) NULL)==-1) perror("gettimeofday")
int int op
Definition: iozone.c:19389
int n
Definition: mendes-alt.c:164
#define DEBUG_SUBSTRATE
Definition: papi_debug.h:27
int _ultra_hwd_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
#define MAX_ENAME
Definition: solaris-ultra.c:36
unsigned int papi_event
Definition: solaris-ultra.c:50
char * ptr
Definition: iozone.c:23586