void __rouinit() { if (rou_init) { unsigned t; esd_open(); /* open measurement */ #ifdef CHECK_STACK EpkMaxFrames = epk_str2int(epk_get(ESD_FRAMES)); cstkszv = calloc(ELG_NUM_THREADS, sizeof(long)); cstkmxv = calloc(ELG_NUM_THREADS, sizeof(long)); cstackv = calloc(ELG_NUM_THREADS, sizeof(elg_ui4*)); if (!cstkszv || !cstkmxv || !cstackv) elg_error_msg("Failed to allocate callstack vectors for %d threads", ELG_NUM_THREADS); for (t=0; t<ELG_NUM_THREADS; t++) { cstackv[t] = calloc(EpkMaxFrames, sizeof(elg_ui4)); if (!cstackv[t]) elg_error_msg("Failed to allocate callstack for thread %t", t); } elg_cntl_msg("Allocated %d-depth callstacks for %d threads", EpkMaxFrames, ELG_NUM_THREADS); #endif epk_filter_gen(); /* initialise filter from file (if defined) */ epk_comp_finalize = &__rouexit; rou_init = 0; } }
void profile_init() { profiling_enabled = get_env_flag(ENV_PROFILE, DEFAULT_ENABLE_PROFILE); epik_avail = (esd_open != NULL); if (epik_avail) { esd_open(); } if (profiling_enabled) epik_enabled = epik_avail; }
void shmem_init(void) { esd_open(); epk_shm_register(); #ifndef EPK_CSITE_INST esd_enter(epk_shm_regid[EPK__SHMEM_INIT]); #endif TRACE_OFF(); pshmem_init(); TRACE_ON(); epk_shmem_init(); esd_collexit(epk_shm_regid[EPK__SHMEM_INIT], ELG_NO_ID, epk_shm_all_cid, 0, 0); }
void __pat_tp_func_entry(void* func, void* callsite) { HashNode *hn; void * funcptr = func; #ifdef __ia64__ funcptr = *( void ** )func; #endif /* -- if not yet initialized, initialize EPIK -- */ if ( cce_init ) { if (cce_init != 1) { elg_cntl_msg("Ignoring function @%p entered during initialization", func); return; } cce_init = -1; epk_open_exe(); esd_open(); epk_comp_status = &epk_filter_status; epk_comp_finalize = &cyg_profile_finalize; cce_init = 0; } if ( (hn = epk_hash_get((long)funcptr)) ) { if ( hn->elgid == ELG_NO_ID ) { /* -- region entered the first time, register region -- */ # if defined (ELG_OMPI) || defined (ELG_OMP) if (omp_in_parallel()) { # pragma omp critical (epk_comp_register_region) { if ( hn->elgid == ELG_NO_ID ) { hn->elgid = epk_register_region(hn->name, hn->fname, hn->lno); } } } else { hn->elgid = epk_register_region(hn->name, hn->fname, hn->lno); } # else hn->elgid = epk_register_region(hn->name, hn->fname, hn->lno); # endif } esd_enter(hn->elgid); } }