/* * Returns 1 on SMT processors which do not have full CPC hardware for each * logical processor. */ int smt_limited_cpc_hw(cpc_t *cpc) { if (strcmp(cpc_cciname(cpc), "Pentium 4 with HyperThreading") == 0) return (1); return (0); }
int _niagara2_get_system_info( papi_mdi_t *mdi ) { // Used for evaluating return values int retval = 0; // Check for process settings pstatus_t *proc_status; psinfo_t *proc_info; // Used for string truncating char *c_ptr; // For retrieving the executable full name char exec_name[PAPI_HUGE_STR_LEN]; // For retrieving processor information __sol_processor_information_t cpus; #ifdef DEBUG SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__, __LINE__ ); #endif /* Get and set pid */ pid = getpid( ); /* Check for microstate accounting */ proc_status = __sol_get_proc_status( pid ); if ( proc_status->pr_flags & PR_MSACCT == 0 || proc_status->pr_flags & PR_MSFORK == 0 ) { /* Solaris 10 should have microstate accounting always activated */ return PAPI_ECMP; } /* Fill _papi_hwi_system_info.exe_info.fullname */ proc_info = __sol_get_proc_info( pid ); // If there are arguments, trim the string to the executable name. if ( proc_info->pr_argc > 1 ) { c_ptr = strchr( proc_info->pr_psargs, ' ' ); if ( c_ptr != NULL ) c_ptr = '\0'; } /* If the path can be qualified, use the full path, otherwise the trimmed name. */ if ( realpath( proc_info->pr_psargs, exec_name ) != NULL ) { strncpy( _papi_hwi_system_info.exe_info.fullname, exec_name, PAPI_HUGE_STR_LEN ); } else { strncpy( _papi_hwi_system_info.exe_info.fullname, proc_info->pr_psargs, PAPI_HUGE_STR_LEN ); } /* Fill _papi_hwi_system_info.exe_info.address_info */ // Taken from the old component strncpy( _papi_hwi_system_info.exe_info.address_info.name, basename( _papi_hwi_system_info.exe_info.fullname ), PAPI_HUGE_STR_LEN ); __CHECK_ERR_PAPI( _niagara2_update_shlib_info( &_papi_hwi_system_info ) ); /* Fill _papi_hwi_system_info.hw_info */ // Taken from the old component _papi_hwi_system_info.hw_info.ncpu = sysconf( _SC_NPROCESSORS_ONLN ); _papi_hwi_system_info.hw_info.nnodes = 1; _papi_hwi_system_info.hw_info.vendor = PAPI_VENDOR_SUN; strcpy( _papi_hwi_system_info.hw_info.vendor_string, "SUN" ); _papi_hwi_system_info.hw_info.totalcpus = sysconf( _SC_NPROCESSORS_CONF ); _papi_hwi_system_info.hw_info.model = 1; strcpy( _papi_hwi_system_info.hw_info.model_string, cpc_cciname( cpc ) ); /* The field sparc-version is no longer in prtconf -pv */ _papi_hwi_system_info.hw_info.revision = 1; /* Clock speed */ _papi_hwi_system_info.hw_info.mhz = ( float ) __sol_get_processor_clock( ); _papi_hwi_system_info.hw_info.clock_mhz = __sol_get_processor_clock( ); _papi_hwi_system_info.hw_info.cpu_max_mhz = __sol_get_processor_clock( ); _papi_hwi_system_info.hw_info.cpu_min_mhz = __sol_get_processor_clock( ); /* Fill _niagara2_vector.cmp_info.mem_hierarchy */ _niagara2_get_memory_info( &_papi_hwi_system_info.hw_info, 0 ); /* Fill _papi_hwi_system_info.sub_info */ strcpy( _niagara2_vector.cmp_info.name, "SunNiagara2" ); strcpy( _niagara2_vector.cmp_info.version, "ALPHA" ); strcpy( _niagara2_vector.cmp_info.support_version, "libcpc2" ); strcpy( _niagara2_vector.cmp_info.kernel_version, "libcpc2" ); /* libcpc2 uses SIGEMT using real hardware signals, no sw emu */ #ifdef DEBUG SUBDBG( "LEAVING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__, __LINE__ ); #endif return PAPI_OK; }
int capabilities(cpc_t *cpc, FILE *fp) { struct args _args, *args = &_args; char *text, *tok, *cp; const char *ccp; int npic = cpc_npic(cpc); int i; args->fp = fp; if ((ccp = cpc_cciname(cpc)) == NULL) ccp = "No information available"; (void) fprintf(args->fp, "\t%s: %s\n\n", gettext("CPU performance counter interface"), ccp); (void) fprintf(args->fp, gettext("\tevent specification syntax:\n")); (void) fprintf(args->fp, "\t[picn=]<eventn>[,attr[n][=<val>]]" "[,[picn=]<eventn>[,attr[n][=<val>]],...]\n"); if (allpics_equal(cpc)) { args->margin = args->colnum = EVENT_MARGIN; (void) fprintf(args->fp, "\n\tevent[0-%d]: ", npic - 1); cpc_walk_events_pic(cpc, 0, args, list_cap); (void) fprintf(args->fp, "\n"); } else { args->margin = EVENT_MARGIN; for (i = 0; i < npic; i++) { (void) fprintf(args->fp, "\n\tevent%d: ", i); if (i < 10) (void) fprintf(args->fp, " "); args->colnum = EVENT_MARGIN; cpc_walk_events_pic(cpc, i, args, list_cap); (void) fprintf(args->fp, "\n"); } } (void) fprintf(args->fp, "\n\tattributes: "); args->colnum = args->margin = ATTR_MARGIN; cpc_walk_attrs(cpc, args, list_attr); /* * In addition to the attributes published by the kernel, we allow the * user to specify two additional tokens on all platforms. List them * here. */ list_cap(args, 0, "nouser"); list_cap(args, 0, "sys"); (void) fprintf(args->fp, "\n\n\t"); args->colnum = 8; if ((ccp = cpc_cpuref(cpc)) == NULL) ccp = "No information available"; if ((text = strdup(ccp)) == NULL) { (void) fprintf(stderr, gettext("no memory available.\n")); exit(1); } for (cp = strtok_r(text, " ", &tok); cp != NULL; cp = strtok_r(NULL, " ", &tok)) { if ((args->colnum + strlen(cp) + 1) > MAX_RHS_COLUMN) { (void) fprintf(args->fp, "\n\t"); args->colnum = 8; } args->colnum += fprintf(args->fp, "%s ", cp); } (void) fprintf(args->fp, "\n"); free(text); return (0); }