unsigned int VT_User_def__(const char* name, const char* file, int lno)
{
  uint32_t rid;

  VT_INIT;

  VT_SUSPEND_MALLOC_TRACING(VT_CURRENT_THREAD);

  /* -- get region identifier by name, file, and line number -- */
  if ( (rid = hash_get_region(name, file, lno)) == VT_NO_ID )
  {
    /* -- register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( (rid = hash_get_region(name, file, lno)) == VT_NO_ID )
      rid = register_region(0, name, file, lno);
    VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
    rid = register_region(0, name, file, lno);
#endif /* VT_MT || VT_HYB */
  }

  VT_RESUME_MALLOC_TRACING(VT_CURRENT_THREAD);

  return rid;
}
VT_DECLDEF(void __profile_loop(struct profile_gen_struct* d))
{
  uint64_t time;

  /* -- if VampirTrace already finalized, return -- */
  if ( !vt_is_alive ) return;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  /* -- get region identifier -- */
  if ( d->data == NULL )
  {
    /* -- loop entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( d->data == NULL )
      register_region(d, VT_LOOP);
    VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
    register_region(d, VT_LOOP);
#endif /* VT_MT || VT_HYB */
  }

  /* -- write enter record -- */
  vt_enter(&time, *((uint32_t*)(d->data)));

  VT_MEMHOOKS_ON();
}
void VT_User_start__(const char* name, const char *file, int lno) {
  uint32_t rid;
  uint64_t time;

  /* -- if not yet initialized, initialize VampirTrace -- */
  if ( vt_init ) {
    VT_MEMHOOKS_OFF();
    vt_init = 0;
    vt_open();
    VT_MEMHOOKS_ON();
  }

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  /* -- get region identifier -- */
  if ( (rid = hash_get((unsigned long) name)) == VT_NO_ID ) {
    /* -- region entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( (rid = hash_get((unsigned long) name)) == VT_NO_ID )
      rid = register_region(name, 0, file, lno);
    VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
    rid = register_region(name, 0, file, lno);
#endif /* VT_MT || VT_HYB */
  }

  /* -- write enter record -- */
  vt_enter(&time, rid);

  VT_MEMHOOKS_ON();
}
void VT_User_start__(const char* name, const char* file, int lno)
{
  uint32_t rid;
  uint64_t time;

  VT_INIT;

  VT_SUSPEND_MALLOC_TRACING(VT_CURRENT_THREAD);

  time = vt_pform_wtime();

  /* -- get region identifier by address -- */
  if ( (rid = hash_get_addr((unsigned long)name)) == VT_NO_ID )
  {
    /* -- region entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( (rid = hash_get_addr((unsigned long)name)) == VT_NO_ID )
      rid = register_region((unsigned long)name, name, file, lno);
    VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
    rid = register_region((unsigned long)name, name, file, lno);
#endif /* VT_MT || VT_HYB */
  }

  /* -- write enter record -- */
  vt_enter(VT_CURRENT_THREAD, &time, rid);

  VT_RESUME_MALLOC_TRACING(VT_CURRENT_THREAD);
}
示例#5
0
void VT_Dyn_start(uint32_t index, const char* name, const char* fname,
                  uint32_t lno, uint32_t loop)
{
  uint64_t time;
  uint32_t* rid;

  vt_libassert(index < VT_MAX_DYNINST_REGIONS);

  /* Ignore events if VT is initializing */
  if( !dyn_init && !vt_is_alive ) return;

  /* If not yet initialized, initialize VampirTrace */
  if ( dyn_init )
  {
    VT_MEMHOOKS_OFF();
    dyn_init = 0;
    rtab = (uint32_t*)calloc(VT_MAX_DYNINST_REGIONS, sizeof(uint32_t));
    if ( rtab == NULL )
      vt_error();
    vt_open();
    vt_comp_finalize = VT_Dyn_finalize;
    VT_MEMHOOKS_ON();
  }

  /* If VampirTrace already finalized, return */
  if ( !vt_is_alive ) return;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  /* Get region identifier
   */
  rid = &(rtab[index]);
  if ( *rid == 0 )
  {
    /* If region entered the first time, register region
     */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( *rid == 0 )
      *rid = register_region(name, fname, lno, loop);
    VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
    *rid = register_region(name, fname, lno, loop);
#endif /* VT_MT || VT_HYB */
  }

  /* Write enter record */
  vt_enter(VT_CURRENT_THREAD, &time, *rid);

  VT_MEMHOOKS_ON();
}
示例#6
0
void phat_enter(char *str, int *id) {
  uint64_t time;

  /* -- if not yet initialized, initialize VampirTrace -- */
  if ( phat_init ) {
    uint32_t main_id;
    VT_MEMHOOKS_OFF();
    phat_init = 0;
    vt_open();

    main_id = register_region("main");
    time = vt_pform_wtime();
    vt_enter(&time, main_id);
    VT_MEMHOOKS_ON();
  }

  /* -- if VampirTrace already finalized, return -- */
  if ( !vt_is_alive ) return;

  /* -- ignore SUN OMP runtime functions -- */
  if ( strchr(str, '$') != NULL ) return;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  /* -- get region identifier -- */
  if ( *id == -1 ) {
    /* -- region entered the first time, register region -- */
#   if defined (VT_OMPI) || defined (VT_OMP)
    if (omp_in_parallel()) {
#     pragma omp critical (vt_comp_phat_1)
      {
        if ( (*id = hash_get((long) str)) == VT_NO_ID ) {
          *id = register_region(str);
        }
      }
    } else {
      *id = register_region(str);
    }
#   else
    *id = register_region(str);
#   endif
  }

  /* -- write enter record -- */
  vt_enter(&time, *id);

  VT_MEMHOOKS_ON();
}
示例#7
0
void __cyg_profile_func_enter(void* func, void* callsite) {
  void* funcptr;
  uint64_t time;
  HashNode* hn;

  funcptr = DEREF_IA64_FUNC_PTR(func);

  /* -- if not yet initialized, initialize VampirTrace -- */
  if ( gnu_init ) {
    VT_MEMHOOKS_OFF();
    gnu_init = 0;
    vt_open();
    vt_comp_finalize = gnu_finalize;
    get_symtab();
    VT_MEMHOOKS_ON();
  }

  /* -- if VampirTrace already finalized, return -- */
  if ( !vt_is_alive ) return;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  /* -- get region identifier -- */
  if ( (hn = hash_get((long)funcptr))) {
    if ( hn->vtid == VT_NO_ID ) {
      /* -- region entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
      VTTHRD_LOCK_IDS();
      if( hn->vtid == VT_NO_ID )
        register_region(hn);
      VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
      register_region(hn);
#endif /* VT_MT || VT_HYB */
    }

    /* -- write enter record -- */
    vt_enter(VT_CURRENT_THREAD, &time, hn->vtid);
  }

  VT_MEMHOOKS_ON();
}
VT_DECLDEF(void VT_User_start___f(const char* name, const char* file, int* lno,
                                  int nl, int fl))
{
  uint32_t rid;
  uint64_t time;

  int namlen;
  int fillen;
  char fnambuf[128];
  char ffilbuf[1024];

  VT_INIT;

  VT_SUSPEND_MALLOC_TRACING(VT_CURRENT_THREAD);

  time = vt_pform_wtime();

  /* -- convert Fortran to C strings -- */
  namlen = ( nl < 128 ) ? nl : 127;
  strncpy(fnambuf, name, namlen);
  fnambuf[namlen] = '\0';
  fillen = ( fl < 1024 ) ? fl : 1023;
  strncpy(ffilbuf, file, fillen);
  ffilbuf[fillen] = '\0';

  /* -- get region identifier by address -- */
  if ( (rid = hash_get_addr((unsigned long)name)) == VT_NO_ID )
  {
    /* -- region entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( (rid = hash_get_addr((unsigned long)name)) == VT_NO_ID )
      rid = register_region((unsigned long)name, fnambuf, NULL, ffilbuf, *lno);
    VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
    rid = register_region((unsigned long)name, fnambuf, NULL, ffilbuf, *lno);
#endif /* VT_MT || VT_HYB */
  }

  /* -- write enter record -- */
  vt_enter(VT_CURRENT_THREAD, &time, rid);

  VT_RESUME_MALLOC_TRACING(VT_CURRENT_THREAD);
} VT_GENERATE_F77_BINDINGS(vt_user_start__, VT_USER_START__,
void VT_User_start___f(const char* name, const char *file, int *lno, int nl, int fl) {
  uint32_t rid;
  uint64_t time;
  int namlen;
  int fillen;

  /* -- convert Fortran to C strings -- */
  namlen = ( nl < 128 ) ? nl : 127;
  fillen = ( fl < 1024 ) ? fl : 1023;
  strncpy(fnambuf, name, namlen);
  fnambuf[namlen] = '\0';
  strncpy(ffilbuf, file, fillen);
  ffilbuf[fillen] = '\0';

  /* -- if not yet initialized, initialize VampirTrace -- */
  if ( vt_init ) {
    VT_MEMHOOKS_OFF();
    vt_init = 0;
    vt_open();
    VT_MEMHOOKS_ON();
  }

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  /* -- get region identifier -- */
  if ( (rid = hash_get((unsigned long) name)) == VT_NO_ID ) {
    /* -- region entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( (rid = hash_get((unsigned long) name)) == VT_NO_ID )
      rid = register_region(fnambuf, (unsigned long) name, ffilbuf, *lno);
    VTTHRD_UNLOCK_IDS();
#else
    rid = register_region(fnambuf, (unsigned long) name, ffilbuf, *lno);
#endif
  }

  /* -- write enter record -- */
  vt_enter(&time, rid);

  VT_MEMHOOKS_ON();
} VT_GENERATE_F77_BINDINGS(vt_user_start__, VT_USER_START__,
示例#10
0
void _ftrace_enter2_() {
  char *func = (char *)vftr_getname();
  int len = vftr_getname_len();
  uint32_t rid;
  uint64_t time;

  /* -- if not yet initialized, initialize VampirTrace -- */
  if ( necsx_init ) {
    VT_MEMHOOKS_OFF();
    necsx_init = 0;
    vt_open();
    vt_comp_finalize = &ftrace_finalize;
    VT_MEMHOOKS_ON();
  }

  /* -- if VampirTrace already finalized, return -- */
  if ( !vt_is_alive ) return;

  /* -- ignore NEC OMP runtime functions -- */
  if ( strchr(func, '$') != NULL ) return;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  /* -- get region identifier -- */
  if ( (rid = hash_get((long) func)) == VT_NO_ID ) {
    /* -- region entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( (rid = hash_get((long) func)) == VT_NO_ID )
      rid = register_region(func, len);
    VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
    rid = register_region(func, len);
#endif /* VT_MT || VT_HYB */
  }

  /* -- write enter record -- */
  vt_enter(VT_CURRENT_THREAD, &time, rid);

  VT_MEMHOOKS_ON();
}
示例#11
0
void __func_trace_enter(char* name, char* fname, int lno) {
  HashNode *hn;
  uint64_t time;

  /* -- if not yet initialized, initialize VampirTrace -- */
  if ( xl_init ) {
    VT_MEMHOOKS_OFF();
    xl_init = 0;
    vt_open();
    vt_comp_finalize = &xl_finalize;
    VT_MEMHOOKS_ON();
  }

  /* -- if VampirTrace already finalized, return -- */
  if ( !vt_is_alive ) return;

  /* -- ignore IBM OMP runtime functions -- */
  if ( strchr(name, '@') != NULL ) return;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  /* -- get region identifier -- */
  if ( (hn = hash_get((long) name)) == 0 ) {
    /* -- region entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( (hn = hash_get((long) name)) == 0 )
      hn = register_region(name, fname, lno);
    VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
    hn = register_region(name, fname, lno);
#endif /* VT_MT || VT_HYB */
  }

  /* -- write enter record -- */
  vt_enter(VT_CURRENT_THREAD, &time, hn->vtid);

  VT_MEMHOOKS_ON();
}
示例#12
0
void phat_enter(char *str, int *id) {
  uint64_t time;

  /* -- if not yet initialized, initialize VampirTrace -- */
  if ( phat_init ) {
    VT_MEMHOOKS_OFF();
    phat_init = 0;
    vt_open();
    vt_comp_finalize = &phat_finalize;
    VT_MEMHOOKS_ON();
  }

  /* -- if VampirTrace already finalized, return -- */
  if ( !vt_is_alive ) return;

  /* -- ignore SUN OMP runtime functions -- */
  if ( strchr(str, '$') != NULL ) return;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  /* -- get region identifier -- */
  if ( *id == -1 ) {
    /* -- region entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
     VTTHRD_LOCK_IDS();
     if ( (*id = hash_get((long) str)) == VT_NO_ID )
       *id = register_region(str);
     VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
     *id = register_region(str);
#endif /* VT_MT || VT_HYB */
  }

  /* -- write enter record -- */
  vt_enter(VT_CURRENT_THREAD, &time, *id);

  VT_MEMHOOKS_ON();
}
示例#13
0
/*
 * This function is called at the entry of each function
 * The call is generated by the IBM xl compilers
 *
 * XL C/C++ 11.x / XLF 13.x or later pass the address of a static pointer
 * variable, initialized with NULL, as additional parameter.
 */

#if __IBMC__ > 1100
void __func_trace_enter(char* name, char* fname, int lno, HashNode** ihn)
#else /* __IBMC__ */
void __func_trace_enter(char* name, char* fname, int lno)
#endif /* __IBMC__ */
{
  HashNode *hn;
  uint32_t tid;
  uint64_t time;

  /* -- ignore IBM OMP runtime functions -- */
# if __IBMC__ > 1100
  if ( *ihn == &ignored_func ) return;
# endif /* __IBMC__ */
  if ( ( strchr(name, '@') != NULL ) || (strchr(name, '$') != NULL) ) {
#   if __IBMC__ > 1100
    *ihn = &ignored_func;
#   endif /* __IBMC__ */
    return;
  }

  /* -- if not yet initialized, initialize VampirTrace -- */
  if ( xl_init ) {
    xl_init = 0;
    vt_open();
    vt_comp_finalize = &xl_finalize;
  }

  /* -- if VampirTrace already finalized, return -- */
  if ( !vt_is_alive ) return;

  /* -- get calling thread id -- */
  GET_THREAD_ID(tid);

  VT_SUSPEND_MALLOC_TRACING(tid);

  time = vt_pform_wtime();

# if __IBMC__ > 1100
  /* -- region not yet registered -- */
  if ( *ihn == NULL ) {
# endif /* __IBMC__ */

  /* -- get region identifier -- */
  if ( (hn = hash_get((long) name)) == 0 ) {
    /* -- region entered the first time, register region -- */
#if (defined(VT_MT) || defined(VT_HYB))
    VTTHRD_LOCK_IDS();
    if ( (hn = hash_get((long) name)) == 0 ) {
      hn = register_region(tid, name, fname, lno);
#     if __IBMC__ > 1100
      *ihn = hn;
#     endif /* __IBMC__ */
    }
    VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
    hn = register_region(tid, name, fname, lno);
#   if __IBMC__ > 1100
    *ihn = hn;
#   endif /* __IBMC__ */
#endif /* VT_MT || VT_HYB */
  }

#if __IBMC__ > 1100
  } else {
    /* -- region already registered -- */
    hn = *ihn;
  }
#endif /* __IBMC__ */

  /* -- write enter record -- */
  vt_enter(tid, &time, hn->vtid);

  VT_RESUME_MALLOC_TRACING(tid);
}