예제 #1
0
파일: mod_mpi.c 프로젝트: deskinner/ipm
int mod_mpi_xml(ipm_mod_t* mod, void *ptr, struct region *reg) 
{
  struct region *tmp;
  ipm_hent_t stats;
  double time;
  int res=0;
  
  if( !reg ) {
    time = ipm_mtime();
  }
  else {
    time = mpidata[reg->id].mtime;

    if( (reg->flags)&FLAG_PRINT_EXCLUSIVE ) {
      tmp = reg->child;
      while(tmp) {
	time -= mpidata[tmp->id].mtime;
	tmp = tmp->next;
      }
    }
  }

  res+=ipm_printf(ptr, 
		  "<module name=\"%s\" time=\"%.5e\" ></module>\n",
		  mod->name, time);
  
  return res; 
}
예제 #2
0
파일: mod_mpi.c 프로젝트: deskinner/ipm
int mod_mpi_region(ipm_mod_t *mod, int op, struct region *reg)
{
  double mtime;
  if( !reg ) return 0;

  mtime = ipm_mtime();

  switch(op) 
    {
    case -1: /* exit */
      mpidata[reg->id].mtime += (mtime - (mpidata[reg->id].mtime_e));
      break;
      
    case 1: /* enter */
      mpidata[reg->id].mtime_e=mtime;
      break;
  }

  return 0;
}
예제 #3
0
void ipm_region_end(struct region *reg)
{
  int i;

#ifdef HAVE_PAPI
  long long ctr1[MAXNUM_PAPI_EVENTS];
  //  long long ctr2[MAXNUM_PAPI_EVENTS];
#endif

  /* fprintf(stderr, "region_end for reg=%x name='%s'\n", reg, reg->name);  
   */

#ifdef HAVE_PAPI
  ipm_papi_read(ctr1);
#endif
  
  /* update data for region 'reg' */
  reg->wtime   += (ipm_wtime())  - (reg->wtime_e);
  reg->utime   += (ipm_utime())  - (reg->utime_e);
  reg->stime   += (ipm_stime())  - (reg->stime_e);
  reg->mtime   += (ipm_mtime())  - (reg->mtime_e);
  
  for( i=0; i<MAXNUM_MODULES; i++ ) {
    if( modules[i].regfunc ) {
      modules[i].regfunc(&(modules[i]), -1, reg);
    }
  }

#ifdef HAVE_PAPI
  // ipm_papi_read(ctr2);
  for( i=0; i<MAXNUM_PAPI_EVENTS; i++ ) {
    //reg->ctr_ipm[i] += (ctr2[i]-ctr1[i]);
    reg->ctr[i] += (ctr1[i]-reg->ctr_e[i]);
  }
#endif

}
예제 #4
0
void ipm_region_begin(struct region *reg)
{
  int i;

#ifdef HAVE_PAPI
  //long long ctr1[MAXNUM_PAPI_EVENTS];
  long long ctr2[MAXNUM_PAPI_EVENTS];
#endif
  
#ifdef HAVE_PAPI
  //ipm_papi_read(ctr1);
#endif 

  /* fprintf(stderr, "region_begin for reg=%x '%s'\n", reg, reg->name);
   */

  /* update enter stats for ipm_rstackptr */
  reg->wtime_e = ipm_wtime();
  reg->utime_e = ipm_utime();
  reg->stime_e = ipm_stime();
  reg->mtime_e = ipm_mtime();

  for( i=0; i<MAXNUM_MODULES; i++ ) {
    if( modules[i].regfunc ) {
      modules[i].regfunc(&(modules[i]), 1, reg);
    }
  }
  
#ifdef HAVE_PAPI
  ipm_papi_read(ctr2);
  for( i=0; i<MAXNUM_PAPI_EVENTS; i++ ) {
    //reg->ctr_ipm[i] += (ctr2[i]-ctr1[i]);
    reg->ctr_e[i]=ctr2[i];
  }
#endif
}
예제 #5
0
파일: ipm_core.c 프로젝트: nerscadmin/IPM
int ipm_finalize(int flags)
{
    int rv, i;

    if(ipm_state!=STATE_ACTIVE &&
            ipm_state!=STATE_NOTACTIVE ) {
        IPMERR("ipm_finalize() called with ipm_state=%d\n", ipm_state);
        return IPM_EOTHER;
    }

    ipm_state = STATE_IN_FINALIZE;

    /* this should be close to user code */
    ipm_region_end(&ipm_app);
    ipm_region(-1, "ipm_main");

    /* update global timing statistics */
    gettimeofday( &(task.t_stop), 0);
    task.wtime   = ipm_wtime()  -task.wtime;
    task.utime   = ipm_utime()  -task.utime;
    task.stime   = ipm_stime()  -task.stime;
    task.mtime   = ipm_mtime()  -task.mtime;
    task.iotime  = ipm_iotime() -task.iotime;
    task.omptime = ipm_omptime()-task.omptime;

    ipm_get_procmem(&(task.procmem));
    task.procmem /= (1024.0*1024.0*1024.0);

#ifdef HAVE_SELFMONITOR
    ipm_selfmon.t_finalize = ipm_wtime()-ipm_selfmon.t_finalize;
#endif

#ifdef HAVE_PAPI
    //rstack_adjust_ctrs();
#endif

    /* write out banner report */
    if( !(task.flags&FLAG_REPORT_NONE) ) {
        fflush(stdout);
        ipm_banner(stdout);
    }

#if defined(HAVE_MPI) && defined(HAVE_CALLPATH)
    ipm_unify_callsite_ids();
#endif

    /* call output routine for each module */
    for( i=0; i<MAXNUM_MODULES; i++ ) {
        if( i==IPM_MODULE_SELFMONITOR ||
                i==IPM_MODULE_MPI)
            continue;

        if( modules[i].output!=0 ) {
            IPMDBG("calling output() for module %d\n", i);
            rv = modules[i].output(&(modules[i]), flags);
        }
    }

    ipm_write_profile_log();

    rstack_cleanup(ipm_rstack);

#ifdef HAVE_SELFMONITOR
    mod_selfmonitor_output(&(modules[IPM_MODULE_SELFMONITOR]), flags);
#endif


    /* call finalization routine for each module */
    for( i=0; i<MAXNUM_MODULES; i++ ) {

        if( modules[i].finalize!=0 ) {
            IPMDBG("calling finalize() for module %d\n", i);
            rv = modules[i].finalize(&(modules[i]), flags);
        }
    }

    /* TODO: check errors in modules */
    ipm_state=STATE_FINALIZED;

    return IPM_OK;
}