43 for (
i = 0;
i <
N;
i++ ) {
59 for ( j = 0; j <
T; j++ ) {
60 for (
i = 0;
i <
N;
i++ ) {
64 memset(
aa, 0,
sizeof (
aa ) );
65 for (
i = 0;
i <
N;
i++ ) {
74 int bucket,
unsigned int mask ) {
77 unsigned long blength;
86 strncpy(header,
"address\t\t",BUFSIZ);
95 strncat(header,
"\tcyc",BUFSIZ-1);
98 strncat(header,
"\tins",BUFSIZ-1);
101 strncat(header,
"\tfp_ins",BUFSIZ-1);
104 strncat(header,
"\tfp_ops",BUFSIZ-1);
107 strncat(header,
"\tl2_tcm",BUFSIZ-1);
115 strncat(header,
"\n",BUFSIZ-1);
119 blength =
prof_size( plength, scale, bucket, &num_buckets );
122 if ( !
TESTS_QUIET ) printf(
"Overall event counts:\n" );
130 test_warn( __FILE__, __LINE__,
"Trying to profile with derived event", 1);
135 printf(
"Failed with event %d %#x\n",
i,
events[
i]);
150 printf(
TAB1,
"PAPI_TOT_CYC:", (
values[0] )[--event] );
152 printf(
TAB1,
"PAPI_TOT_INS:", (
values[0] )[--event] );
154 #if defined(__powerpc__) 155 printf(
TAB1,
"PAPI_FP_INS", (
values[0] )[--event] );
158 printf(
TAB1,
"PAPI_FP_OPS:", (
values[0] )[--event] );
159 printf(
TAB1,
"PAPI_L2_TCM:", (
values[0] )[--event] );
173 prof_head( blength, bucket, num_buckets, header );
177 for (
i = 0;
i < num_bufs;
i++ ) {
204 test_fail( __FILE__, __LINE__,
"PAPI_get_executable_info", 1 );
209 test_fail( __FILE__, __LINE__,
"PAPI_get_hardware_info", 2 );
214 #if defined(__powerpc__) 221 #if defined(ITANIUM2) 226 if (!
quiet) printf(
"Trouble adding events\n");
227 test_skip(__FILE__,__LINE__,
"add_test_events",2);
238 #if defined(ITANIUM1) || defined(ITANIUM2) \ 239 || (defined(__powerpc64__) && (_CALL_ELF != 2)) 241 end = (
caddr_t ) ( ( (
struct fdesc * ) end )->ip );
253 test_fail( __FILE__, __LINE__,
"Profile length < 0!", (
int )
length );
257 "Multi-event profiling at byte resolution.\n",
269 test_fail( __FILE__, __LINE__,
"No information in buffers", 1 );
char event_name[2][PAPI_MAX_STR_LEN]
int PAPI_stop(int EventSet, long long *values)
void test_pass(const char *filename)
static void my_main(void)
#define PAPI_PROFIL_BUCKET_32
get the executable's info
#define PAPI_PROFIL_POSIX
static struct timeval start
void test_warn(const char *file, int line, const char *call, int retval)
Return codes and api definitions.
void test_skip(const char *file, int line, const char *call, int retval)
char events[MAX_EVENTS][BUFSIZ]
unsigned long prof_size(unsigned long plength, unsigned scale, int bucket, int *num_buckets)
int PAPI_library_init(int version)
int PAPI_profil(void *buf, unsigned bufsiz, caddr_t offset, unsigned scale, int EventSet, int EventCode, int threshold, int flags)
void prof_out(caddr_t start, int n, int bucket, int num_buckets, unsigned int scale)
static void cleara(double a[N])
const PAPI_exe_info_t * PAPI_get_executable_info(void)
char model_string[PAPI_MAX_STR_LEN]
static int my_dummy(int i)
int main(int argc, char **argv)
void prof_head(unsigned long blength, int bucket, int num_buckets, const char *header)
struct test_events_t test_events[]
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)
void prof_print_address(const char *title, const PAPI_exe_info_t *prginfo)
void prof_print_prof_info(caddr_t start, caddr_t end, int threshold, char *event_name)
int prof_check(int n, int bucket, int num_buckets)
static int do_profile(caddr_t start, unsigned long plength, unsigned scale, int thresh, int bucket, unsigned int mask)
int PAPI_start(int EventSet)
const PAPI_hw_info_t * PAPI_get_hardware_info(void)
static long long values[NUM_EVENTS]
long long ** allocate_test_space(int num_tests, int num_events)
static const PAPI_hw_info_t * hw_info
int remove_test_events(int *EventSet, int mask)
void prof_alloc(int num, unsigned long blength)
static double a[MATRIX_SIZE][MATRIX_SIZE]
int add_test_events(int *number, int *mask, int allow_derived)