Ejemplo n.º 1
0
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();
}
Ejemplo n.º 2
0
void ___rouent2(struct s1 *p) {
  uint64_t time;

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

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

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();

  if (!p->isseen)
    {
      char* rname =  p->rout;
      char* modpos;

      /* fix opari output file names */
      if ( (modpos = strstr(p->file, ".mod.")) != NULL )
        {
          strcpy(modpos, modpos+4);
        }

#if (defined(VT_MT) || defined(VT_HYB))
      VTTHRD_LOCK_IDS();
      if (!p->isseen)
        {
          p->fid = vt_def_scl_file(VT_CURRENT_THREAD, p->file);
          p->rid = vt_def_region(VT_CURRENT_THREAD, rname, p->fid, p->lineno,
                                 VT_NO_LNO, NULL, VT_FUNCTION);
          p->isseen = 1;
        }
      VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
      p->fid = vt_def_scl_file(VT_CURRENT_THREAD, p->file);
      p->rid = vt_def_region(VT_CURRENT_THREAD, rname, p->fid, p->lineno,
                             VT_NO_LNO, NULL, VT_FUNCTION);
      p->isseen = 1;
#endif /* VT_MT || VT_HYB */
    }

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

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 3
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();
}
Ejemplo n.º 4
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();
}
Ejemplo n.º 5
0
pid_t waitpid(pid_t pid, int* status, int options)
{
  pid_t rc;
  uint64_t time;

  VT_MEMHOOKS_OFF();

  if ( DO_TRACE(waitpid) )
  {
    /* mark enter function */
    time = vt_pform_wtime();
    vt_enter(&time, libc_funcs[FUNCIDX(waitpid)].rid);
  }

  /* call (real) function */
  CALL_FUNC(waitpid, rc, (pid, status, options));

  if ( DO_TRACE(waitpid) )
  {
    /* mark leave function */
    time = vt_pform_wtime();
    vt_exit(&time);
  }

  VT_MEMHOOKS_ON();

  return rc;
}
Ejemplo n.º 6
0
pid_t wait(WAIT_STATUS_TYPE status)
{
  pid_t rc;
  uint64_t time;

  VT_MEMHOOKS_OFF();

  if ( DO_TRACE(wait) )
  {
    /* mark enter function */
    time = vt_pform_wtime();
    vt_enter(&time, libc_funcs[FUNCIDX(wait)].rid);
  }

  /* call (real) function */
  CALL_FUNC(wait, rc, (status));

  if ( DO_TRACE(wait) )
  {
    /* mark leave function */
    time = vt_pform_wtime();
    vt_exit(&time);
  }

  VT_MEMHOOKS_ON();

  return rc;
}
Ejemplo n.º 7
0
int system(const char* string)
{
  int rc;
  uint64_t time;

  VT_MEMHOOKS_OFF();

  if ( DO_TRACE(system) )
  {
    /* mark enter function */
    time = vt_pform_wtime();
    vt_enter(&time, libc_funcs[FUNCIDX(system)].rid);
  }

  /* call (real) function */
  CALL_FUNC(system, rc, (string));

  if ( DO_TRACE(system) )
  {
    /* mark leave function */
    time = vt_pform_wtime();
    vt_exit(&time);
  }

  VT_MEMHOOKS_ON();

  return rc;
}
Ejemplo n.º 8
0
pid_t fork(void)
{
  pid_t rc;
  uint64_t time;

  VT_MEMHOOKS_OFF();

  if ( DO_TRACE(fork) )
  {
    /* mark enter function */
    time = vt_pform_wtime();
    vt_enter(&time, libc_funcs[FUNCIDX(fork)].rid);
  }

  /* call (real) function */
  CALL_FUNC(fork, rc, ());

  if ( DO_TRACE(fork) )
  {
    /* handle fork, if succeeded */
    if ( rc != -1 )
      vt_fork(rc);

    if ( rc != 0 )
    {
      /* mark leave function */
      time = vt_pform_wtime();
      vt_exit(&time);
    }
  }
    
  VT_MEMHOOKS_ON();

  return rc;
}
Ejemplo n.º 9
0
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();
}
Ejemplo n.º 10
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();
}
Ejemplo n.º 11
0
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__,
Ejemplo n.º 12
0
void VT_User_trace_off__()
{
  VT_INIT;

  VT_MEMHOOKS_OFF();

  vt_trace_off(VT_CURRENT_THREAD, 1, 0);

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 13
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();
}
Ejemplo n.º 14
0
void VT_User_comment_def__(const char* comment)
{
  VT_INIT;

  VT_MEMHOOKS_OFF();

  vt_def_comment(VT_CURRENT_THREAD, comment);

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 15
0
void VT_User_buffer_flush__()
{
  VT_INIT;

  VT_MEMHOOKS_OFF();

  vt_buffer_flush(VT_CURRENT_THREAD);

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 16
0
void VT_User_end__(const char *name) {
  uint64_t time;

  VT_MEMHOOKS_OFF();

  /* -- write exit record -- */
  time = vt_pform_wtime();
  vt_exit(&time);

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 17
0
void VT_User_end___f(const char *name, int nl) {
  uint64_t time;

  VT_MEMHOOKS_OFF();

  /* -- write exit record -- */
  time = vt_pform_wtime();
  vt_exit(&time);

  VT_MEMHOOKS_ON();
} VT_GENERATE_F77_BINDINGS(vt_user_end__, VT_USER_END__,
Ejemplo n.º 18
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();
}
Ejemplo n.º 19
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();
}
Ejemplo n.º 20
0
void VT_User_rewind__(void)
{
  uint64_t time;

  VT_INIT;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();
  vt_rewind(VT_CURRENT_THREAD, &time);

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 21
0
void VT_User_update_counter__()
{
  uint64_t time;

  VT_INIT;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();
  vt_update_counter(VT_CURRENT_THREAD, &time);

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 22
0
void VT_User_comment__(const char* comment)
{
  uint64_t time;

  VT_INIT;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();
  vt_comment(VT_CURRENT_THREAD, &time, comment);

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 23
0
void ___rouret2(void) {
  uint64_t time;

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

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();
  vt_exit(VT_CURRENT_THREAD, &time);

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 24
0
VT_DECLDEF(void __profile_init(struct profile_init_struct* d))
{
  (void)d;

  if ( openuh_init )
  {
    VT_MEMHOOKS_OFF();
    openuh_init = 0;
    vt_open();
    vt_comp_finalize = &__profile_finish;
    VT_MEMHOOKS_ON();
  }
}
Ejemplo n.º 25
0
void VT_User_marker__(unsigned int mid, const char* mtext)
{
  uint64_t time;

  VT_INIT;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();
  vt_marker(VT_CURRENT_THREAD, &time, mid, mtext);

  VT_MEMHOOKS_ON();
}
Ejemplo n.º 26
0
int VT_User_is_trace_on__()
{
  int ret;

  VT_INIT;

  VT_MEMHOOKS_OFF();

  ret = vt_is_trace_on(VT_CURRENT_THREAD);

  VT_MEMHOOKS_ON();

  return ret;
}
Ejemplo n.º 27
0
void VT_User_timesync__()
{
#if ((defined(VT_MPI) || defined(VT_HYB)) \
    && defined(VT_ETIMESYNC) && TIMER_IS_GLOBAL == 0)
  VT_INIT;

  VT_MEMHOOKS_OFF();

  if ( vt_num_traces > 1 && vt_env_etimesync() )
    vt_esync(MPI_COMM_WORLD);

  VT_MEMHOOKS_ON();
#endif /* (VT_MPI || VT_HYB) && VT_ETIMESYNC && TIMER_IS_GLOBAL */
}
Ejemplo n.º 28
0
void* vt_malloc_hook(size_t size, const void* caller)
{
  void* result;
  uint64_t bytes;
  uint64_t time;
  uint8_t was_recorded;

  VT_MEMHOOKS_OFF(); /* restore original hooks */

  time = vt_pform_wtime();
  was_recorded = vt_enter(VT_CURRENT_THREAD, &time,
                          memhook_regid[MEMHOOK_REG_MALLOC]);

  result = malloc(size); /* call recursively */

  /* get total allocated memory */
  if ( result != NULL )
  {
    bytes = ( ~ (uint64_t) 3 ) & (uint64_t) *( (size_t*) ( (char*)result - SIZEOF_VOIDP ) );
  }
  else
  {
    bytes = 0;
  }

  /* update counter value */
  memalloc_val += bytes;

  time = vt_pform_wtime();

  if ( was_recorded && bytes > 0 )
  {
    /* write marker, if desired */
    if( memalloc_marker )
    {
      vt_marker(VT_CURRENT_THREAD, &time, memalloc_mid[MEMHOOK_MARK_ALLOC],
                "Allocated %llu Bytes", (unsigned long long)bytes);
    }

    /* write counter value */
    vt_count(VT_CURRENT_THREAD, &time, memalloc_cid, memalloc_val);
  }

  vt_exit(VT_CURRENT_THREAD, &time);

  VT_MEMHOOKS_ON(); /* restore our own hooks */

  return result;
}
Ejemplo n.º 29
0
VT_DECLDEF(void VT_User_count_double_val___f(unsigned int* cid, double* val))
{
  uint64_t time;
  uint64_t cval;

  VT_INIT;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();
  cval = OTF_Double2Counter(*val);
  vt_count(VT_CURRENT_THREAD, &time, *cid, cval);

  VT_MEMHOOKS_ON();
} VT_GENERATE_F77_BINDINGS(vt_user_count_double_val__,
Ejemplo n.º 30
0
void VT_User_count_double_val__(unsigned int cid, double val)
{
  uint64_t time;
  uint64_t cval;

  VT_INIT;

  VT_MEMHOOKS_OFF();

  time = vt_pform_wtime();
  cval = OTF_Double2Counter(val);
  vt_count(VT_CURRENT_THREAD, &time, cid, cval);

  VT_MEMHOOKS_ON();
}