#ifndef PMC_PRIVATE_H #define PMC_PRIVATE_H /*----------------------------------------------------------------------------*/ /* * Performance-Monitoring Counters Library, for Intel/AMD Processors and Linux * Author: Don Heller, dheller@scl.ameslab.gov * Last revised: 5 October 2001 */ /*----------------------------------------------------------------------------*/ /* private interface to the PMC library */ /*----------------------------------------------------------------------------*/ #include #include /*----------------------------------------------------------------------------*/ /* global variables */ /* defined in pmc_events.c */ extern const int pmc_num_events; extern const pmc_event_set_t * pmc_group_events[]; extern const int pmc_num_group_events[]; extern const int pmc_num_groups; /* defined in pmc_lib.c */ extern const char pmc_options[]; /* user-level compile-time options */ extern const char * pmc_cpu[]; /* from pmc_sys.h */ extern const int pmc_device_hardware_type; /* from pmc_sys.h */ extern const char pmc_default_program_name[]; extern const char * pmc_program; /* where the error messages come from */ extern FILE * pmc_stderr; /* where the error messages go to */ extern FILE * pmc_stdmea; /* where the measurements go to */ #ifdef PMC_VERBOSE extern int pmc_verbose; /* set by -Verbose option */ /* messages go to pmc_stderr */ #endif #ifdef PMC_MEASURE extern int pmc_measure; /* set by -Measure option */ #endif /*----------------------------------------------------------------------------*/ /* defined in pmc_processor.c */ int pmc_verify_datatypes(FILE * outfile, const char * const prog); int pmc_verify_processor(FILE * outfile, const char * const prog, int devpmc); int pmc_verify_alignment(FILE * outfile, const char * const prog); int pmc_guess_mhz(const int seconds); int pmc_cache_size(int request); /* requires previous call to pmc_verify_processor() */ /*----------------------------------------------------------------------------*/ /* defined in pmc_control.c */ void pmc_control_set(pmc_control_t * ctl); void pmc_control_mask(pmc_control_t * ctl); pmc_selector_t pmc_control_register(const pmc_control_t * ctl); void pmc_control_write(FILE * outfile, const pmc_control_t * const ctl); int pmc_control_read (FILE * infile, const char * const file, int line, const int event_pairs, const int replication, const pmc_control_t * const ctl); int pmc_event_code(pmc_uint32_t c); /*----------------------------------------------------------------------------*/ /* defined in pmc_events.c */ int pmc_events_init(void); int pmc_check_event_group(const pmc_event_set_t * events, const int num); /*----------------------------------------------------------------------------*/ /* defined in pmc_getargs.c */ void pmc_print_input_file(FILE * f, pmc_control_t * ctl); /*----------------------------------------------------------------------------*/ /* defined in pmc_job.c */ int pmc_job_check(void); /*----------------------------------------------------------------------------*/ /* defined in pmc_lib.c */ void * pmc_calloc(const int count, const int size, const int align); void pmc_free(void * ptr); void pmc_counter_zero(pmc_counter_t * counter); void pmc_counter_print_1(FILE * outfile, const pmc_counter_t * const ctr, const int k); void pmc_counter_print_2(FILE * outfile, const pmc_counter_t * const ctr, const int i, const int j); /*----------------------------------------------------------------------------*/ #ifdef PMC_VERBOSE #define PMC_VERBOSE_(func) \ if (pmc_verbose) { fprintf(pmc_stderr, #func "()\n"); fflush(pmc_stderr); } #define PMC_VERBOSE_IN(func) \ if (pmc_verbose) { fprintf(pmc_stderr, #func "() in\n"); fflush(pmc_stderr); } #define PMC_VERBOSE_OUT(func) \ if (pmc_verbose) { fprintf(pmc_stderr, #func "() out\n"); fflush(pmc_stderr); } #define PMC_VERBOSE_MSG(msg) \ if (pmc_verbose) { fprintf(pmc_stderr, msg "\n"); fflush(pmc_stderr); } #else #define PMC_VERBOSE_(func) #define PMC_VERBOSE_IN(func) #define PMC_VERBOSE_OUT(func) #define PMC_VERBOSE_MSG(msg) #endif /* PMC_VERBOSE */ /*----------------------------------------------------------------------------*/ #endif /* PMC_PRIVATE_H */