added dvm/tools/
This commit is contained in:
28
dvm/tools/pppa/branches/dvm4.07/makefile.uni
Normal file
28
dvm/tools/pppa/branches/dvm4.07/makefile.uni
Normal file
@@ -0,0 +1,28 @@
|
||||
#######################################################################
|
||||
## Copyright (C) 1999 ##
|
||||
## Keldysh Institute of Appllied Mathematicd ##
|
||||
#######################################################################
|
||||
|
||||
# dvm/pppa/makefile.gnu
|
||||
#
|
||||
# This makefile recursively calls MAKE in each subdirectory
|
||||
#
|
||||
|
||||
# What to compile
|
||||
SUBDIR=src
|
||||
|
||||
all:
|
||||
@echo "****** RECURSIVELY MAKING SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
cd ../predictor/Zlib/Src; ($(MAKE) "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" all > logfile.txt)
|
||||
cd src; ($(MAKE) "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" all > logfile.txt)
|
||||
@echo "****** DONE MAKING SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
|
||||
clean:
|
||||
@echo "****** RECURSIVELY CLEAN SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
(cd src; $(MAKE) "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" clean)
|
||||
@echo "****** DONE CLEAN SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
|
||||
cleanall:
|
||||
@echo "****** RECURSIVELY CLEANALL SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
(cd src; $(MAKE) "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" cleanall)
|
||||
@echo "****** DONE CLEANALL SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
42
dvm/tools/pppa/branches/dvm4.07/makefile.win
Normal file
42
dvm/tools/pppa/branches/dvm4.07/makefile.win
Normal file
@@ -0,0 +1,42 @@
|
||||
#######################################################################
|
||||
## Copyright (C) 1999 ##
|
||||
## Keldysh Institute of Appllied Mathematicd ##
|
||||
#######################################################################
|
||||
|
||||
|
||||
# dvm/pppa/makefile.win
|
||||
|
||||
# Valentin Emelianon (4/01/99)
|
||||
|
||||
#
|
||||
# This makefile recursively calls MAKE in each subdirectory
|
||||
#
|
||||
|
||||
# What to compile
|
||||
SUBDIR=src
|
||||
|
||||
all:
|
||||
@echo "****** RECURSIVELY MAKING SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
@cd ..\predictor\Zlib
|
||||
@$(MAKE) /nologo /f Zlib.mak "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" CFG="Zlib - Win32 Release" ALL > translate.log
|
||||
@cd ..\..\pppa\src
|
||||
@$(MAKE) /nologo -f makefile.win "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" all > logfile.txt
|
||||
@cd ..
|
||||
@echo "****** DONE MAKING SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
|
||||
clean:
|
||||
@echo "****** RECURSIVELY CLEAN SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
@cd src
|
||||
@$(MAKE) /nologo -f makefile.win "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" clean
|
||||
@cd ..
|
||||
@del /q .\obj\*.*
|
||||
@echo "****** DONE CLEAN SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
|
||||
cleanall:
|
||||
@echo "****** RECURSIVELY CLEANALL SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
@cd src
|
||||
@$(MAKE) /nologo -f makefile.win "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" cleanall
|
||||
@cd ..
|
||||
@del /q .\bin\*.*
|
||||
@del /q .\obj\*.*
|
||||
@echo "****** DONE CLEANALL SUBDIRECTORIES dvm/pppa/: $(SUBDIR) ******"
|
||||
7
dvm/tools/pppa/branches/dvm4.07/src/bool.h
Normal file
7
dvm/tools/pppa/branches/dvm4.07/src/bool.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef _BOOL_H
|
||||
#define _BOOL_H
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
typedef int BOOL;
|
||||
#endif
|
||||
|
||||
2
dvm/tools/pppa/branches/dvm4.07/src/dvmvers.h
Normal file
2
dvm/tools/pppa/branches/dvm4.07/src/dvmvers.h
Normal file
@@ -0,0 +1,2 @@
|
||||
#define VERS "406"
|
||||
#define PLATFORM "ntmpich"
|
||||
350
dvm/tools/pppa/branches/dvm4.07/src/inter.cpp
Normal file
350
dvm/tools/pppa/branches/dvm4.07/src/inter.cpp
Normal file
@@ -0,0 +1,350 @@
|
||||
#define _STATFILE_
|
||||
#include "inter.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
// calculate execution characteristics for interval
|
||||
CInter::CInter(s_GRPTIMES (*pt)[StatGrpCount],s_SendRecvTimes ps,
|
||||
ident id,unsigned long nint,
|
||||
int iIM,int jIM,short sore)
|
||||
//(*pt)[StatGrpCount] - pointer to time array,it reading from file,
|
||||
// ps - pointer to add info
|
||||
//id - interval identifier,
|
||||
//nint - interval number.
|
||||
{
|
||||
//identifire interval information
|
||||
if (id.pname[0]!='\0') {
|
||||
idint.pname=new char[strlen(id.pname)+1];
|
||||
if (idint.pname==NULL) throw("Out of memory\n");
|
||||
}
|
||||
else idint.pname=NULL;
|
||||
if (idint.pname!=NULL) strcpy(idint.pname,id.pname);// name of DVM-programm
|
||||
idint.nline=id.nline; // number of DVM-programm line
|
||||
idint.nline_end=id.nline_end; // number of end of DVM-programm line
|
||||
idint.nenter=id.nenter; // number of enters into the interval
|
||||
idint.expr=id.expr; // conditional expession
|
||||
idint.nlev=id.nlev; // number of interval level
|
||||
idint.t=id.t; // type of interval
|
||||
ninter=nint;
|
||||
idint.proc=id.proc; // number of processors
|
||||
// arrays of collective operation times
|
||||
int i;
|
||||
for ( i=0;i<=ITER;i++) mgen[i]=0.;
|
||||
for (i=0;i<=RED;i++) {
|
||||
mcom[i]=0.;
|
||||
mrcom[i]=0.;
|
||||
msyn[i]=0.;
|
||||
mvar[i]=0.;
|
||||
mcall[i]=0.;
|
||||
moverlap[i]=0.;
|
||||
}
|
||||
for(i=0;i<StatGrpCount;i++) {
|
||||
lost[i]=0.;
|
||||
calls[i]=0.;
|
||||
prod[i]=0.;
|
||||
}
|
||||
// execution characteristics on each processor
|
||||
for (i=0;i<StatGrpCount;i++) {
|
||||
mgen[SUMCOM]=mgen[SUMCOM]+pt[i][MsgPasGrp].LostTime;
|
||||
mgen[SUMRCOM]=mgen[SUMRCOM]+pt[i][MsgPasGrp].ProductTime;
|
||||
mgen[CPUUSR]=mgen[CPUUSR]+pt[i][UserGrp].ProductTime;
|
||||
mgen[INSUFUSR]=mgen[INSUFUSR]+pt[i][UserGrp].LostTime;
|
||||
mgen[IOTIME]=mgen[IOTIME]+pt[i][IOGrp].ProductTime;
|
||||
for (int j=0;j<StatGrpCount;j++) {
|
||||
/*if (i==UserGrp) {
|
||||
mgen[CPUUSR]=mgen[CPUUSR]+pt[UserGrp][j].ProductTime;
|
||||
mgen[INSUFUSR]=mgen[INSUFUSR]+pt[UserGrp][j].LostTime;
|
||||
}
|
||||
if (i==IOGrp) mgen[IOTIME]=mgen[IOTIME]+pt[IOGrp][j].ProductTime;*/
|
||||
mgen[EXEC]=mgen[EXEC]+pt[i][j].ProductTime+pt[i][j].LostTime;
|
||||
mgen[INSUF]=mgen[INSUF]+pt[i][j].LostTime;
|
||||
mgen[CPU]=mgen[CPU]+pt[i][j].ProductTime;
|
||||
} // end for j
|
||||
}
|
||||
mgen[EXEC]=mgen[EXEC]-mgen[SUMRCOM];
|
||||
mgen[CPU]=mgen[CPU]-mgen[CPUUSR]-mgen[SUMRCOM]-mgen[IOTIME];
|
||||
mgen[INSUF]=mgen[INSUF]-mgen[INSUFUSR]-mgen[SUMCOM];
|
||||
//real synchronization,number of calls, communication
|
||||
// reduction
|
||||
mcom[RD]=pt[WaitRedGrp][MsgPasGrp].LostTime+
|
||||
pt[StartRedGrp][MsgPasGrp].LostTime;
|
||||
mrcom[RD]=pt[WaitRedGrp][MsgPasGrp].ProductTime;
|
||||
mcall[RD]=pt[UserGrp][WaitRedGrp].CallCount;
|
||||
// shadow
|
||||
mcom[SH]=pt[WaitShdGrp][MsgPasGrp].LostTime+
|
||||
pt[DoPLGrp][MsgPasGrp].LostTime+
|
||||
pt[StartShdGrp][MsgPasGrp].LostTime;
|
||||
mrcom[SH]=pt[WaitShdGrp][MsgPasGrp].ProductTime+
|
||||
pt[DoPLGrp][MsgPasGrp].ProductTime;
|
||||
mcall[SH]=pt[UserGrp][WaitShdGrp].CallCount;
|
||||
// remote access
|
||||
mcom[RA]=pt[RemAccessGrp][MsgPasGrp].LostTime;
|
||||
mrcom[RA]=pt[RemAccessGrp][MsgPasGrp].ProductTime;
|
||||
mcall[RA]=pt[UserGrp][RemAccessGrp].CallCount;
|
||||
// redistribute
|
||||
mcom[RED]=pt[ReDistrGrp][MsgPasGrp].LostTime;
|
||||
mrcom[RED]=pt[ReDistrGrp][MsgPasGrp].ProductTime;
|
||||
mcall[RED]=pt[UserGrp][ReDistrGrp].CallCount;
|
||||
// input/output
|
||||
mcom[IO]=pt[IOGrp][MsgPasGrp].LostTime;
|
||||
mrcom[IO]=pt[IOGrp][MsgPasGrp].ProductTime;
|
||||
mcall[IO]=pt[UserGrp][IOGrp].CallCount;
|
||||
// add information
|
||||
SendCallTime=ps.SendCallTime;
|
||||
MinSendCallTime=ps.MinSendCallTime;
|
||||
MaxSendCallTime=ps.MaxSendCallTime;
|
||||
SendCallCount=ps.SendCallCount;
|
||||
RecvCallTime=ps.RecvCallTime;
|
||||
MinRecvCallTime=ps.MinRecvCallTime;
|
||||
MaxRecvCallTime=ps.MaxRecvCallTime;
|
||||
RecvCallCount=ps.RecvCallCount;
|
||||
mgen[START]=SendCallTime+RecvCallTime;
|
||||
// time array
|
||||
//int j=USERGRP;
|
||||
if (iIM!=0) {
|
||||
for (i=0;i<StatGrpCount;i++) {
|
||||
if (sore==1) {//sum
|
||||
for (int k=0;k<StatGrpCount; k++) {
|
||||
//mgen[j]=mgen[j]+pt[i][k].ProductTime;
|
||||
lost[i]=lost[i]+pt[i][k].LostTime;
|
||||
prod[i]=prod[i]+pt[i][k].ProductTime;
|
||||
calls[i]=calls[i]+pt[i][k].CallCount;
|
||||
}
|
||||
}else {
|
||||
//mgen[j]=pt[iIM-1][i].ProductTime;
|
||||
lost[i]=pt[iIM-1][i].LostTime;
|
||||
prod[i]=pt[iIM-1][i].ProductTime;
|
||||
calls[i]=pt[iIM-1][i].CallCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jIM!=0) {
|
||||
for (i=0;i<StatGrpCount;i++) {
|
||||
if (sore==1) {
|
||||
for (int k=0;k<StatGrpCount;k++) {
|
||||
//mgen[j]=mgen[j]+pt[k][i].ProductTime;
|
||||
prod[i]=prod[i]+pt[k][i].ProductTime;
|
||||
lost[i]=lost[i]+pt[k][i].LostTime;
|
||||
calls[i]=calls[i]+pt[k][i].CallCount;
|
||||
}
|
||||
} else {
|
||||
//mgen[j]=pt[i][jIM-1].ProductTime;
|
||||
prod[i]=pt[i][jIM-1].ProductTime;
|
||||
lost[i]=pt[i][jIM-1].LostTime;
|
||||
calls[i]=pt[i][jIM-1].CallCount;
|
||||
}
|
||||
//j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------
|
||||
// deallocate memory for name of DVM-program
|
||||
CInter::~CInter()
|
||||
{
|
||||
if (idint.pname!=NULL) delete []idint.pname;
|
||||
}
|
||||
//--------------------------------------------------
|
||||
// addition execution time characteristics
|
||||
void CInter::AddTime(typetime t2,double val)
|
||||
//t2 - type of execution characteristics
|
||||
// val - additional value
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>ITER) {
|
||||
printf("CInter AddTime incorrect typetime %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
mgen[t2]=mgen[t2]+val;
|
||||
}
|
||||
//--------------------------------------------------
|
||||
//write new execution time characteristics
|
||||
void CInter::WriteTime(typetime t2,double val)
|
||||
//t2 - type of execution characteristics
|
||||
// val - new value
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>ITER) {
|
||||
printf("CInter WriteTime incorrect typetime %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
mgen[t2]=val;
|
||||
}
|
||||
//-------------------------------------------------
|
||||
// read execution time characteristics
|
||||
void CInter::ReadTime(typetime t2,double &val)
|
||||
//t2 - type of execution characteristics
|
||||
// val - answer
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>ITER) {
|
||||
printf("CInter ReadTime incorrect typetime %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
val=mgen[t2];
|
||||
}
|
||||
//--------------------------------------------------
|
||||
// addition times of collective operations
|
||||
void CInter::AddTime(typegrp t1,typecom t2,double val)
|
||||
//t1 - type of communication operation
|
||||
//t2 - type of collective operation
|
||||
//val - additional value
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>RED) {
|
||||
printf("CInter AddTime incorrect typecom %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
switch (t1) {
|
||||
case COM:
|
||||
mcom[t2]=mcom[t2]+val;
|
||||
break;
|
||||
case RCOM:
|
||||
mrcom[t2]=mrcom[t2]+val;
|
||||
break;
|
||||
case SYN :
|
||||
msyn[t2]=msyn[t2]+val;
|
||||
break;
|
||||
case VAR:
|
||||
mvar[t2]=mvar[t2]+val;
|
||||
break;
|
||||
case CALL:
|
||||
mcall[t2]=mcall[t2]+val;
|
||||
break;
|
||||
case OVERLAP:
|
||||
moverlap[t2]=moverlap[t2]+val;
|
||||
break;
|
||||
default:
|
||||
printf("CInter WriteCom incorrect typegrp\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------
|
||||
// read communication collective operations time
|
||||
void CInter::ReadTime(typegrp t1,typecom t2,double &val)
|
||||
//t1 - type of communication operation
|
||||
//t2 - type of collective operation
|
||||
//val - answer
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>RED) {
|
||||
printf("CInter ReadTime incorrect typecom %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
switch (t1) {
|
||||
case COM:
|
||||
val=mcom[t2];
|
||||
break;
|
||||
case RCOM:
|
||||
val=mrcom[t2];
|
||||
break;
|
||||
case SYN :
|
||||
val=msyn[t2];
|
||||
break;
|
||||
case VAR:
|
||||
val=mvar[t2];
|
||||
break;
|
||||
case CALL:
|
||||
val=mcall[t2];
|
||||
break;
|
||||
case OVERLAP:
|
||||
val=moverlap[t2];
|
||||
break;
|
||||
default:
|
||||
printf("CInter ReadTime incorrect typegrp\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------
|
||||
// read time from interval matrix
|
||||
void CInter::ReadTime(typetimeim t1,int t2,double &val)
|
||||
//t1 - type of time (lost/number of calls)
|
||||
//t2 - index
|
||||
//val - answer
|
||||
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>=StatGrpCount) {
|
||||
printf("CInter ReadTime incorrect 2 parameter %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
switch (t1) {
|
||||
case CALLSMT:
|
||||
val=calls[t2];
|
||||
break;
|
||||
case LOSTMT:
|
||||
val=lost[t2];
|
||||
break;
|
||||
case PRODMT:
|
||||
val=prod[t2];
|
||||
break;
|
||||
default:
|
||||
printf("CInter ReadTime incorrect type of im time\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// compare identifier information on other processors
|
||||
int CInter::CompIdent(ident *p)
|
||||
//p - pointer identifire information
|
||||
{
|
||||
if ((idint.pname==NULL || (strcmp(p->pname,idint.pname)==0)) && (p->nline==idint.nline) &&
|
||||
(p->nlev==idint.nlev) && (p->expr==idint.expr) && (p->t==idint.t)) {
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
//------------------------------------------------------
|
||||
// read identifier information
|
||||
void CInter::ReadIdent(ident **p)
|
||||
{
|
||||
*p=&idint;
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// sum times characteristics upon levels
|
||||
void CInter::SumInter(CInter *p)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<=RED;i++) {
|
||||
mgen[SUMSYN]=mgen[SUMSYN]+msyn[i];
|
||||
mgen[SUMVAR]=mgen[SUMVAR]+mvar[i];
|
||||
mgen[SUMOVERLAP]=mgen[SUMOVERLAP]+moverlap[i];
|
||||
}
|
||||
mgen[PROC]=(double)idint.proc;
|
||||
if (idint.proc!=0) {
|
||||
mgen[LOST]=mgen[INSUF]+mgen[INSUFUSR]+mgen[IDLE]+mgen[SUMCOM];
|
||||
}
|
||||
if (p==NULL) return;
|
||||
for (i=0;i<=ITER;i++) {
|
||||
if (i<SUMSYN || i>SUMOVERLAP) p->mgen[i]=p->mgen[i]+mgen[i];
|
||||
}
|
||||
for (i=0;i<StatGrpCount;i++) {
|
||||
p->lost[i]=p->lost[i]+lost[i];
|
||||
p->prod[i]=p->prod[i]+prod[i];
|
||||
p->calls[i]=p->calls[i]+calls[i];
|
||||
}
|
||||
// add information
|
||||
p->SendCallTime=p->SendCallTime+SendCallTime;
|
||||
p->MinSendCallTime=p->MinSendCallTime+MinSendCallTime;
|
||||
p->MaxSendCallTime=p->MaxSendCallTime+MaxSendCallTime;
|
||||
p->SendCallCount=p->SendCallCount+SendCallCount;
|
||||
p->RecvCallTime=p->RecvCallTime+RecvCallTime;
|
||||
p->MinRecvCallTime=p->MinRecvCallTime+MinRecvCallTime;
|
||||
p->MaxRecvCallTime=p->MaxRecvCallTime+MaxRecvCallTime;
|
||||
p->RecvCallCount=p->RecvCallCount+RecvCallCount;
|
||||
// sum communication information
|
||||
for (i=0;i<=RED;i++) {
|
||||
p->mcom[i]=p->mcom[i]+mcom[i];
|
||||
p->mrcom[i]=p->mrcom[i]+mrcom[i];
|
||||
p->msyn[i]=p->msyn[i]+msyn[i];
|
||||
p->mvar[i]=p->mvar[i]+mvar[i];
|
||||
p->moverlap[i]=p->moverlap[i]+moverlap[i];
|
||||
p->mcall[i]=p->mcall[i]+mcall[i];
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
72
dvm/tools/pppa/branches/dvm4.07/src/inter.h
Normal file
72
dvm/tools/pppa/branches/dvm4.07/src/inter.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef _INTER_H
|
||||
#define _INTER_H
|
||||
#include "sysstat.h"
|
||||
#include "strall.h"
|
||||
enum typegrp {COM,RCOM,SYN,VAR,OVERLAP,CALL};
|
||||
enum typetimeim {CALLSMT,LOSTMT,PRODMT};
|
||||
enum typetime {LOST,INSUFUSR,INSUF,IDLE,SUMCOM,SUMRCOM,SUMSYN,SUMVAR,SUMOVERLAP,IMB,
|
||||
EXEC,CPUUSR,CPU,IOTIME,START,PROC,ITER};
|
||||
enum typecom {IO,RD,SH,RA,RED};//5 collective operation. new operation insert before RED
|
||||
//if insert new time don't forget insert text in the statread.h
|
||||
//don't insert new time between SUMCOM...SUMOVERLAP
|
||||
typedef struct tident {
|
||||
double nenter;
|
||||
unsigned long nline,nline_end,proc;
|
||||
long expr;
|
||||
short nlev;
|
||||
typefrag t;
|
||||
char *pname;
|
||||
}ident;
|
||||
typedef struct { double SendCallTime;
|
||||
double MinSendCallTime;
|
||||
double MaxSendCallTime;
|
||||
long SendCallCount;
|
||||
double RecvCallTime;
|
||||
double MinRecvCallTime;
|
||||
double MaxRecvCallTime;
|
||||
long RecvCallCount;
|
||||
} s_SendRecvTimes;
|
||||
|
||||
class CInter {
|
||||
public:
|
||||
CInter (s_GRPTIMES (*pt)[StatGrpCount],s_SendRecvTimes ps,ident p,
|
||||
unsigned long nint,int i,int j,short sore);
|
||||
~CInter(void);
|
||||
void AddTime(typetime t2,double val);
|
||||
void WriteTime(typetime t2,double val);
|
||||
void ReadTime(typetime t2,double &val);
|
||||
void AddTime(typegrp t1,typecom t2,double val);
|
||||
void ReadTime(typegrp t1,typecom t2,double &val);
|
||||
void ReadTime(typetimeim t1,int t2,double &val);
|
||||
int CompIdent(ident *p);
|
||||
void ReadIdent(ident **p);
|
||||
void SumInter(CInter *p);
|
||||
unsigned long ninter;
|
||||
private:
|
||||
double mgen[ITER+1];
|
||||
double mcom[RED+1];
|
||||
double mrcom[RED+1];
|
||||
double msyn[RED+1];
|
||||
double mvar[RED+1];
|
||||
double moverlap[RED+1];
|
||||
double mcall[RED+1];
|
||||
double lost[StatGrpCount];
|
||||
double prod[StatGrpCount];
|
||||
double calls[StatGrpCount];
|
||||
double SendCallTime;
|
||||
double MinSendCallTime;
|
||||
double MaxSendCallTime;
|
||||
long SendCallCount;
|
||||
double RecvCallTime;
|
||||
double MinRecvCallTime;
|
||||
double MaxRecvCallTime;
|
||||
long RecvCallCount;
|
||||
ident idint;
|
||||
};
|
||||
/*enum typetime {LOST,INSUFUSR,INSUF,IDLE,
|
||||
SUMCOM,SUMRCOM,SUMSYN,SUMVAR,SUMOVERLAP,
|
||||
IMB,EXEC,CPUUSR,CPU,IOTIME,START,PROC,USERGRP,MSGPASGRP,
|
||||
STARTREDGRP,WAITREDGRP,REDGRP,STARTSHDGRP,WAITSHDGRP,SHDGRP,DISRGRP,
|
||||
REDISTRGRP,MAPPLGRP,DOPLGRP,PROGBLOCKGRP,IOGRP,REMACCESSGRP,USERDEBGRP,
|
||||
STATISTGRP,SYSTEMGRP,ITER};*/
|
||||
#endif
|
||||
44
dvm/tools/pppa/branches/dvm4.07/src/makefile.uni
Normal file
44
dvm/tools/pppa/branches/dvm4.07/src/makefile.uni
Normal file
@@ -0,0 +1,44 @@
|
||||
######################################
|
||||
### Automated created makefile.win ###
|
||||
######################################
|
||||
|
||||
BINDIR=../../bin
|
||||
|
||||
EXECUTABLES = dvmstf
|
||||
COPT=-c -I../../predictor/Zlib/Include
|
||||
ZLIB = zlib
|
||||
ZLIBDIR = ../../predictor/Zlib/Src
|
||||
|
||||
OBJS=\
|
||||
inter.o \
|
||||
potensyn.o \
|
||||
statfile.o \
|
||||
statread.o \
|
||||
treeinter.o \
|
||||
statprintf.o
|
||||
|
||||
$(BINDIR)/$(EXECUTABLES): $(OBJS)
|
||||
$(CXX) -o $@ $(OBJS) -L$(ZLIBDIR) -l$(ZLIB)
|
||||
|
||||
all: $(BINDIR)/$(EXECUTABLES)
|
||||
@echo "*** COMPILING EXECUTABLE $(EXECUTABLES) DONE"
|
||||
|
||||
clean:
|
||||
rm -f logfile.txt
|
||||
rm -f $(OBJS)
|
||||
cleanall:
|
||||
rm -f logfile.txt
|
||||
rm -f $(OBJS)
|
||||
|
||||
potensyn.o:
|
||||
$(CXX) $(COPT) potensyn.cpp
|
||||
inter.o:
|
||||
$(CXX) $(COPT) inter.cpp
|
||||
statfile.o:
|
||||
$(CXX) $(COPT) statfile.cpp
|
||||
statread.o:
|
||||
$(CXX) $(COPT) statread.cpp
|
||||
treeinter.o:
|
||||
$(CXX) $(COPT) treeinter.cpp
|
||||
statprintf.o:
|
||||
$(CXX) $(COPT) statprintf.cpp
|
||||
46
dvm/tools/pppa/branches/dvm4.07/src/makefile.win
Normal file
46
dvm/tools/pppa/branches/dvm4.07/src/makefile.win
Normal file
@@ -0,0 +1,46 @@
|
||||
######################################
|
||||
### Automated created makefile.win ###
|
||||
######################################
|
||||
|
||||
OUTDIR=..\obj
|
||||
BINDIR=..\..\bin
|
||||
ZLIB=zlib.lib
|
||||
ZLIBDIR=..\..\predictor\Zlib\Release
|
||||
|
||||
EXECUTABLES = dvmstf
|
||||
|
||||
LINK_FLAGS=/nologo /subsystem:console /incremental:no\
|
||||
/pdb:"$(OUTDIR)\$(EXECUTABLES).pdb" /machine:I386 /out:"$(BINDIR)\$(EXECUTABLES).exe"
|
||||
|
||||
#COPT=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
|
||||
# /I "../../predictor/Zlib/Include"\
|
||||
# /Fp"$(OUTDIR)\tools.pch" /YX /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /c
|
||||
COPT=/nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
|
||||
/I "../../predictor/Zlib/Include"\
|
||||
/Fp"$(OUTDIR)\tools.pch" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /c
|
||||
|
||||
.cpp{$(OUTDIR)/}.obj:
|
||||
$(CXX) $(COPT) $<
|
||||
|
||||
OBJS=\
|
||||
$(OUTDIR)\potensyn.obj \
|
||||
$(OUTDIR)\inter.obj \
|
||||
$(OUTDIR)\statfile.obj \
|
||||
$(OUTDIR)\statread.obj \
|
||||
$(OUTDIR)\treeinter.obj \
|
||||
$(OUTDIR)\statprintf.obj
|
||||
|
||||
$(BINDIR)/$(EXECUTABLES).exe: $(OBJS)
|
||||
$(LINKER) @<<
|
||||
$(LINK_FLAGS) $(OBJS) $(ZLIBDIR)\$(ZLIB)
|
||||
<<
|
||||
|
||||
all: $(BINDIR)/$(EXECUTABLES).exe
|
||||
@echo "*** COMPILING EXECUTABLE $(EXECUTABLES) DONE"
|
||||
|
||||
clean:
|
||||
@erase logfile.txt
|
||||
|
||||
cleanall:
|
||||
@erase logfile.txt
|
||||
|
||||
175
dvm/tools/pppa/branches/dvm4.07/src/potensyn.cpp
Normal file
175
dvm/tools/pppa/branches/dvm4.07/src/potensyn.cpp
Normal file
@@ -0,0 +1,175 @@
|
||||
#define _STATFILE_
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "strall.h"
|
||||
#include "potensyn.h"
|
||||
short reverse,szsh,szd,szv,szl,torightto,torightfrom;
|
||||
// Dynamically allocate array of synchronization times
|
||||
CSynchro::CSynchro(gzFile stream,unsigned long lsyn,unsigned char *pbuff)
|
||||
// stream - pointer to the file written during DVM-program execution
|
||||
// lsyn - length of written information
|
||||
{
|
||||
valid=TRUE;
|
||||
ps=NULL;
|
||||
pbuff_read=NULL;
|
||||
// dynamically allocate array of char from file (strall.h tsyn_ch)
|
||||
unsigned char *buffer;
|
||||
if (pbuff==NULL) {
|
||||
buffer=new unsigned char[lsyn];
|
||||
if (buffer==NULL) throw("Out of memory\n");
|
||||
pbuff_read=buffer;
|
||||
long l=gztell(stream);
|
||||
// read from file to the allocated buffer
|
||||
int s=gzread(stream,buffer,lsyn);
|
||||
if ((unsigned long)s!=lsyn) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read synchronization times from file addr=%ld,length=%ld\n",
|
||||
l,lsyn);
|
||||
if (pbuff_read!=NULL) {
|
||||
delete []pbuff_read;
|
||||
pbuff_read=NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}else buffer=pbuff;
|
||||
// calculate size of struct tsyn_ch
|
||||
unsigned long lsynone=QSYN_SHORT*szsh+QSYN_LONG*szl+QSYN_VOID*szv+
|
||||
QSYN_DOUBLE*szd;
|
||||
//set pointer to the first synchronization time
|
||||
unsigned char *p=buffer+lsyn-lsynone;
|
||||
// number of synchronization times
|
||||
qsyn=lsyn/lsynone;
|
||||
// allocate array of struct tsyn
|
||||
ps=new psyn[qsyn];
|
||||
if (ps==NULL) throw("Out of memory\n");
|
||||
psyn *psl=ps;
|
||||
unsigned long i;
|
||||
// copy values from struct of char to struct tsyn
|
||||
for (i=0;i<qsyn;i++) {
|
||||
psl->sh.nitem=0; psl->l.ninter=0; psl->v.ppgrp=NULL; psl->d.time=0.0;
|
||||
CPYMEM(psl->sh.nitem,p+MAKESHORT(ps,nitem,nitem),szsh);
|
||||
CPYMEM(psl->l.ninter,p+MAKELONG(ps,ninter,ninter,QSYN_SHORT),szl);
|
||||
// ppgrp -reference to group, used only for compare values
|
||||
CPYMEM(psl->v.ppgrp,p+MAKEVOID(ps,ppgrp,ppgrp,QSYN_SHORT,QSYN_LONG),szv);
|
||||
CPYMEM(psl->d.time,p+MAKEDOUBLE(ps,time,time,QSYN_SHORT,QSYN_LONG,QSYN_VOID),szd);
|
||||
p=p-lsynone;
|
||||
psl++;
|
||||
}
|
||||
if (pbuff_read!=NULL) {
|
||||
delete []pbuff_read;
|
||||
pbuff_read=NULL;
|
||||
}
|
||||
}
|
||||
//------------------------------------------
|
||||
// deallocate struct tsyn and memory of group references
|
||||
CSynchro::~CSynchro()
|
||||
{
|
||||
if (ps==0) return;
|
||||
if (pbuff_read!=NULL) delete []pbuff_read;
|
||||
delete []ps;
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
//return result of constructor execution
|
||||
int CSynchro::Valid()
|
||||
{
|
||||
return(valid);
|
||||
}
|
||||
//-------------------------------------------
|
||||
//error message
|
||||
void CSynchro::TextErr(char *p)
|
||||
{
|
||||
strcpy(p,texterr);
|
||||
}
|
||||
//-----------------------------------------------
|
||||
// calculate number of times different types
|
||||
BOOL CSynchro::Count(unsigned long n,short waserr )
|
||||
// n - number of interval
|
||||
// waserr - sign of error during accumulating times
|
||||
{
|
||||
if (n==0) return(0);
|
||||
//qoper - array of number of times
|
||||
for (int j=0;j<QCOLLECT+QCOLLECT;j++) {
|
||||
qoper[j]=0;
|
||||
}
|
||||
ncurr=0;
|
||||
// set current ninter
|
||||
ninter=n;
|
||||
psyn *pp=ps;
|
||||
// calculate number of times, nitem - type of time
|
||||
for (unsigned long i=0;i<qsyn;i++) {
|
||||
if (pp->l.ninter==n) {
|
||||
qoper[pp->sh.nitem-1]++;
|
||||
}
|
||||
pp++;
|
||||
}
|
||||
// veryfy number of calls and number of returns
|
||||
if (waserr!=0) return(0);
|
||||
for (int ak=0;ak<QCOLLECT;ak=ak+4) {
|
||||
// number of start calls and number of wait calls
|
||||
if (qoper[ak]!=qoper[ak+QCOLLECT] || qoper[ak+2]!=qoper[ak+2+QCOLLECT]) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Number of calls !=number of returns interval=%ld\n",n);
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
//-------------------------------------------
|
||||
// return number of synchronization time, function call after Count()
|
||||
int CSynchro::GetCount(typecollect nitem1)
|
||||
// nitem1 - type of synchronyzation time
|
||||
{
|
||||
short nitem=(short)nitem1;
|
||||
ncurr=0;
|
||||
first=1; // the first Find
|
||||
return (qoper[nitem-1]);
|
||||
}
|
||||
//--------------------------------------------
|
||||
//return next synchronyzation time,call after Count()
|
||||
double CSynchro::Find(typecollect nitem1)
|
||||
// nitem1 - type of synchronyzation time
|
||||
{
|
||||
short nitem=(short)nitem1;
|
||||
if (first!=1) ncurr++;
|
||||
first++;
|
||||
psyn *psl=ps+ncurr;
|
||||
// ninter set Count()
|
||||
for (unsigned long i=ncurr;i<qsyn;i++) {
|
||||
if (psl->sh.nitem==nitem && psl->l.ninter==ninter) {
|
||||
ncurr=i; // set current synchronization time
|
||||
return(psl->d.time);
|
||||
}
|
||||
psl++;
|
||||
}
|
||||
ncurr=0;
|
||||
return(0.0);
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// return current synchronyzation time, call after Find()
|
||||
double CSynchro::GetCurr(void)
|
||||
{
|
||||
// ncurr set find
|
||||
if (ncurr>=qsyn) return(0.0);
|
||||
psyn *psl=ps+ncurr;
|
||||
return(psl->d.time);
|
||||
}
|
||||
//--------------------------------------------------------
|
||||
//return nearest time from current
|
||||
double CSynchro::FindNearest(typecollect nitem1)
|
||||
// nitem1 - type of synchronyzation time
|
||||
// for overlap, for call_wait_operation find ret_start_operation
|
||||
{
|
||||
if (ncurr>=qsyn ) return(0.0);
|
||||
short nitem=(short)nitem1;
|
||||
psyn *psl=ps+ncurr;
|
||||
psyn *psl_curr=psl;
|
||||
for (unsigned long i=ncurr;;i--) {
|
||||
if (psl->sh.nitem==nitem) {
|
||||
if (psl->v.ppgrp==psl_curr->v.ppgrp) {
|
||||
return(psl->d.time);
|
||||
}
|
||||
}
|
||||
psl--;
|
||||
if (i==0) return(0.0);
|
||||
}
|
||||
}
|
||||
52
dvm/tools/pppa/branches/dvm4.07/src/potensyn.h
Normal file
52
dvm/tools/pppa/branches/dvm4.07/src/potensyn.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#if !defined( _POTENSYN_H )
|
||||
#define _POTENSYN_H
|
||||
#include "zlib.h"
|
||||
#include "bool.h"
|
||||
#include "inter.h"
|
||||
#include "treeinter.h"
|
||||
struct syn_short{
|
||||
short nitem;
|
||||
};
|
||||
struct syn_long{
|
||||
unsigned long ninter;
|
||||
};
|
||||
struct syn_void{
|
||||
void* ppgrp;
|
||||
};
|
||||
struct syn_double{
|
||||
double time;
|
||||
};
|
||||
#define QSYN_SHORT sizeof(syn_short)/SZSH
|
||||
#define QSYN_LONG sizeof(syn_long)/SZL
|
||||
#define QSYN_VOID sizeof(syn_void)/SZV
|
||||
#define QSYN_DOUBLE sizeof(syn_double)/SZD
|
||||
typedef struct tsyn {
|
||||
syn_double d;
|
||||
syn_void v;
|
||||
syn_long l;
|
||||
syn_short sh;
|
||||
}psyn;
|
||||
class CSynchro {
|
||||
public:
|
||||
CSynchro(gzFile stream,unsigned long l,unsigned char *pbuff);
|
||||
~CSynchro();
|
||||
BOOL Valid();
|
||||
void TextErr(char *t);
|
||||
BOOL Count(unsigned long nin,short waserr);
|
||||
int GetCount(typecollect nitem);
|
||||
double Find(typecollect nitem);
|
||||
double GetCurr(void);
|
||||
double FindNearest(typecollect nitem);
|
||||
private:
|
||||
BOOL valid;
|
||||
char texterr[80];
|
||||
psyn *ps;
|
||||
unsigned long qsyn;
|
||||
unsigned long ninter;
|
||||
unsigned char *pbuff_read;
|
||||
int qoper[QCOLLECT+QCOLLECT];
|
||||
unsigned long ncurr;
|
||||
short first;
|
||||
int err;
|
||||
};
|
||||
#endif
|
||||
523
dvm/tools/pppa/branches/dvm4.07/src/statfile.cpp
Normal file
523
dvm/tools/pppa/branches/dvm4.07/src/statfile.cpp
Normal file
@@ -0,0 +1,523 @@
|
||||
#include "bool.h"
|
||||
#define _STATFILE_
|
||||
#include "statread.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
#include <exception>
|
||||
#include <new>
|
||||
#include "dvmvers.h"
|
||||
#include "statprintf.h"
|
||||
using namespace std;
|
||||
|
||||
int main (int argv,char **argc)
|
||||
{
|
||||
//sfn outfn -l d>=0 -c d=-1..9 -n d-d>=0 -m text
|
||||
if (argv<3) {
|
||||
printf("Performance analyser parameters: <file _name1> <file_name2> [-l <level>]\n");
|
||||
printf(" [-n <list>] [-c <compression_level>] [-m <matrix>]\n");
|
||||
printf("<file_name1> - statistics file name \n");
|
||||
printf("<file_name2> - output file name \n");
|
||||
printf("<level> - interval level number \n");
|
||||
printf("<list> - list of processor numbers, 0 - without processor characteristics \n");
|
||||
printf("<compression_level> - -1..9 - compression level of output file,-1-no compression \n");
|
||||
printf("<matrix> - <i[:<groupname>]|j[:<groupname>]\n");
|
||||
printf("i|j - sum of row or column elements of matrix of interval characteristics \n");
|
||||
printf("<groupname> - name of group, set to output row or column per elements. Groups names :\n");
|
||||
printf(" UserGrp|MsgPasGrp|StartRedGrp|WaitRedGrp|RedGrp|StartShdGrp|\n");
|
||||
printf(" WaitShdGrp|ShdGrp|DistrGrp|ReDistrGrp|MapPLGrp|DoPLGrp|\n");
|
||||
printf(" ProgBlockGrp|IOGrp|RemAccessGrp|UserDebGrp|StatistGrp|SystemGrp\n");
|
||||
return 0;
|
||||
}
|
||||
if (argv>10) {
|
||||
printf("Incorrect number of parameters\n");
|
||||
exit(1);
|
||||
}
|
||||
BOOL proc=TRUE,comp=TRUE,gen=TRUE;
|
||||
char compr[3],mode[5];
|
||||
strcpy(mode,"wb0");
|
||||
int nlevel=9999,qnumb=1;
|
||||
unsigned long *pnumb=NULL;
|
||||
int iIM=0,jIM=0,nparin=0,nparout=0;
|
||||
short sore=0;
|
||||
size_t st=0;
|
||||
//new_handler set_new_handler(NULL);
|
||||
nparin=1;// statistics file
|
||||
nparout=2;// output file
|
||||
for (int npar=3; npar<argv;npar++) { // key parameters
|
||||
int i,cc;
|
||||
char let;
|
||||
char arrs[24] = " "; // strlen nameGen[i]
|
||||
if (argc[npar][2]!=0) {
|
||||
printf("Incorrect parameter %s\n",argc[npar]);
|
||||
exit(1);
|
||||
}
|
||||
if (argv==npar+1) {
|
||||
printf("Parameter for %s not set\n",argc[npar]);
|
||||
exit(1);
|
||||
}
|
||||
switch(argc[npar][1]) {
|
||||
case 'l':
|
||||
//interval level
|
||||
npar++;
|
||||
nlevel=atoi(argc[npar]);
|
||||
if (nlevel<0 || (nlevel==0 && strcmp(argc[npar],"0")!=0)) {
|
||||
printf("Incorrect number of level %s \n",argc[npar]);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
// compression level
|
||||
npar++;
|
||||
mode[0]=0;compr[0]=0;
|
||||
cc=atoi(argc[npar]);
|
||||
if (cc<-1 || cc>9) {
|
||||
printf("Incorrect compression level of file %s \n",argc[3]);
|
||||
exit(1);
|
||||
}
|
||||
if (cc==-1) {
|
||||
strcpy(compr,"0");
|
||||
} else {
|
||||
int comprd;
|
||||
if (cc==0) strcpy(compr,"-1");
|
||||
else {
|
||||
comprd=cc;
|
||||
sprintf(compr,"%d",comprd);
|
||||
}
|
||||
}
|
||||
strcpy(mode,"wb");
|
||||
strcat(mode,compr);
|
||||
break;
|
||||
case 'n':
|
||||
// list of processor numbers
|
||||
npar ++;
|
||||
qnumb=1;
|
||||
i=0;
|
||||
while (argc[npar][i]!=0) {
|
||||
if (argc[npar][i]==',') qnumb++;
|
||||
i++;
|
||||
}
|
||||
pnumb=new unsigned long(qnumb*2);
|
||||
if (pnumb==NULL) throw("Out of memory\n");
|
||||
char * token;
|
||||
token=strtok(argc[npar],",/n");
|
||||
i=0;
|
||||
while (token!=NULL) {
|
||||
char *tdiap=strchr(token,'-');
|
||||
if (tdiap==NULL) {
|
||||
pnumb[i]=atoi(token);
|
||||
pnumb[i+1]=pnumb[i];
|
||||
}else {
|
||||
pnumb[i+1]=atoi(tdiap+1);
|
||||
tdiap[0]='\0';
|
||||
pnumb[i]=atoi(token);
|
||||
}
|
||||
token=strtok(NULL,",\n");
|
||||
i=i+2;
|
||||
} // end while
|
||||
// -n 0 - not print processor characteristics
|
||||
if (qnumb==1 && pnumb[0]==0 && pnumb[1]==0) proc=FALSE;
|
||||
break;
|
||||
case 'm':
|
||||
// interval matrix
|
||||
npar++;
|
||||
let=argc[npar][0];
|
||||
if (let!='i' && let!='j') {
|
||||
printf("Incorrect %d parameter %c, must be i/j\n",npar,let);
|
||||
exit(1);
|
||||
}
|
||||
sore=1;
|
||||
if (let=='i') iIM=1;else jIM=1;
|
||||
st=strlen(argc[npar]);
|
||||
if (st==1) break;
|
||||
sore=0; // element
|
||||
if (argc[npar][1]!=':') {
|
||||
printf("Incorrect %d parameter %s, must be i=<groupname>/j=<groupname>\n",npar,argc[npar]);
|
||||
exit(1);
|
||||
}
|
||||
strncpy(arrs,&(argc[npar][2]),st-2);
|
||||
iIM=0;jIM=0;
|
||||
for (i=1;i<=StatGrpCount;i++) {
|
||||
if (strcmp(nameGenMT[i-1],arrs)==0) {
|
||||
if (let=='i') iIM=i;
|
||||
else jIM=i;
|
||||
break;
|
||||
}
|
||||
} // end for
|
||||
if (iIM==0 && jIM==0) {
|
||||
printf("Incorrect group name %s \n",argc[npar]);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("Incorrect parameter %s\n",argc[npar]);
|
||||
exit(1);
|
||||
break;
|
||||
} // end switch
|
||||
} // end for key parameters
|
||||
// read time characteristics and syn times
|
||||
try {
|
||||
CStatRead stat(argc[nparin],iIM,jIM,sore);
|
||||
int warn;
|
||||
if (stat.Valid(&warn)!=TRUE) {
|
||||
char t[80];
|
||||
stat.TextErr(t);
|
||||
printf("%s",t);
|
||||
exit(1);
|
||||
}
|
||||
unsigned long qproc=stat.QProc();
|
||||
if (qproc==0) exit(1);
|
||||
// string for processor characteristics - max
|
||||
// printf for compressed and not compressed out file
|
||||
CStatPrintf statpr(argc[nparout],1024,mode);
|
||||
if (statpr.Valid()!=TRUE) {
|
||||
char t[80];
|
||||
statpr.TextErr(t);
|
||||
printf("%s",t);
|
||||
exit (1);
|
||||
}
|
||||
double min[ITER+1];
|
||||
double max[ITER+1];
|
||||
double sum[ITER+1];
|
||||
// communication
|
||||
double minc[RED+1];
|
||||
double maxc[RED+1];
|
||||
double sumc[RED+1];
|
||||
// real communication
|
||||
double minrc[RED+1];
|
||||
double maxrc[RED+1];
|
||||
double sumrc[RED+1];
|
||||
// synchronization
|
||||
double mins[RED+1];
|
||||
double maxs[RED+1];
|
||||
double sums[RED+1];
|
||||
// variation
|
||||
double minv[RED+1];
|
||||
double maxv[RED+1];
|
||||
double sumv[RED+1];
|
||||
// overlap
|
||||
double minov[RED+1];
|
||||
double maxov[RED+1];
|
||||
double sumov[RED+1];
|
||||
// number of processor
|
||||
unsigned long nprocmin[ITER+1],nprocmax[ITER+1];
|
||||
unsigned long nprocminc[RED+1],nprocmaxc[RED+1];
|
||||
unsigned long nprocminrc[RED+1],nprocmaxrc[RED+1];
|
||||
unsigned long nprocmins[RED+1],nprocmaxs[RED+1];
|
||||
unsigned long nprocminv[RED+1],nprocmaxv[RED+1];
|
||||
unsigned long nprocminov[RED+1],nprocmaxov[RED+1];
|
||||
char *namecomp[3]={"Tmin","Tmax","Tmid"};
|
||||
int ltxt=strlen(nameCom[0])+1;
|
||||
char p_heading[80];
|
||||
int lenstr=0;
|
||||
char *poutstr;
|
||||
int i;
|
||||
stat.VMSSize(p_heading);
|
||||
statpr.StatPrintf("Processor system=%s\n",p_heading);
|
||||
char * pvers=stat.ReadVers();
|
||||
char *pplat=stat.ReadPlatform();
|
||||
statpr.StatPrintf("Statistics has been accumulated on DVM-system version %s, platform %s\n",pvers,pplat);
|
||||
statpr.StatPrintf("Analyzer is executing on DVM-system version %s, platform %s\n",VERS,PLATFORM);
|
||||
for (i=0;i<warn;i++) { // warning message
|
||||
stat.WasErrAccum(p_heading);
|
||||
statpr.StatPrintf("!! %s",p_heading);
|
||||
}
|
||||
short dig_time=0;
|
||||
unsigned long n=stat.BeginTreeWalk();
|
||||
while (n!=0) {
|
||||
short nlev=stat.ReadTitle(p_heading);
|
||||
if (nlev<=nlevel) {
|
||||
statpr.StatPrintf("%s","-------------------------------------------------------------------------\n");
|
||||
statpr.StatPrintf("%s",p_heading);
|
||||
// calculate min,max,sum values for all times
|
||||
stat.MinMaxSum(PRGEN,min,nprocmin,max,nprocmax,sum);
|
||||
stat.MinMaxSum(PRCOM,minc,nprocminc,maxc,nprocmaxc,sumc);
|
||||
stat.MinMaxSum(PRRCOM,minrc,nprocminrc,maxrc,nprocmaxrc,sumrc);
|
||||
stat.MinMaxSum(PRSYN,mins,nprocmins,maxs,nprocmaxs,sums);
|
||||
stat.MinMaxSum(PRVAR,minv,nprocminv,maxv,nprocmaxv,sumv);
|
||||
stat.MinMaxSum(PROVER,minov,nprocminov,maxov,nprocmaxov,sumov);
|
||||
if (dig_time==0) { // format for print
|
||||
double max_val=0.0;
|
||||
for (i=0;i<=RED;i++) {
|
||||
if (max_val<sumc[i]) max_val=sumc[i];
|
||||
if (max_val<sumrc[i]) max_val=sumrc[i];
|
||||
if (max_val<sums[i]) max_val=sums[i];
|
||||
if (max_val<sumv[i]) max_val=sumv[i];
|
||||
if (max_val<sumov[i]) max_val=sumov[i];
|
||||
} // end for
|
||||
char tval[80];
|
||||
sprintf(tval,"%*.*lf",DIGTIME,PREC,max_val);
|
||||
dig_time=(short)strlen(tval);
|
||||
lenstr=(dig_time+1)*qproc+strlen(nameGen[0])+1;
|
||||
if (lenstr<=1024) lenstr=1024;else statpr.ChangeLenStr(lenstr);
|
||||
poutstr=new char[lenstr];
|
||||
if (poutstr==NULL) throw("Out of memory\n");
|
||||
}
|
||||
if (gen==TRUE) {
|
||||
statpr.StatPrintf("--- The main characteristics --- \n");
|
||||
double time1,prodcpu,timef,prod;
|
||||
timef=sum[IOTIME];
|
||||
prodcpu=sum[CPU];
|
||||
prod=sum[CPU]+sum[CPUUSR]+timef;
|
||||
if ((n)*max[EXEC]==0) time1=0.0;
|
||||
else time1=prod/(n*max[EXEC]);
|
||||
statpr.StatPrintf("%s %*.*lf \n","Parallelization efficiency ",dig_time,PREC,time1);
|
||||
statpr.StatPrintf("%s %*.*lf \n", "Execution time ",dig_time,PREC,max[EXEC]);
|
||||
statpr.StatPrintf("%s %d\n", "Processors ",n);
|
||||
statpr.StatPrintf("%s %*.*lf\n", "Total time ",dig_time,PREC,(n)*max[EXEC]);
|
||||
if (prod!=0.0) {
|
||||
statpr.StatPrintf("%s %*.*lf %s %.*lf %s %.*lf %s %.*lf %c\n","Productive time ",
|
||||
dig_time,PREC,prod,"( CPU=",PREC,sum[CPUUSR]," Sys=",
|
||||
PREC,prodcpu,"I/O=",PREC,timef,')');
|
||||
}
|
||||
if(sum[LOST]>0.0)statpr.StatPrintf("%s %*.*lf \n","Lost time ",dig_time,PREC,sum[LOST]);
|
||||
if (sum[INSUFUSR]+sum[INSUF]!=0.0)
|
||||
statpr.StatPrintf("%s %*.*lf %s %.*lf %s %.*lf %c\n"," Insufficient parallelism",dig_time,PREC,sum[INSUFUSR]+sum[INSUF],
|
||||
"( User=",PREC,sum[INSUFUSR],"Sys=",PREC,sum[INSUF],')');
|
||||
if (sum[SUMCOM]!=0.0)
|
||||
statpr.StatPrintf("%s %*.*lf %s %.*lf %s %.*lf %c\n"," Communication ",dig_time,PREC,sum[SUMCOM],
|
||||
"( Real_sync=",PREC,sum[SUMRCOM],"Starts=",PREC,sum[START],')');
|
||||
if (sum[IDLE]!=0.0) statpr.StatPrintf("%s %*.*lf\n"," Idle time ",dig_time,PREC,sum[IDLE]);
|
||||
if (sum[IMB]!=0.0)statpr.StatPrintf("%s %*.*lf\n","Load imbalance ",
|
||||
dig_time,PREC,sum[IMB]);
|
||||
if (sum[SUMSYN]!=0.0) statpr.StatPrintf("%s %*.*lf\n","Synchronization ",dig_time,PREC,sum[SUMSYN]);
|
||||
if (sum[SUMVAR]!=0.0) statpr.StatPrintf("%s %*.*lf\n","Time variation ",dig_time,PREC,sum[SUMVAR]);
|
||||
if (sum[SUMOVERLAP]>0.0)statpr.StatPrintf("%s %*.*lf\n","Overlap ",dig_time,PREC,
|
||||
sum[SUMOVERLAP]);
|
||||
long ncall=0;
|
||||
int dig_stat=DIGSTAT;
|
||||
for (i=0;i<=RED;i++) ncall=ncall+stat.ReadCall(typecom(i));
|
||||
if (ncall>0) {
|
||||
statpr.StatPrintf("%*c",ltxt,' ');
|
||||
char tval[20];
|
||||
sprintf(tval,"%ld",ncall);
|
||||
int l=strlen(tval);
|
||||
if (l>DIGSTAT)dig_stat=l;
|
||||
statpr.StatPrintf("%*s",dig_stat," Nop ");
|
||||
for (int j=SUMCOM;j<=SUMOVERLAP;j++) {
|
||||
if (sum[j]>0.0)
|
||||
statpr.StatPrintf("%*s ",dig_time,nameOper[j-SUMCOM]);
|
||||
} // end for
|
||||
statpr.StatPrintf("\n");
|
||||
}// end if
|
||||
for (i=0;i<=RED;i++) {
|
||||
ncall=stat.ReadCall(typecom(i));
|
||||
if (ncall>0) {
|
||||
statpr.StatPrintf("%s",nameCom[i]);
|
||||
statpr.StatPrintf("%*d ",dig_stat,ncall);
|
||||
if (sum[SUMCOM]>0.0)statpr.StatPrintf("%*.*lf ",dig_time,PREC,sumc[i]);
|
||||
if (sum[SUMRCOM]>0.0)statpr.StatPrintf("%*.*lf ",dig_time,PREC,sumrc[i]);
|
||||
if (sum[SUMSYN]>0.0)statpr.StatPrintf("%*.*lf ",dig_time,PREC,sums[i]);
|
||||
if (sum[SUMVAR]>0.0)statpr.StatPrintf("%*.*lf ",dig_time,PREC,sumv[i]);
|
||||
if (sum[SUMOVERLAP]>0.0)statpr.StatPrintf("%*.*lf ",dig_time,PREC,sumov[i]);
|
||||
statpr.StatPrintf("\n");
|
||||
} // end if ncall>0
|
||||
} // end for
|
||||
if (iIM>0 || jIM>0) { // statistics matrix
|
||||
for (unsigned long np=1;np<=qproc;np++) {
|
||||
double prod[StatGrpCount],lost[StatGrpCount],sumprod=0.0,sumlost=0.0;
|
||||
double calls[StatGrpCount],sumcalls=0.0;
|
||||
stat.GrpTimes(prod,lost,calls,np);
|
||||
sprintf(p_heading,"%ld",np);
|
||||
int ll=strlen(nameGen[0])-strlen(p_heading)-strlen(" Nproc=")-2;
|
||||
statpr.StatPrintf("%s %d %*c %*s %*s %*s\n"," Nproc=",np,ll,' ',
|
||||
dig_time,"CALL COUNT",dig_time,"PRODUCT TIME",dig_time,
|
||||
"LOST TIME");
|
||||
for (i=0;i<StatGrpCount;i++) {
|
||||
sumprod=sumprod+prod[i];
|
||||
sumlost=sumlost+lost[i];
|
||||
sumcalls=sumcalls+calls[i];
|
||||
//if (calls[i]>0 || prod[i]!=0.0 || lost[i]!=0.0 ) {
|
||||
statpr.StatPrintf("%s %*.*lf %*.*lf %*.*lf \n",nameGenMT[i],
|
||||
dig_time,PREC,calls[i],
|
||||
dig_time,PREC,prod[i],
|
||||
dig_time,PREC,lost[i]);
|
||||
//}
|
||||
} // end for
|
||||
statpr.StatPrintf("%s %*.*lf %*.*lf %*.*lf \n"," Total: ",
|
||||
dig_time,PREC,sumcalls,dig_time,PREC,sumprod,dig_time,PREC,sumlost);
|
||||
} // end for qproc
|
||||
} // end statistics matrix
|
||||
} // end main characteristics
|
||||
if (comp==TRUE) {
|
||||
// comparative characteristics
|
||||
statpr.StatPrintf("--- The comparative characteristics --- \n");
|
||||
poutstr[0]=0;
|
||||
statpr.StatPrintf ("%*c",strlen(nameGen[0])+1,' ');
|
||||
int i;
|
||||
for (i=0;i<3;i++) {
|
||||
if (i==2)statpr.StatPrintf("%*s\n",dig_time,namecomp[i]);
|
||||
else statpr.StatPrintf("%*s %*s",dig_time,namecomp[i],
|
||||
DIGSTAT,"N proc");
|
||||
}
|
||||
// general characteristics
|
||||
for (i=0;i<=ITER;i++) {
|
||||
if (sum[i]>0.0) {
|
||||
int prec;
|
||||
double tt=sum[i]/n;
|
||||
if ((typetime)(i)==PROC || (typetime)(i)==ITER)
|
||||
prec=0;else prec=PREC;
|
||||
statpr.StatPrintf("%s %*.*lf %*d %*.*lf %*d %*.*lf \n",
|
||||
nameGen[i],dig_time,prec,
|
||||
min[i],DIGSTAT,nprocmin[i],dig_time,prec,max[i],DIGSTAT,
|
||||
nprocmax[i],dig_time,prec,tt);
|
||||
}
|
||||
}
|
||||
long ncall=0;
|
||||
// characteristics of collective operations
|
||||
for (i=0;i<=RED;i++) ncall=ncall+stat.ReadCall(typecom(i));
|
||||
if (ncall>0) {
|
||||
statpr.StatPrintf("%*c",ltxt-2,' ');
|
||||
for (int j=SUMCOM;j<=SUMOVERLAP;j++) {
|
||||
if (sum[j]>0.0)
|
||||
statpr.StatPrintf("%*s ",dig_time+DIGSTAT,nameOper[j-SUMCOM]);
|
||||
}
|
||||
statpr.StatPrintf("\n");
|
||||
for (i=0;i<=RED;i++) {
|
||||
for (int k=0;k<3;k++) {
|
||||
if (sumc[i]==0.0 && sumrc[i]==0.0 && sums[i]==0.0 &&
|
||||
sumv[i]==0.0 &&sumov[i]==0.0) break;
|
||||
double t[CALL];//com,realcom,syn,var,overlap
|
||||
unsigned long pnp[CALL];
|
||||
// 0 - min; 1 - max; 2 - sum
|
||||
switch (k) {
|
||||
case 0:
|
||||
t[0]=minc[i];t[1]=minrc[i];
|
||||
t[2]=mins[i];t[3]=minv[i];
|
||||
t[4]=minov[i];
|
||||
pnp[0]=nprocminc[i];
|
||||
pnp[1]=nprocminrc[i];
|
||||
pnp[2]=nprocmins[i];
|
||||
pnp[3]=nprocminv[i];
|
||||
pnp[4]=nprocminov[i];
|
||||
break;
|
||||
case 1:
|
||||
t[0]=maxc[i];t[1]=maxrc[i];
|
||||
t[2]=maxs[i];t[3]=maxv[i];
|
||||
t[4]=maxov[i];
|
||||
pnp[0]=nprocmaxc[i];
|
||||
pnp[1]=nprocmaxrc[i];
|
||||
pnp[2]=nprocmaxs[i];
|
||||
pnp[3]=nprocmaxv[i];
|
||||
pnp[4]=nprocmaxov[i];
|
||||
break;
|
||||
case 2:
|
||||
t[0]=sumc[i]/n;t[1]=sumrc[i]/n;
|
||||
t[2]=sums[i]/n;t[3]=sumv[i]/n;
|
||||
t[4]=sumov[i]/n;
|
||||
pnp[0]=0;
|
||||
pnp[1]=0;
|
||||
pnp[2]=0;
|
||||
pnp[3]=0;
|
||||
pnp[4]=0;
|
||||
break;
|
||||
default:
|
||||
statpr.StatPrintf("Unknown type=%d\n",k);
|
||||
exit(1);
|
||||
}// end switch
|
||||
statpr.StatPrintf("%s%s",nameCom[i],namecomp[k]);
|
||||
for (int j=SUMCOM;j<=SUMOVERLAP;j++) {
|
||||
if (sum[j]>0.0) {
|
||||
if (pnp[0]==0) {
|
||||
statpr.StatPrintf("%*.*lf ",
|
||||
dig_time,PREC,t[j-SUMCOM]);
|
||||
statpr.StatPrintf("%*c",DIGSTAT+1,' ');
|
||||
}
|
||||
else
|
||||
statpr.StatPrintf("%*.*lf %*d ",
|
||||
dig_time,PREC,t[j-SUMCOM],
|
||||
DIGSTAT,pnp[j-SUMCOM]);
|
||||
}
|
||||
}
|
||||
statpr.StatPrintf("\n");
|
||||
} //end for
|
||||
}//end for
|
||||
}
|
||||
}
|
||||
if (proc==TRUE) {
|
||||
// execution characteristics
|
||||
statpr.StatPrintf("--- The execution characteristics --- \n");
|
||||
statpr.StatPrintf("%s"," ");
|
||||
unsigned long i;
|
||||
// print numbers of processor
|
||||
for (i=0;i<n;i++) {//!!! qproc
|
||||
int pr=FALSE;
|
||||
if (pnumb==NULL) pr=TRUE;
|
||||
else {
|
||||
for (int j=0; j<qnumb;j++) {
|
||||
if(i+1>=pnumb[j] && i+1<=pnumb[j+1]) pr=TRUE;
|
||||
}
|
||||
}
|
||||
if (pr==TRUE) {
|
||||
statpr.StatPrintf("%*d ",dig_time,i+1); // probel
|
||||
}
|
||||
}
|
||||
statpr.StatPrintf("\n");
|
||||
// general characteristics
|
||||
for (i=0;i<=ITER;i++) {
|
||||
stat.ReadProc(PRGEN,pnumb,qnumb,dig_time,sum[i],poutstr);
|
||||
if (poutstr[0]!='\0')statpr.StatPrintf("%s\n",poutstr);
|
||||
//statpr.StatPrintf("\n");
|
||||
}
|
||||
//statpr.StatPrintf("\n");
|
||||
// characteristics of collective operatios
|
||||
long ncall=0;
|
||||
for (int k=0;k<=RED;k++) ncall=ncall+stat.ReadCall(typecom(k));
|
||||
for (int j=SUMCOM;j<=SUMOVERLAP;j++) {
|
||||
double *ps;
|
||||
switch (j) {
|
||||
case SUMCOM: ps=sumc;break;
|
||||
case SUMRCOM: ps=sumrc;break;
|
||||
case SUMSYN: ps=sums;break;
|
||||
case SUMVAR: ps=sumv;break;
|
||||
case SUMOVERLAP: ps=sumov;break;
|
||||
default:statpr.StatPrintf("Unknown type=%d\n",j);
|
||||
exit(1);
|
||||
}// end for j
|
||||
int i=0;
|
||||
//if (j==SUMOVERLAP) ncall=0; //for pc sum[j]=0.0
|
||||
if (sum[j]>0.0 && ncall>0) {
|
||||
statpr.StatPrintf(" %s\n",nameGen[j]);
|
||||
for (i=0;i<=RED;i++) {
|
||||
stat.ReadProc((typeprint)(j-SUMCOM+1),pnumb,qnumb,dig_time,ps[i],poutstr);
|
||||
if (poutstr[0]!='\0')statpr.StatPrintf("%s\n",poutstr);
|
||||
}
|
||||
}
|
||||
} // end for k
|
||||
}//exec characteristics
|
||||
} // if nlev<=nlevel
|
||||
n=stat.TreeWalk();
|
||||
}
|
||||
//names and times of processors
|
||||
char *pname=NULL,*pnamemin=NULL,*pnamemax=NULL;
|
||||
double time,mintime=DBL_MAX,maxtime=0.0,sumtime=0.0;
|
||||
stat.NameTimeProc(0,&pname,&time);
|
||||
if (pname==NULL) exit(1); // not MPI
|
||||
unsigned long minn=0,maxn=0;
|
||||
statpr.StatPrintf("%s","-------------------------------------------------------------------------\n");
|
||||
statpr.StatPrintf("Name (number) and performance time of processors\n");
|
||||
for (unsigned long i1=0;i1<qproc;i1++) {
|
||||
stat.NameTimeProc(i1,&pname,&time);
|
||||
sumtime=sumtime+time;
|
||||
if (time<mintime) {mintime=time;minn=i1+1;pnamemin=pname;}
|
||||
if (time>maxtime) {maxtime=time; maxn=i1+1;pnamemax=pname;}
|
||||
statpr.StatPrintf("%s(%d) %lf\n",pname,i1+1,time);
|
||||
}
|
||||
statpr.StatPrintf("min - %s(%d) %lf; max - %s(%d) %lf; mid - %lf\n",
|
||||
pnamemin,minn,mintime,pnamemax,maxn,maxtime,sumtime/qproc);
|
||||
} // end try
|
||||
catch (bad_alloc ex) {
|
||||
printf("Out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
catch (exception ex) {
|
||||
printf("Exception in standart library %s\n",ex.what());
|
||||
exit(1);
|
||||
}
|
||||
catch (char *str) {
|
||||
printf("%s\n",str);
|
||||
exit(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
7
dvm/tools/pppa/branches/dvm4.07/src/statist.h
Normal file
7
dvm/tools/pppa/branches/dvm4.07/src/statist.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#if !defined( __STATIST_H )
|
||||
#define __STATIST_H
|
||||
void CreateInter(int typef,long val);
|
||||
int FindInter(int typef,long val);
|
||||
void EndInter(long nline);
|
||||
void FreeInter(void);
|
||||
#endif
|
||||
83
dvm/tools/pppa/branches/dvm4.07/src/statprintf.cpp
Normal file
83
dvm/tools/pppa/branches/dvm4.07/src/statprintf.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "statprintf.h"
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
CStatPrintf::CStatPrintf(char *name,int lstr,char *mode)
|
||||
//name -file name
|
||||
//lstr - string length for sprintf,used only for compressed file
|
||||
// mode -file mode,"wb0"- not compress out file
|
||||
{
|
||||
valid=TRUE;
|
||||
ff=NULL;
|
||||
lenstr=lstr;
|
||||
pstr=new char[lstr];
|
||||
if (pstr==NULL) throw("Out of memory\n");
|
||||
if (strcmp(mode,"wb0")!=0) {// compress file
|
||||
char *pname=new char[strlen(name)+4];
|
||||
if (pname==NULL) throw("Out of memory\n");
|
||||
strcpy(pname,name);
|
||||
strcat(pname,".gz");
|
||||
ffgz=gzopen(pname,mode);
|
||||
if (ffgz==NULL) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't open file %s\n",name);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ff=fopen(name,"w");
|
||||
if (ff==NULL) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't open file %s\n",name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-------------------------------------------------
|
||||
//return result of constructor execution
|
||||
BOOL CStatPrintf::Valid()
|
||||
{
|
||||
return(valid);
|
||||
}
|
||||
//-------------------------------------------
|
||||
// error message
|
||||
void CStatPrintf::TextErr(char *p)
|
||||
{
|
||||
strcpy(p,texterr);
|
||||
}
|
||||
//------------------------------------------------
|
||||
// change length of string, if it > lenstr
|
||||
void CStatPrintf::ChangeLenStr(int lstr)
|
||||
{
|
||||
if (lstr<=lenstr) return;
|
||||
char * ppstr=new char[lstr];
|
||||
if (ppstr==NULL) throw("Out of memory\n");
|
||||
delete []pstr;
|
||||
pstr=ppstr;
|
||||
lenstr=lstr;
|
||||
return;
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
int CStatPrintf::StatPrintf(const char *format,...)
|
||||
{
|
||||
va_list arglist;
|
||||
va_start(arglist,format);
|
||||
if (ff==NULL) { // compress file
|
||||
int len=vsprintf(pstr,format,arglist);
|
||||
if (len<=0) return 1;
|
||||
int ans=gzwrite(ffgz,pstr,unsigned(len));
|
||||
if (ans!=len) return 1;
|
||||
} else {
|
||||
vfprintf(ff,format,arglist);
|
||||
}
|
||||
va_end(arglist);
|
||||
return 0;
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
CStatPrintf::~CStatPrintf()
|
||||
{
|
||||
if (ff==NULL) {
|
||||
delete []pstr;
|
||||
gzclose(ffgz);
|
||||
} else fclose (ff);
|
||||
return;
|
||||
}
|
||||
23
dvm/tools/pppa/branches/dvm4.07/src/statprintf.h
Normal file
23
dvm/tools/pppa/branches/dvm4.07/src/statprintf.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _STATPRINTF_H
|
||||
#define _STATPRINTF_H
|
||||
#include "bool.h"
|
||||
#include "zlib.h"
|
||||
#include "stdio.h"
|
||||
class CStatPrintf {
|
||||
public:
|
||||
CStatPrintf(char * name,int lstr,char *mode);
|
||||
~CStatPrintf();
|
||||
void ChangeLenStr(int lstr);
|
||||
BOOL Valid();
|
||||
void TextErr(char *t);
|
||||
int StatPrintf(const char *format,...);
|
||||
private:
|
||||
int lll;
|
||||
char *pstr;
|
||||
int lenstr;
|
||||
FILE * ff;
|
||||
gzFile ffgz;
|
||||
BOOL valid;
|
||||
char texterr[80];
|
||||
};
|
||||
#endif
|
||||
961
dvm/tools/pppa/branches/dvm4.07/src/statread.cpp
Normal file
961
dvm/tools/pppa/branches/dvm4.07/src/statread.cpp
Normal file
@@ -0,0 +1,961 @@
|
||||
#define _STATFILE_
|
||||
#include "zlib.h"
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
#include "bool.h"
|
||||
#include "strall.h"
|
||||
#include "inter.h"
|
||||
#include "treeinter.h"
|
||||
#include "potensyn.h"
|
||||
#include "statread.h"
|
||||
using namespace std;
|
||||
extern short reverse,szsh,szl,szd,szv,torightto,torightfrom;
|
||||
// read intervals and synchronyzation times from file
|
||||
CStatRead::CStatRead(const char * name,int iIM,int jIM,short sore)
|
||||
// name - file name
|
||||
{
|
||||
gzFile ff=NULL;
|
||||
valid=TRUE;
|
||||
valid_warning=0;
|
||||
BOOL valid_synchro=TRUE;
|
||||
valid_synchro=TRUE;
|
||||
pclfrag=NULL;
|
||||
pclsyn=NULL;
|
||||
pic=NULL;
|
||||
pch_vmssize=NULL;
|
||||
pvers=NULL;
|
||||
pvms *pb_vms=NULL;
|
||||
proccount=0;
|
||||
ff=gzopen(name,"rb");
|
||||
if (ff==NULL) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't open file %s \n",name);
|
||||
return;
|
||||
}
|
||||
unsigned long lbufcompr,lbufuncompr=0,luncompr,luncomprread;
|
||||
pbufcompr=NULL;pbufuncompr=NULL;
|
||||
char lbufplusch[12]={0};
|
||||
char nprocch[12]={0};
|
||||
int s; // for gzread
|
||||
long l; // for gztell
|
||||
short sz[QV_CONST];
|
||||
unsigned char *psz; //struc sz
|
||||
gzplus =0; // sign of file gz/ gz+
|
||||
if (strstr(name,".gz+") !=NULL) { //file gz+
|
||||
gzplus=1;
|
||||
int k;
|
||||
for (k=0;;k++) { // number of compressed bytes
|
||||
if (gzread(ff,&(lbufplusch[k]),1)!=1) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s \n",name);
|
||||
return;
|
||||
}
|
||||
if (lbufplusch[k]==0) break;
|
||||
}
|
||||
lbufuncompr=atol(lbufplusch); // size of buffer
|
||||
for (k=0;k<12;k++) lbufplusch[k]=0;
|
||||
for (k=0;;k++) { // number of processors
|
||||
if (gzread(ff,&(nprocch[k]),1)!=1) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s \n",name);
|
||||
return;
|
||||
}
|
||||
if (nprocch[k]==0) break;
|
||||
}
|
||||
for (k=0;;k++) { // number of compressed bytes
|
||||
if (gzread(ff,&(lbufplusch[k]),1)!=1) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s \n",name);
|
||||
return;
|
||||
}
|
||||
if (lbufplusch[k]==0) break;
|
||||
}
|
||||
lbufcompr=atol(lbufplusch);
|
||||
pbufcompr=new unsigned char[lbufcompr];
|
||||
if (pbufcompr==NULL) throw("Out of memory\n");
|
||||
luncompr=lbufuncompr+lbufuncompr/1000+12; // length uncompressed buffer
|
||||
luncomprread=luncompr;
|
||||
if (pbufcompr!=NULL) {
|
||||
pbufuncompr=new unsigned char[luncompr];
|
||||
if (pbufuncompr==NULL) throw("Out of memory\n");
|
||||
}
|
||||
s=gzread(ff,pbufcompr,lbufcompr);
|
||||
if (s!=(int)lbufcompr) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s l=%ld\n",name,lbufcompr);
|
||||
return;
|
||||
}
|
||||
int err=uncompress(pbufuncompr,&luncomprread,pbufcompr,lbufcompr);
|
||||
if (err!=Z_OK || luncomprread!=lbufuncompr) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't uncompress l=%ld\n",lbufcompr);
|
||||
return;
|
||||
}
|
||||
psz=pbufuncompr;
|
||||
} else { // file gz or other files
|
||||
l=gztell(ff);
|
||||
psz=(unsigned char *)(&(sz[0]));
|
||||
// read const information about size of variables and reverse
|
||||
s=gzread(ff,&sz,sizeof(sz));
|
||||
if (s!=(int)sizeof(sz)) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s addr=%ld size=%d\n",
|
||||
name,l,(int)sizeof(sz));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// data presentation
|
||||
memcpy(&reverse,psz,2); // variables reverse and toright for CPYMEM
|
||||
if (reverse!=1) {
|
||||
short imcpy,sh1=0;
|
||||
for (imcpy=sizeof(reverse)-1;imcpy>=0;imcpy--) {
|
||||
*((unsigned char*)(&sh1)+imcpy)=
|
||||
*((unsigned char *)(&reverse)+sizeof(reverse)-1-imcpy);
|
||||
}
|
||||
if (sh1!=1) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Analyzing file %s is not statistics\n",name);
|
||||
return;
|
||||
}
|
||||
reverse=1;
|
||||
}else reverse=0;
|
||||
short left=1; torightto=0;torightfrom=0;
|
||||
char *pleft=(char *)&left;
|
||||
if (reverse==1) { // data reverse
|
||||
if (pleft[0]==0 ) torightto=1;else torightfrom=1;
|
||||
}
|
||||
// size of used variables
|
||||
CPYMEM(szsh,psz+2,2);
|
||||
CPYMEM(szl,psz+4,2);
|
||||
CPYMEM(szv,psz+6,2);
|
||||
CPYMEM(szd,psz+8,2);
|
||||
if ((szsh!=SZSH) || /*(szl>SZL) || (szv>SZV) ||*/ (szd!=SZD)) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Size of accumulating data > size of machine data %d>%d\n",
|
||||
szsh,(int)SZSH);
|
||||
return;
|
||||
}
|
||||
if ((szl>SZL) || (szv>SZV) ) {
|
||||
sprintf(textwarning[valid_warning],"Number of operation may be incorrect. Data size not equal. %d>%d %d>%d\n",
|
||||
szl,(int)SZL,szv,(int)SZV);
|
||||
valid_warning++;
|
||||
}
|
||||
// calculate size of const information
|
||||
int lvms=QV_SHORT*szsh+QV_LONG*szl+QV_VOID*szv+QV_DOUBLE*szd;
|
||||
// read const information from file
|
||||
unsigned char *pch_vms=NULL;
|
||||
if (gzplus==1) pch_vms=pbufuncompr+sizeof(sz);
|
||||
else {
|
||||
pch_vms=new unsigned char[lvms];
|
||||
if (pch_vms==NULL) throw("Out of memory\n");
|
||||
l=gztell(ff);
|
||||
s=gzread(ff,pch_vms,lvms);
|
||||
if (s!=lvms) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s addr=%ld size=%d\n",
|
||||
name,l,lvms);
|
||||
return;
|
||||
}
|
||||
}
|
||||
unsigned long linter=0; // read there only for control
|
||||
CPYMEM(linter,pch_vms+MAKELONG(pb_vms,linter,proccount,QV_SHORT),szl);
|
||||
if (linter<=0) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Execution was exit with statistics error. \n");
|
||||
return;
|
||||
}
|
||||
// smallbuff - not enough memory in buffer,not all data accumulated
|
||||
CPYMEM(smallbuff,pch_vms+MAKESHORT(pb_vms,smallbuff,rank),szsh);
|
||||
if (smallbuff==1) {
|
||||
sprintf(textwarning[valid_warning],
|
||||
"Not all times of collective operations were accumulated\n");
|
||||
valid_warning++;
|
||||
}
|
||||
CPYMEM(rank,pch_vms+MAKESHORT(pb_vms,rank,rank),szsh);
|
||||
// global size of const information
|
||||
size_t lvms_add=lvms+szl*rank+QV_CONST*2;
|
||||
// size of VMS run
|
||||
pch_vmssize=new unsigned char[szl*rank];
|
||||
if (pch_vmssize==NULL) throw("Out of memory\n");
|
||||
if (gzplus==1) memcpy(pch_vmssize,pbufuncompr+sizeof(sz)+lvms,szl*rank);
|
||||
else {
|
||||
l=gztell(ff);
|
||||
s=gzread(ff,pch_vmssize,szl*rank);
|
||||
if (s!=szl*rank) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s addr=%ld size=%d\n",
|
||||
name,l,szl*rank);
|
||||
return;
|
||||
}
|
||||
}
|
||||
CPYMEM(maxnlevel,pch_vms+MAKESHORT(pb_vms,maxnlev,rank),szsh);
|
||||
CPYMEM(proccount,pch_vms+MAKELONG(pb_vms,proccount,proccount,QV_SHORT),szl);
|
||||
pclfrag=new CTreeInter*[proccount];
|
||||
if (pclfrag==NULL) throw("Out of memory\n");
|
||||
unsigned long i;
|
||||
for (i=0;i<proccount;i++) pclfrag[i]=NULL;
|
||||
// allocate memory for pointer of synchronization times
|
||||
pclsyn=new CSynchro*[proccount];
|
||||
if (pclsyn==NULL) throw("Out of memory\n");
|
||||
// proccount - number of processors, the main loop
|
||||
for (i=0;i<proccount;i++) pclsyn[i]=NULL;
|
||||
unsigned long lsynchro=0;
|
||||
for (i=0;i<proccount;i++) {// main processor's loop
|
||||
unsigned long qfrag=0;
|
||||
short maxn=0;
|
||||
// qfrag - number of intervals
|
||||
CPYMEM(qfrag,pch_vms+MAKELONG(pb_vms,qfrag,proccount,QV_SHORT),szl);
|
||||
// maxn - number of levels
|
||||
CPYMEM(maxn,pch_vms+MAKESHORT(pb_vms,maxnlev,rank),szsh);
|
||||
// linter - size of all intervals in bytes
|
||||
CPYMEM(linter,pch_vms+MAKELONG(pb_vms,linter,proccount,QV_SHORT),szl); //all variables on other processors may be not equivalent
|
||||
char *pbuffer=NULL;
|
||||
CPYMEM(pbuffer,pch_vms+MAKEVOID(pb_vms,pbuffer,pbuffer,QV_SHORT,QV_LONG),szv);
|
||||
// length of version, platform and processor name
|
||||
short lvers=0;
|
||||
CPYMEM(lvers,pch_vms+MAKESHORT(pb_vms,lvers,rank),szsh);
|
||||
// different values on each processor
|
||||
if (lvers<=0) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Incorrect version\n");
|
||||
return;
|
||||
}
|
||||
pvers=new char[lvers];
|
||||
if (pvers==NULL) throw("Out of memory\n");
|
||||
l=gztell(ff);
|
||||
if (gzplus==1) {
|
||||
memcpy(pvers,(char *)(pbufuncompr+sizeof(sz)+lvms+szl*rank),lvers);
|
||||
} else {
|
||||
// read from file platform, version number, processor name and time
|
||||
s=gzread(ff,pvers,lvers);
|
||||
if (s!=lvers) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s addr=%ld size=%d\n",
|
||||
name,l,lvers);
|
||||
return;
|
||||
}
|
||||
}
|
||||
pbuffer=pbuffer+lvms_add+lvers;
|
||||
unsigned char * pinterinbuff;
|
||||
if (gzplus==1) pinterinbuff=pbufuncompr+lvms_add+lvers;
|
||||
else pinterinbuff=NULL;
|
||||
// processor name
|
||||
char * pprocname=pvers+strlen(pvers)+strlen(pvers+strlen(pvers)+1)+2;
|
||||
double proct=0.;// processor time
|
||||
CPYMEM(proct,pch_vms+MAKEDOUBLE(pb_vms,proctime,proctime,QV_SHORT,QV_LONG,QV_VOID),szd);
|
||||
// create interval tree
|
||||
pclfrag[i]=new CTreeInter(ff,linter,pbuffer,i,qfrag,maxn,
|
||||
pprocname,proct,iIM,jIM,sore,pinterinbuff);
|
||||
if (pclfrag[i]==NULL) throw("Out of memory\n");
|
||||
valid=pclfrag[i]->Valid();
|
||||
if (!valid) {
|
||||
pclfrag[i]->TextErr(texterr);
|
||||
return;
|
||||
}
|
||||
unsigned long lbuf=0;
|
||||
// lbuf - size of buffer
|
||||
CPYMEM(lbuf,pch_vms+MAKELONG(pb_vms,lbuf,proccount,QV_SHORT),szl);
|
||||
// lsynchro - size of synchronyzation times in bytes
|
||||
if (valid_synchro==FALSE) lsynchro=0; // out of memory for synchro operations
|
||||
else CPYMEM(lsynchro,pch_vms+MAKELONG(pb_vms,lsynchro,proccount,QV_SHORT),szl);
|
||||
// set it the first time
|
||||
unsigned char *psynchroinbuff;
|
||||
if (gzplus==1) {
|
||||
psynchroinbuff=lbuf-lsynchro+pbufuncompr;
|
||||
//psynchroinbuff=pinterinbuff+lbuf-lsynchro-linter-lvms_add-lvers;
|
||||
} else {
|
||||
psynchroinbuff=NULL;
|
||||
if (z_off_t zo=gzseek(ff,lbuf-lsynchro-linter-lvms_add-lvers,SEEK_CUR)==-1) {
|
||||
sprintf(texterr,"Can't read from file %s addr=%ld size=%ld\n",
|
||||
name,l,lbuf-lsynchro-linter-lvms_add-lvers);
|
||||
valid=FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (lsynchro>0) {
|
||||
l=gztell(ff);
|
||||
// create array of synchronization times
|
||||
try {
|
||||
pclsyn[i]= new CSynchro(ff,lsynchro,psynchroinbuff);
|
||||
if (pclsyn[i]==NULL) throw("Out of memory\n");
|
||||
}
|
||||
catch (bad_alloc e) {
|
||||
valid_synchro=FALSE;
|
||||
//lsynchro=0;
|
||||
for (unsigned int j=0;j<=i;j++) {
|
||||
if (pclsyn[j]!=NULL) {
|
||||
pclsyn[j]->~CSynchro();
|
||||
pclsyn[j]=NULL;
|
||||
}
|
||||
}
|
||||
sprintf(textwarning[valid_warning],"Out of memory for synchronization operations\n");
|
||||
valid_warning++;
|
||||
} // end catch
|
||||
catch (char *str) {
|
||||
valid_synchro=FALSE;
|
||||
//lsynchro=0;
|
||||
for (unsigned int j=0;j<=i;j++) {
|
||||
if (pclsyn[j]!=NULL) {
|
||||
pclsyn[j]->~CSynchro();
|
||||
pclsyn[j]=NULL;
|
||||
}
|
||||
}
|
||||
sprintf(textwarning[valid_warning],"Out of memory for synchronization operations\n");
|
||||
valid_warning++;
|
||||
} // end catch
|
||||
if (pclsyn[i]!=NULL) {
|
||||
valid=pclsyn[i]->Valid();
|
||||
if (!valid) {
|
||||
pclsyn[i]->TextErr(texterr);
|
||||
return;
|
||||
}
|
||||
} // end if
|
||||
} else {
|
||||
// synchronization times not accumulated
|
||||
pclsyn[i]=0;
|
||||
if (lsynchro >0 && gzplus==0) {
|
||||
if (gzseek(ff,lsynchro,SEEK_CUR)!=0) {
|
||||
valid=FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gzplus==1) {delete []pbufcompr; pbufcompr=NULL;}
|
||||
if (i!=proccount-1) {
|
||||
if (gzplus==1) {
|
||||
for (int k=0;;k++) {
|
||||
if (gzread(ff,&(lbufplusch[k]),1)!=1) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s \n",name);
|
||||
return;
|
||||
}
|
||||
if (lbufplusch[k]==0) break;
|
||||
}
|
||||
lbufcompr=atol(lbufplusch);
|
||||
pbufcompr=new unsigned char[lbufcompr];
|
||||
if (pbufcompr==NULL) throw("Out of memory\n");
|
||||
s=gzread(ff,pbufcompr,lbufcompr);
|
||||
if (s!=(int)lbufcompr) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s l=%ld\n",name,lbufcompr);
|
||||
return;
|
||||
}
|
||||
int err=uncompress(pbufuncompr,&luncomprread,pbufcompr,lbufcompr);
|
||||
if (err!=Z_OK || luncomprread!=lbufuncompr) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't uncompress l=%ld\n",lbufcompr);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
s=gzread(ff,&sz,sizeof(sz));
|
||||
if (s!=sizeof(sz)) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s addr=%ld size=%d\n",
|
||||
name,l,(int)sizeof(sz));
|
||||
return;
|
||||
}
|
||||
s=gzread(ff,pch_vms,lvms);
|
||||
if (s!=lvms) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s addr=%ld size=%d\n",
|
||||
name,l,lvms);
|
||||
return;
|
||||
}
|
||||
}
|
||||
CPYMEM(rank,pch_vms+MAKESHORT(pb_vms,rank,rank),szsh);
|
||||
if (gzplus==1) pch_vms=pbufuncompr+sizeof(sz);
|
||||
else {
|
||||
l=gztell(ff);
|
||||
s=gzread(ff,pch_vmssize,szl*rank);
|
||||
if (s!=szl*rank) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read from file %s addr=%ld size=%d\n",
|
||||
name,l,szl*rank);
|
||||
return;
|
||||
}
|
||||
l=gztell(ff);
|
||||
delete [] pvers; pvers=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gzplus==1) {delete []pbufuncompr; pbufuncompr=NULL;}
|
||||
pic=new CInter*[proccount];
|
||||
if (pic==NULL) throw("Out of memory\n");
|
||||
// add synchronization times to interval characteristics
|
||||
if (lsynchro>0) {
|
||||
unsigned long n=BeginTreeWalk();
|
||||
while (n!=0) {
|
||||
BOOL b=Synchro();
|
||||
if (b==1) return;
|
||||
n=TreeWalk();
|
||||
}
|
||||
for (i=0;i<proccount;i++) {
|
||||
pclsyn[i]->~CSynchro();
|
||||
}
|
||||
}//lsynchro
|
||||
// sum interval characteristics
|
||||
for (i=0;i<proccount;i++){
|
||||
pclfrag[i]->SumLevel();
|
||||
pclsyn[i]=NULL;
|
||||
}
|
||||
// Idle, Load imbalance
|
||||
unsigned long n=BeginTreeWalk();
|
||||
while (n!=0) {
|
||||
double max=0.0,maxi=0.0;
|
||||
double time,time1;
|
||||
// calculate maximal values
|
||||
for (i=0;i<proccount;i++) {
|
||||
if (pic[i]!=NULL) {
|
||||
pic[i]->ReadTime(EXEC,time);
|
||||
if (time>max) max=time;
|
||||
pic[i]->ReadTime(CPU,time);
|
||||
pic[i]->ReadTime(CPUUSR,time1);
|
||||
if (time+time1>maxi) maxi=time+time1;
|
||||
}
|
||||
}
|
||||
// calculate maximal - current
|
||||
for (i=0;i<proccount;i++) {
|
||||
if (pic[i]!=NULL) {
|
||||
double qproc;
|
||||
pic[i]->ReadTime(PROC,qproc);
|
||||
if (qproc!=n) {
|
||||
// interval execute not on all processors
|
||||
for (i=0;i<proccount;i++) {
|
||||
if (pic[i]!=NULL) {
|
||||
pic[i]->WriteTime(IDLE,0);
|
||||
pic[i]->WriteTime(LOST,0);
|
||||
pic[i]->WriteTime(IMB,0);
|
||||
pic[i]->WriteTime(PROC,0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
pic[i]->ReadTime(EXEC,time);
|
||||
if (max-time>0.0) {
|
||||
pic[i]->AddTime(IDLE,max-time);
|
||||
pic[i]->AddTime(LOST,max-time);
|
||||
}
|
||||
pic[i]->ReadTime(CPU,time);
|
||||
pic[i]->ReadTime(CPUUSR,time1);
|
||||
if (maxi-time-time1>0.0)
|
||||
pic[i]->AddTime(IMB,maxi-time-time1);
|
||||
}
|
||||
}
|
||||
}
|
||||
n=TreeWalk();
|
||||
}
|
||||
if (gzplus!=1) {
|
||||
if (pch_vms!=NULL) {delete [] pch_vms;pch_vms=NULL;}
|
||||
}
|
||||
gzclose(ff);
|
||||
}
|
||||
//--------------------------------------------------
|
||||
// deallocate memory for trees and syn times
|
||||
CStatRead::~CStatRead(void)
|
||||
{
|
||||
if (pvers!=NULL) delete []pvers;
|
||||
if (gzplus==1) {
|
||||
if (pbufcompr!=NULL) delete []pbufcompr;
|
||||
if (pbufuncompr!=NULL) delete []pbufuncompr;
|
||||
} else {
|
||||
if (pch_vms!=NULL) delete [] pch_vms;
|
||||
}
|
||||
if (pclfrag!=NULL) {
|
||||
for (unsigned long i=0;i<proccount;i++) {
|
||||
if (pclfrag[i]!=NULL) pclfrag[i]->~CTreeInter();
|
||||
pclfrag[i]=NULL;
|
||||
if (pic!=NULL) pic[i]=NULL;
|
||||
if (pclsyn!=NULL) {
|
||||
if (pclsyn[i]!=NULL) pclsyn[i]->~CSynchro();
|
||||
pclsyn[i]=NULL;
|
||||
}
|
||||
}
|
||||
delete [] pclfrag;
|
||||
}
|
||||
// deallocate memory for data-member
|
||||
if (pclsyn!=NULL) delete [] pclsyn;
|
||||
if (pch_vmssize!=NULL) delete []pch_vmssize;
|
||||
if (pic!=NULL) delete [] pic;
|
||||
}
|
||||
//--------------------------------------------------
|
||||
// begin tree-walk
|
||||
unsigned long CStatRead::BeginTreeWalk(void)
|
||||
// return number of intervals
|
||||
{
|
||||
unsigned long n=0;
|
||||
for (unsigned long i=0;i<proccount;i++) {
|
||||
pclfrag[i]->BeginInter();
|
||||
pic[i]=NULL;
|
||||
}
|
||||
ident *id;
|
||||
for(curnproc=0;curnproc<proccount;curnproc++) {
|
||||
pclfrag[curnproc]->NextInter(&id);
|
||||
if (id!=NULL) {
|
||||
for (unsigned long j=0;j<proccount;j++) {
|
||||
pic[j]=pclfrag[j]->FindInter(id);
|
||||
if (pic[j]!=NULL) n++;
|
||||
}
|
||||
return(n);
|
||||
}
|
||||
}
|
||||
return(n);
|
||||
}
|
||||
//------------------------------------------------
|
||||
// continue tree-walk
|
||||
unsigned long CStatRead::TreeWalk(void)
|
||||
// return number of intervals
|
||||
{
|
||||
unsigned long n=0;
|
||||
ident *id;
|
||||
pclfrag[curnproc]->NextInter(&id);
|
||||
if (id!=NULL) {
|
||||
for (unsigned long j=0;j<proccount;j++) {
|
||||
pic[j]=pclfrag[j]->FindInter(id);
|
||||
if (pic[j]!=NULL) n++;
|
||||
}
|
||||
if (n!=0)return(n);
|
||||
}
|
||||
for(unsigned long i=curnproc+1;i<proccount;i++) {
|
||||
pclfrag[i]->NextInter(&id);
|
||||
if (id!=NULL) {
|
||||
curnproc=i;
|
||||
for (unsigned long j=0;j<proccount;j++) {
|
||||
pic[j]=pclfrag[j]->FindInter(id);
|
||||
if (pic[j]!=NULL) n++;
|
||||
}
|
||||
return(n);
|
||||
}
|
||||
}
|
||||
return(n);
|
||||
}
|
||||
//------------------------------------------------
|
||||
// calculate synchronization times, variation times and overlap
|
||||
BOOL CStatRead::Synchro(void)
|
||||
// return 0 - OK
|
||||
{
|
||||
unsigned long nint=0;
|
||||
for (unsigned long k=0;k<proccount;k++) {
|
||||
if (pic[k]!=NULL) {
|
||||
// nint - number of current interval
|
||||
nint=pic[k]->ninter;
|
||||
BOOL b=pclsyn[k]->Count(nint,smallbuff);
|
||||
if (b!=0) {
|
||||
pclsyn[k]->TextErr(texterr);
|
||||
valid=FALSE;
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nint==0) return(0);
|
||||
for (short i=1;i<=QCOLLECT+QCOLLECT;i++) {
|
||||
if ((i&3)!=0 && (i&3)!=2) { //4 type not used
|
||||
typegrp t1;
|
||||
typecom t2;
|
||||
if (i<=QCOLLECT) {
|
||||
t1=SYN;
|
||||
t2=(typecom)((i)>>2);
|
||||
}else{
|
||||
t1=VAR;
|
||||
t2=(typecom)((i-QCOLLECT)>>2);
|
||||
}
|
||||
int min=INT_MAX;
|
||||
unsigned long j;
|
||||
for (j=0;j<proccount;j++) {
|
||||
if (pic[j]!=NULL) {
|
||||
// n - number of times in the interval
|
||||
int n=pclsyn[j]->GetCount((typecollect)(i));
|
||||
if (min!=INT_MAX && n!=min && smallbuff==0) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,
|
||||
"Number of synhro or variation times not equivalent on other processors %ld %ld numbers %d %d %\n",j+1,j,n,min);
|
||||
return(1);
|
||||
}
|
||||
if (min>n) min=n;
|
||||
}
|
||||
}
|
||||
if (min!=0) {
|
||||
// times is accumulated
|
||||
for ( int k=0; k<min; k++) {
|
||||
double max=0.0;
|
||||
// calculate maximal value
|
||||
for (j=0;j<proccount;j++) {
|
||||
if (pic[j]!=NULL) {
|
||||
double time=pclsyn[j]->Find((typecollect)i);
|
||||
if (time-max>0.0) max=time;
|
||||
}
|
||||
}
|
||||
double maxs=0.0;
|
||||
if (i<QCOLLECT && (i&3)==3) {
|
||||
// overlap for wait_operation
|
||||
for (j=0;j<proccount;j++) {
|
||||
if (pic[j]!=NULL) {
|
||||
double time=pclsyn[j]->FindNearest
|
||||
((typecollect)(i+QCOLLECT-1)); //Start_operation
|
||||
if (time==0.0 && smallbuff==0) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Number of call operations != number of wait operations\n");
|
||||
return(1);
|
||||
}
|
||||
if (time-maxs>0.0) maxs=time;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j=0;j<proccount;j++) {
|
||||
if (pic[j]!=NULL) {
|
||||
double time=pclsyn[j]->GetCurr();
|
||||
// write overlap
|
||||
if (maxs>0.0 && time-maxs>0.0 ) {
|
||||
pic[j]->AddTime(OVERLAP,t2,time-maxs);
|
||||
}
|
||||
// write syn and variation times
|
||||
if (max-time>0.0) {
|
||||
pic[j]->AddTime(t1,t2,max-time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
//------------------------------------------------
|
||||
// return result of constructor execution
|
||||
BOOL CStatRead::Valid(int *warn)
|
||||
{
|
||||
*warn=valid_warning;
|
||||
return(valid);
|
||||
}
|
||||
//---------------------------------------------------
|
||||
// error message
|
||||
void CStatRead::TextErr(char *t)
|
||||
{
|
||||
strcpy(t,texterr);
|
||||
return;
|
||||
}
|
||||
// warning message
|
||||
//---------------------------------------------------
|
||||
// return number of processors
|
||||
unsigned long CStatRead::QProc(void)
|
||||
{
|
||||
return(proccount);
|
||||
}
|
||||
//--------------------------------------------
|
||||
// size of VMS
|
||||
void CStatRead::VMSSize(char *str)
|
||||
{
|
||||
str[0]='\0';
|
||||
char n[11];
|
||||
long l=0;
|
||||
for (int i=0;i<rank;i++) {
|
||||
CPYMEM(l,pch_vmssize+i*szl,szl);
|
||||
sprintf(n,"%ld",l);
|
||||
if(i==rank-1) strcat(str,n);
|
||||
else {
|
||||
strcat(str,n);
|
||||
strcat(str,"*");
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------
|
||||
// warning message
|
||||
void CStatRead::WasErrAccum(char *str)
|
||||
{
|
||||
if (valid_warning==0) str[0]='\0';
|
||||
else {
|
||||
strcpy(str,textwarning[valid_warning-1]);
|
||||
valid_warning--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
//---------------------------------------------
|
||||
// return number of calls of collective operations
|
||||
long CStatRead::ReadCall(typecom t)
|
||||
{
|
||||
double val=0.0;
|
||||
long calll=0;
|
||||
for (unsigned long i=0;i<proccount;i++) {
|
||||
if (pic[i]!=NULL) {
|
||||
double v;
|
||||
pic[i]->ReadTime(CALL,t,v);
|
||||
val=val+v;
|
||||
}
|
||||
}
|
||||
calll=(long)(val/1);
|
||||
if (val-calll!=0.0) calll++;
|
||||
return(calll);
|
||||
}
|
||||
//---------------------------------------------
|
||||
// identifier information of interval
|
||||
// set number of current characteristics =0
|
||||
// return number of level
|
||||
short CStatRead::ReadTitle(char *str)
|
||||
{
|
||||
short nlev=0;
|
||||
ident *id=NULL;
|
||||
// nenter = number of enters / weight
|
||||
double nenter=0.0;
|
||||
for (unsigned long i=0;i<proccount;i++) {
|
||||
if (pic[i]!=NULL) {
|
||||
pic[i]->ReadIdent(&id);
|
||||
nlev=id->nlev;
|
||||
nenter=nenter+id->nenter;
|
||||
|
||||
}
|
||||
}
|
||||
long nent=(long)(nenter/1);
|
||||
if (nenter-nent!=0.0) nent++;
|
||||
char type[10];
|
||||
switch((int)(id->t)) {
|
||||
case REDUC:strcpy(type,"REDUC");
|
||||
break;
|
||||
case SREDUC:strcpy(type,"SREDUC");
|
||||
break;
|
||||
case WREDUC:strcpy(type,"WREDUC");
|
||||
break;
|
||||
case SHAD:strcpy(type,"SHAD");
|
||||
break;
|
||||
case SSHAD:strcpy(type,"SSHAD");
|
||||
break;
|
||||
case WSHAD:strcpy(type,"WSHAD");
|
||||
break;
|
||||
case RACC:strcpy(type,"RACC");
|
||||
break;
|
||||
case SRACC:strcpy(type,"SRACC");
|
||||
break;
|
||||
case WRACC:strcpy(type,"WRACC");
|
||||
break;
|
||||
case REDISTR:strcpy(type,"REDISTR");
|
||||
break;
|
||||
case SREDISTR:strcpy(type,"SREDISTR");
|
||||
break;
|
||||
case WREDISTR:strcpy(type,"WREDISTR");
|
||||
break;
|
||||
case PREFIX:strcpy(type,"PREFIX");
|
||||
break;
|
||||
case SEQ:strcpy(type,"SEQ");
|
||||
break;
|
||||
case PAR: strcpy(type,"PAR");
|
||||
break;
|
||||
case USER: strcpy(type,"USER");
|
||||
break;
|
||||
default: sprintf(str,"Statread ReadTitle:Incorrect type\n");
|
||||
return(0);
|
||||
}
|
||||
if (id->nlev==0) type[0]='\0';
|
||||
if (id->pname==NULL) {
|
||||
if (id->expr==Fic_index)
|
||||
sprintf(str,"INTERVAL ( NLINE=%ld ) LEVEL=%d %s EXE_COUNT=%ld\n",
|
||||
id->nline,id->nlev,type,nent);
|
||||
else sprintf(str,"INTERVAL ( NLINE=%ld ) LEVEL=%d %s EXE_COUNT=%ld EXPR=%ld\n",
|
||||
id->nline,id->nlev,type,nent,id->expr);
|
||||
}else {
|
||||
if (id->expr==Fic_index)
|
||||
sprintf(str,"INTERVAL ( NLINE=%ld SOURCE=%s ) LEVEL=%d %s EXE_COUNT=%ld\n",
|
||||
id->nline,id->pname,id->nlev,type,nent);
|
||||
else sprintf(str,"INTERVAL ( NLINE=%ld SOURCE=%s ) LEVEL=%d %s EXE_COUNT=%ld EXPR=%ld\n",
|
||||
id->nline,id->pname,id->nlev,type,nent,id->expr);
|
||||
}
|
||||
curntime=0;
|
||||
return(nlev);
|
||||
}
|
||||
//--------------------------------------------------------
|
||||
// return version number on accumulation
|
||||
char *CStatRead::ReadVers(void)
|
||||
{
|
||||
return(pvers);
|
||||
}
|
||||
//--------------------------------------------------------
|
||||
// return platform information on accumulation
|
||||
char *CStatRead::ReadPlatform(void)
|
||||
{
|
||||
return(pvers+strlen(pvers)+1);
|
||||
}
|
||||
//-----------------------------------------------------------
|
||||
//name and time of processor
|
||||
void CStatRead::NameTimeProc(unsigned long n,char **name,double *time)
|
||||
{
|
||||
pclfrag[n]->ReadProcName(name);
|
||||
pclfrag[n]->ReadProcTime(*time);
|
||||
return;
|
||||
}
|
||||
//-------------------------------------------------------
|
||||
// read current time characteristics
|
||||
// use after ReadTitle()
|
||||
BOOL CStatRead::ReadProc(typeprint t,unsigned long *pnumb,int qnumb,short fmt,
|
||||
double sum,char *str)
|
||||
//t - type of information of characteristics for each processor,
|
||||
//pnumb - pointer to array of processor numbers, for which characteristics are to be output,
|
||||
//qnumb - number of elements of processor number array,
|
||||
//sum - total characteristic value for each processor,
|
||||
//str - string where characteristic name and time values are written.
|
||||
{
|
||||
int q,prec,lstr;
|
||||
if (t==PRGEN) q=ITER;else q=RED;
|
||||
//char ss[1024];
|
||||
curntime++;
|
||||
if (sum==0.0) {
|
||||
str[0]='\0';
|
||||
if (curntime>q) curntime=0;
|
||||
return(TRUE);
|
||||
}
|
||||
if (t==PRGEN) {
|
||||
sprintf(str,"%s",nameGen[curntime-1]);
|
||||
//sprintf(ss,"%s",nameGen[curntime-1]);
|
||||
} else {
|
||||
// nameCom for VAR,OVERLAP,SYN,COM,RCOM
|
||||
sprintf(str,"%s",nameCom[curntime-1]);
|
||||
strcat(str," ");
|
||||
}
|
||||
lstr=strlen(nameGen[curntime-1]);
|
||||
// list of processor numbers - pnumb
|
||||
// pr=TRUE - number is in list
|
||||
for (unsigned long i=0;i<proccount;i++) {
|
||||
BOOL pr=FALSE;
|
||||
if (pic[i]!=NULL) {
|
||||
if (pnumb!=NULL) {
|
||||
for (int j=0;j<qnumb;j++) {
|
||||
if (i+1>=pnumb[j] && i+1<=pnumb[j+1]) pr=TRUE;
|
||||
}
|
||||
} else pr=TRUE;
|
||||
if (pr==TRUE) {
|
||||
// read time characteristic
|
||||
double time;
|
||||
switch (t) {
|
||||
case PRGEN:
|
||||
pic[i]->ReadTime((typetime)(curntime-1),time);
|
||||
break;
|
||||
case PRCOM:
|
||||
pic[i]->ReadTime(COM,(typecom)(curntime-1),time);
|
||||
break;
|
||||
case PRRCOM:
|
||||
pic[i]->ReadTime(RCOM,(typecom)(curntime-1),time);
|
||||
break;
|
||||
case PRSYN:
|
||||
pic[i]->ReadTime(SYN,(typecom)(curntime-1),time);
|
||||
break;
|
||||
case PRVAR:
|
||||
pic[i]->ReadTime(VAR,(typecom)(curntime-1),time);
|
||||
break;
|
||||
case PROVER:
|
||||
pic[i]->ReadTime(OVERLAP,(typecom)(curntime-1),time);
|
||||
break;
|
||||
default:sprintf(str,"Statread ReadProc:Incorrect type=%d\n",t);
|
||||
return(FALSE);
|
||||
}
|
||||
if ((t==PRGEN) && ((typetime)(curntime-1)==PROC ||
|
||||
(typetime)(curntime-1)==ITER)) prec=0;else prec=PREC;
|
||||
sprintf((str+lstr),"%*.*lf ",fmt,prec,time);
|
||||
//sprintf(ss+lstr,"%*.*lf",fmt,prec,time);
|
||||
lstr=strlen(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (curntime>q) curntime=0;
|
||||
return(TRUE);
|
||||
}
|
||||
//--------------------------------------------------------
|
||||
// calculate min,max,sum time characteristics
|
||||
void CStatRead::MinMaxSum(typeprint t,double *min,unsigned long *nprocmin,
|
||||
double*max,unsigned long *nprocmax,
|
||||
double *sum)
|
||||
// t - characteristic type,
|
||||
//min - pointer to array of minimal characteristic values,
|
||||
//nprocmin,- pointer to processor number array, corresponding to minimal values,
|
||||
//max, - pointer to array of maximal characteristic values,
|
||||
//nprocmax, - pointer to processor number array, corresponding to maximal values,
|
||||
//sum - pointer to array of total characteristic values.
|
||||
{
|
||||
int q;
|
||||
if (t==PRGEN) q=ITER;else q=RED;
|
||||
if (t==PRCALLS || t==PRLOST) q=StatGrpCount-1;
|
||||
int k;
|
||||
for (k=0;k<=q;k++) {
|
||||
min[k]=DBL_MAX;
|
||||
max[k]=0.0;
|
||||
sum[k]=0.0;
|
||||
nprocmin[k]=0;
|
||||
nprocmax[k]=0;
|
||||
}
|
||||
for (unsigned long i=0;i<proccount;i++) {
|
||||
if (pic[i]!=NULL) {
|
||||
for (k=0;k<=q;k++) {
|
||||
double time;
|
||||
// read time characteristic
|
||||
switch (t) {
|
||||
case PRGEN:
|
||||
pic[i]->ReadTime((typetime)k,time);
|
||||
break;
|
||||
case PRCOM:
|
||||
pic[i]->ReadTime(COM,(typecom)k,time);
|
||||
break;
|
||||
case PRRCOM:
|
||||
pic[i]->ReadTime(RCOM,(typecom)k,time);
|
||||
break;
|
||||
case PRSYN:
|
||||
pic[i]->ReadTime(SYN,(typecom)k,time);
|
||||
break;
|
||||
case PRVAR:
|
||||
pic[i]->ReadTime(VAR,(typecom)k,time);
|
||||
break;
|
||||
case PRCALLS:
|
||||
pic[i]->ReadTime(CALLSMT,k,time);
|
||||
break;
|
||||
case PRLOST:
|
||||
pic[i]->ReadTime(LOSTMT,k,time);
|
||||
break;
|
||||
case PROVER:
|
||||
pic[i]->ReadTime(OVERLAP,(typecom)k,time);
|
||||
break;
|
||||
default:
|
||||
valid=FALSE;
|
||||
printf("CStatRead::MinMaxSum Unknown typeprint=%d\n",t);
|
||||
return;
|
||||
}
|
||||
// minimal value
|
||||
if (min[k]>time) {
|
||||
min[k]=time;
|
||||
nprocmin[k]=i+1;
|
||||
}
|
||||
//maximal value
|
||||
if (max[k]<=time) {
|
||||
max[k]=time;
|
||||
nprocmax[k]=i+1;
|
||||
}
|
||||
// sum value
|
||||
sum[k]=sum[k]+time;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
// read grp characteristics
|
||||
void CStatRead::GrpTimes(double *arrprod,double *arrlost,double *arrcalls,int nproc)
|
||||
{
|
||||
int q=StatGrpCount-1;
|
||||
int k;
|
||||
for (k=0;k<=q;k++) {
|
||||
arrprod[k]=0.0;
|
||||
arrlost[k]=0.0;
|
||||
arrcalls[k]=0.0;
|
||||
}
|
||||
unsigned long i=nproc-1;
|
||||
//double arr[StatGrpCount];
|
||||
if (pic[i]!=NULL) {
|
||||
for (k=0;k<=q;k++) {
|
||||
// read time characteristic
|
||||
pic[i]->ReadTime(CALLSMT,k,arrcalls[k]);
|
||||
//arrcalls[k]=(int)arr[k];
|
||||
pic[i]->ReadTime(LOSTMT,k,arrlost[k]);
|
||||
pic[i]->ReadTime(PRODMT,k,arrprod[k]);
|
||||
} // end for
|
||||
}// end if
|
||||
return;
|
||||
}
|
||||
|
||||
136
dvm/tools/pppa/branches/dvm4.07/src/statread.h
Normal file
136
dvm/tools/pppa/branches/dvm4.07/src/statread.h
Normal file
@@ -0,0 +1,136 @@
|
||||
#if !defined( _STATREAD_H )
|
||||
#define _STATREAD_H
|
||||
#include "potensyn.h"
|
||||
#include "inter.h"
|
||||
#include "treeinter.h"
|
||||
#define Fic_index 2000000000 //interval.h
|
||||
#define PREC 4
|
||||
#define DIGTIME 6+PREC
|
||||
// sizeof(nameOper[i])=DIGTIME
|
||||
#define DIGSTAT 5
|
||||
|
||||
enum typeprint {PRGEN,PRCOM,PRRCOM,PRSYN,PRVAR,PROVER,PRCALL,PRCALLS,PRLOST};
|
||||
static char *nameGen[ITER+1]={
|
||||
"Lost time ",
|
||||
"User insufficient par. ",
|
||||
"Sys.insufficient par. ",
|
||||
"Idle time ",
|
||||
"Communication ",
|
||||
"Real synchronization ",
|
||||
"Synchronization ",
|
||||
"Variation ",
|
||||
"Overlap ",
|
||||
"Load imbalance ",
|
||||
"Execution time ",
|
||||
"User CPU time ",
|
||||
"Sys. CPU time ",
|
||||
"I/O time ",
|
||||
"Start operation ",
|
||||
"Processors "
|
||||
};
|
||||
static char *nameGenMT[StatGrpCount]={
|
||||
"UserGrp ",
|
||||
"MsgPasGrp ",
|
||||
"StartRedGrp ",
|
||||
"WaitRedGrp ",
|
||||
"RedGrp ",
|
||||
"StartShdGrp ",
|
||||
"WaitShdGrp ",
|
||||
"ShdGrp ",
|
||||
"DistrGrp ",
|
||||
"ReDistrGrp ",
|
||||
"MapPLGrp ",
|
||||
"DoPLGrp ",
|
||||
"ProgBlockGrp ",
|
||||
"IOGrp ",
|
||||
"RemAccessGrp ",
|
||||
"UserDebGrp ",
|
||||
"StatistGrp ",
|
||||
"SystemGrp ",
|
||||
};
|
||||
static char *nameCom[RED+1]={
|
||||
"I/O ",
|
||||
"Reduction ",
|
||||
"Shadow ",
|
||||
"Remote access ",
|
||||
"Redistribution "
|
||||
};
|
||||
static char *nameOper[SUMOVERLAP-SUMCOM+1]={
|
||||
" Communic",
|
||||
" Real_sync",
|
||||
" Synchro",
|
||||
" Variation",
|
||||
" Overlap"
|
||||
};
|
||||
enum tmps {EMP,GNS,ROU,MPI,PVM};
|
||||
struct vms_const {
|
||||
short reverse,szsh,szl,
|
||||
szv,szd;
|
||||
};
|
||||
struct vms_short {
|
||||
short rank,maxnlev,
|
||||
smallbuff,lvers;
|
||||
};
|
||||
struct vms_long{
|
||||
long proccount,mpstype,ioproc,
|
||||
qfrag,lbuf,linter,lsynchro;
|
||||
};
|
||||
struct vms_void{
|
||||
void *pbuffer;
|
||||
};
|
||||
struct vms_double{
|
||||
double proctime;
|
||||
};
|
||||
typedef struct tvms{
|
||||
vms_double d;
|
||||
vms_void v;
|
||||
vms_long l;
|
||||
vms_short sh;
|
||||
vms_const chc;
|
||||
} pvms;
|
||||
#define QV_CONST sizeof(vms_const)/SZSH
|
||||
#define QV_SHORT sizeof(vms_short)/SZSH
|
||||
#define QV_LONG sizeof(vms_long)/SZL
|
||||
#define QV_VOID sizeof(vms_void)/SZV
|
||||
#define QV_DOUBLE sizeof(vms_double)/SZD
|
||||
class CStatRead {
|
||||
public:
|
||||
CStatRead(const char * name,int i,int j,short sore);
|
||||
~CStatRead(void);
|
||||
unsigned long QProc(void);
|
||||
unsigned long BeginTreeWalk(void);
|
||||
unsigned long TreeWalk(void);
|
||||
BOOL Valid(int *warn);
|
||||
void TextErr(char *t);
|
||||
short ReadTitle(char * p);
|
||||
BOOL ReadProc(typeprint t,unsigned long *pnumb,int qnumb,short fmt,double sum,char *str);
|
||||
void MinMaxSum(typeprint t,double *min,unsigned long *nprocmin,
|
||||
double*max,unsigned long *nprocmax,
|
||||
double *sum);
|
||||
void GrpTimes(double *arrprod,double *arrlost,double *arrcalls,int nproc);
|
||||
void VMSSize(char *p);
|
||||
void WasErrAccum(char *p);
|
||||
long ReadCall(typecom t);
|
||||
char *ReadVers(void);
|
||||
char *ReadPlatform(void);
|
||||
void NameTimeProc(unsigned long n,char **name,double *time);
|
||||
private:
|
||||
unsigned long proccount,curnproc;
|
||||
BOOL valid,valid_synchro;
|
||||
short rank;
|
||||
unsigned char *pch_vmssize,*pch_vms;
|
||||
short maxnlevel;
|
||||
char texterr[80];
|
||||
char textwarning[3][80];
|
||||
int valid_warning;
|
||||
CTreeInter **pclfrag;
|
||||
CSynchro **pclsyn;
|
||||
short smallbuff;
|
||||
CInter **pic;
|
||||
int nf,curntime;
|
||||
char *pvers;
|
||||
unsigned char *pbufcompr,*pbufuncompr;
|
||||
short gzplus; // sign of file gz/ gz+
|
||||
BOOL Synchro(void);
|
||||
};
|
||||
#endif
|
||||
132
dvm/tools/pppa/branches/dvm4.07/src/strall.h
Normal file
132
dvm/tools/pppa/branches/dvm4.07/src/strall.h
Normal file
@@ -0,0 +1,132 @@
|
||||
#if !defined( __STRALL_H )
|
||||
#define __STRALL_H
|
||||
#if defined (_STATFILE_)
|
||||
#include "sysstat.h"
|
||||
#endif
|
||||
#define SZSH sizeof(short)
|
||||
#define SZL sizeof(long)
|
||||
#define SZINT sizeof(int)
|
||||
#define SZD sizeof(double)
|
||||
#define SZV sizeof(void*)
|
||||
enum typecollect {INOUT=1,SINOUT,WINOUT,NINOUT,REDUC,SREDUC,WREDUC,NREDUC,
|
||||
SHAD,SSHAD,WSHAD,NSHAD,RACC,SRACC,WRACC,NRACC,REDISTR,SREDISTR,WREDISTR,
|
||||
NREDISTR}; /* new operation insert before REDISTR */
|
||||
#define QCOLLECT NREDISTR /* 4 type for 5 collective operation */
|
||||
|
||||
enum typefrag {PREFIX=QCOLLECT,SEQ,PAR,USER};
|
||||
#if !defined (_STATFILE_)
|
||||
struct vms_const {
|
||||
unsigned char reverse[2],szsh[2],szl[2],
|
||||
szv[2],szd[2];
|
||||
};
|
||||
struct vms_short {
|
||||
unsigned char rank[SZSH],maxnlev[SZSH],
|
||||
smallbuff[SZSH],lvers[SZSH];
|
||||
};
|
||||
struct vms_long{
|
||||
unsigned char proccount[SZL],mpstype[SZL],ioproc[SZL],
|
||||
qfrag[SZL],lbuf[SZL],linter[SZL],lsynchro[SZL];
|
||||
};
|
||||
struct vms_void{
|
||||
unsigned char pbuffer[SZV];
|
||||
};
|
||||
struct vms_double{
|
||||
unsigned char proctime[SZD];
|
||||
};
|
||||
/* if change here chahge statread.h */
|
||||
typedef struct tvms_ch {
|
||||
struct vms_const shc;
|
||||
struct vms_short sh;
|
||||
struct vms_long l;
|
||||
struct vms_void v;
|
||||
struct vms_double d;
|
||||
} *pvms_ch;
|
||||
|
||||
struct inter_short {
|
||||
unsigned char nlev[SZSH],type[SZSH];
|
||||
};
|
||||
struct inter_long {
|
||||
unsigned char nline[SZL],nline_end[SZL],valvar[SZL],qproc[SZL],
|
||||
ninter[SZL],SendCallCount[SZL],RecvCallCount[SZL];
|
||||
};
|
||||
struct inter_void{
|
||||
unsigned char up[SZV],next[SZV],down[SZV],
|
||||
ptimes[SZV];
|
||||
};
|
||||
struct inter_double{
|
||||
unsigned char nenter[SZD],SendCallTime[SZD],MinSendCallTime[SZD],
|
||||
MaxSendCallTime[SZD],RecvCallTime[SZD],MinRecvCallTime[SZD],
|
||||
MaxRecvCallTime[SZD],
|
||||
times[3*StatGrpCount*StatGrpCount][SZD];
|
||||
};
|
||||
/* if change here change treeinter.h*/
|
||||
typedef struct tinter_ch {
|
||||
struct inter_short sh;
|
||||
struct inter_long l;
|
||||
struct inter_void v;
|
||||
struct inter_double d;
|
||||
}*pinter_ch;
|
||||
struct syn_short{
|
||||
unsigned char nitem[SZSH];
|
||||
};
|
||||
struct syn_long{
|
||||
unsigned char ninter[SZL];
|
||||
};
|
||||
struct syn_void{
|
||||
unsigned char pgrp[SZV];
|
||||
};
|
||||
struct syn_double{
|
||||
unsigned char time[SZD];
|
||||
};
|
||||
/* if change here change potensyn.h*/
|
||||
typedef struct tsyn_ch {
|
||||
struct syn_short sh;
|
||||
struct syn_long l;
|
||||
struct syn_void v;
|
||||
struct syn_double d;
|
||||
}*psyn_ch;
|
||||
#define CPYMEM(to,from)\
|
||||
memcpy(&(to),&(from),sizeof(to));
|
||||
#define CPYMEMC(to,from)\
|
||||
smfrom=0;\
|
||||
stcond = sizeof(from)>sizeof(to);\
|
||||
if (stcond && toright==1) smfrom=sizeof(from)-sizeof(to);\
|
||||
memcpy(&(to),(unsigned char *)(&(from))+smfrom,sizeof(to));
|
||||
#else
|
||||
#define min(a,b) (((a) <(b)) ? (a):(b))
|
||||
#define MAKESHORT(p,nm,nmfirst)\
|
||||
(&(p->sh.nm)-&(p->sh.nmfirst))*szsh
|
||||
#define MAKELONG(p,nm,nmfirst,q_short)\
|
||||
q_short*szsh+(&(p->l.nm)-&(p->l.nmfirst))*szl
|
||||
#define MAKEVOID(p,nm,nmfirst,q_short,q_long)\
|
||||
q_short*szsh+q_long*szl+(&(p->v.nm)-&(p->v.nmfirst))*szv
|
||||
#define MAKEDOUBLE(p,nm,nmfirst,q_short,q_long,q_void)\
|
||||
q_short*szsh+q_long*szl+q_void*szv+(&(p->d.nm)-&(p->d.nmfirst))*szd
|
||||
#define MAKEDOUBLEA(p,nm,nmfirst,q_short,q_long,q_void,a)\
|
||||
a=q_short*szsh+q_long*szl+q_void*szv+(&(p->d.nm)-&(p->d.nmfirst))*szd;
|
||||
|
||||
#define CPYMEM(to,pfrom,sz_var)\
|
||||
{\
|
||||
int sz_to;\
|
||||
int smfrom=0,smto=0,mmin;\
|
||||
sz_to=sizeof(to);\
|
||||
mmin=min(sz_to,sz_var);\
|
||||
if (sz_to!=sz_var) {\
|
||||
if (sz_to>sz_var) {\
|
||||
if (torightto==1) smto=sz_to-sz_var;\
|
||||
} else {\
|
||||
if (torightfrom==1) smfrom=sz_var-sz_to;\
|
||||
}\
|
||||
}\
|
||||
if (reverse!=1) {\
|
||||
memcpy((unsigned char *)(&(to))+smto,pfrom+smfrom,mmin);\
|
||||
} else {\
|
||||
int imcpy;\
|
||||
for (imcpy=mmin-1;imcpy>=0;imcpy--) {\
|
||||
*((unsigned char*)(&(to))+imcpy+smto)=\
|
||||
*(pfrom+smfrom+mmin-1-imcpy);\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
29
dvm/tools/pppa/branches/dvm4.07/src/sysstat.h
Normal file
29
dvm/tools/pppa/branches/dvm4.07/src/sysstat.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef _SYSSTAT_H
|
||||
#define _SYSSTAT_H
|
||||
typedef struct {
|
||||
double CallCount;
|
||||
double ProductTime;
|
||||
double LostTime;
|
||||
}s_GRPTIMES;
|
||||
|
||||
#define StatGrpCount 18
|
||||
#define UserGrp 0
|
||||
#define MsgPasGrp 1
|
||||
#define StartRedGrp 2
|
||||
#define WaitRedGrp 3
|
||||
#define RedGrp 4
|
||||
#define StartShdGrp 5
|
||||
#define WaitShdGrp 6
|
||||
#define ShdGrp 7
|
||||
#define DistrGrp 8
|
||||
#define ReDistrGrp 9
|
||||
#define MapPLGrp 10
|
||||
#define DoPLGrp 11
|
||||
#define ProgBlockGrp 12
|
||||
#define IOGrp 13
|
||||
#define RemAccessGrp 14
|
||||
#define UserDebGrp 15
|
||||
#define StatistGrp 16
|
||||
#define SystemGrp 17
|
||||
|
||||
#endif
|
||||
296
dvm/tools/pppa/branches/dvm4.07/src/treeinter.cpp
Normal file
296
dvm/tools/pppa/branches/dvm4.07/src/treeinter.cpp
Normal file
@@ -0,0 +1,296 @@
|
||||
#define _STATFILE_
|
||||
#include "treeinter.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
extern short reverse,szsh,szd,szv,szl,torightto,torightfrom;
|
||||
// list of intervals for each processor
|
||||
CTreeInter::CTreeInter(gzFile stream,unsigned long lint,char *pbuff,
|
||||
unsigned int n,unsigned long qint,short maxn,
|
||||
char * ppn,double proct,
|
||||
int iIM,int jIM,short sore,
|
||||
unsigned char *pbuffer)
|
||||
// stream-file descriptor pointer,
|
||||
//lint- information length in bytes,
|
||||
// pbuff - beginning of the buffer at the collection stage,
|
||||
//n - processor number,
|
||||
//qint - number of intervals
|
||||
//maxn - maximal nesting level
|
||||
// ppn - processor name
|
||||
// proct - processor time
|
||||
//iIm- 0/1 sign of summing on index i
|
||||
//jIM-0/1 sign of summing on index j
|
||||
//sore - sign of summing or elements print
|
||||
//pbuffer - file gz+,data have been read
|
||||
{
|
||||
valid=TRUE;
|
||||
nproc=n;
|
||||
qinter=qint;
|
||||
maxnlev=maxn;
|
||||
curninter=1;
|
||||
pt=NULL;
|
||||
pprocname=NULL;
|
||||
sign_buffer=NULL;
|
||||
unsigned char *buffer;
|
||||
if (ppn!=NULL) {// processor name
|
||||
pprocname=new char[strlen(ppn)+1];
|
||||
if (pprocname==NULL) throw("Out of memory\n");
|
||||
strcpy(pprocname,ppn);
|
||||
}
|
||||
proctime=proct;
|
||||
// dynamically allocate memory for intervals of struct tinter_ch
|
||||
if (pbuffer==NULL) { //data had not been read
|
||||
buffer=new unsigned char[lint];
|
||||
if (buffer==NULL) throw("Out of memory\n");
|
||||
sign_buffer=buffer;
|
||||
long l=gztell(stream);
|
||||
// read interval information from file
|
||||
int s=gzread(stream,buffer,lint);
|
||||
if ((unsigned long)s!=lint) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read intervals from file, addr=%ld, length=%ld\n",
|
||||
l,lint);
|
||||
delete []sign_buffer;
|
||||
sign_buffer=NULL;
|
||||
return;
|
||||
}
|
||||
} else buffer=pbuffer;
|
||||
unsigned char *pch=buffer;
|
||||
pinter *pi=NULL;
|
||||
// allocate memory for intervals of struct ttree
|
||||
pt=new ptree[qinter];
|
||||
if (pt==NULL) throw("Out of memory\n");
|
||||
ident id;
|
||||
// calculate size of interval without name of DVM-programm
|
||||
int lintone=QI_SHORT*szsh+QI_LONG*szl+QI_VOID*szv+QI_DOUBLE*szd;
|
||||
s_GRPTIMES times[StatGrpCount][StatGrpCount];
|
||||
int a=MAKEDOUBLE(pi,times[0],nenter,QI_SHORT,QI_LONG,QI_VOID);
|
||||
a=MAKELONG(pi,nline,nline,QI_SHORT);
|
||||
for (unsigned long ll=0;ll<qinter;ll++) {
|
||||
int lt=0;
|
||||
// copy time characteristics from file
|
||||
for (int i=0;i<StatGrpCount;i++) {
|
||||
for (int j=0;j<StatGrpCount;j++) {
|
||||
times[i][j].CallCount=0.0; times[i][j].ProductTime=0.0; times[i][j].LostTime=0.0;
|
||||
CPYMEM(times[i][j].CallCount,
|
||||
pch+MAKEDOUBLE(pi,times[lt],nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(times[i][j].ProductTime,
|
||||
pch+MAKEDOUBLE(pi,times[lt+1],nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(times[i][j].LostTime,
|
||||
pch+MAKEDOUBLE(pi,times[lt+2],nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
lt=lt+3;
|
||||
}
|
||||
}
|
||||
// add information to interval matrix
|
||||
s_SendRecvTimes addinfo;
|
||||
addinfo.SendCallTime=0.0;
|
||||
addinfo.MinSendCallTime=0.0;
|
||||
addinfo.MaxSendCallTime=0.0;
|
||||
addinfo.SendCallCount=0;
|
||||
addinfo.RecvCallTime=0.0;
|
||||
addinfo.MinRecvCallTime=0.0;
|
||||
addinfo.MaxRecvCallTime=0.0;
|
||||
addinfo.RecvCallCount=0;
|
||||
CPYMEM(addinfo.SendCallTime,pch+MAKEDOUBLE(pi,SendCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.MinSendCallTime,pch+MAKEDOUBLE(pi,MinSendCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.MaxSendCallTime,pch+MAKEDOUBLE(pi,MaxSendCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.SendCallCount,pch+MAKELONG(pi,SendCallCount,nline,QI_SHORT),szl);
|
||||
CPYMEM(addinfo.RecvCallTime,pch+MAKEDOUBLE(pi,RecvCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.MinRecvCallTime,pch+MAKEDOUBLE(pi,MinRecvCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.MaxRecvCallTime,pch+MAKEDOUBLE(pi,MaxRecvCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.RecvCallCount,pch+MAKELONG(pi,RecvCallCount,nline,QI_SHORT),szl);
|
||||
id.pname=(char *)(pch+lintone);
|
||||
// copy identifier information
|
||||
id.nline=0; id.nline_end=0; id.proc=0;id.nenter=0,0; id.expr=0;id.nlev=0;
|
||||
CPYMEM(id.nline,pch+MAKELONG(pi,nline,nline,QI_SHORT),szl);
|
||||
CPYMEM(id.nline_end,pch+MAKELONG(pi,nline_end,nline,QI_SHORT),szl);
|
||||
CPYMEM(id.proc,pch+MAKELONG(pi,qproc,nline,QI_SHORT),szl);
|
||||
CPYMEM(id.nlev,pch+MAKESHORT(pi,nlev,nlev),szsh);
|
||||
CPYMEM(id.expr,pch+MAKELONG(pi,expr,nline,QI_SHORT),szl);
|
||||
CPYMEM(id.nenter,pch+MAKEDOUBLE(pi,nenter,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
short sh=0;
|
||||
CPYMEM(sh,pch+MAKESHORT(pi,type,nlev),szsh);
|
||||
id.t=(typefrag)sh;
|
||||
unsigned char *pptr=NULL;
|
||||
unsigned long l0=0;
|
||||
// copy referenses on up, down and next intervals
|
||||
CPYMEM(pptr,pch+MAKEVOID(pi,up,up,QI_SHORT,QI_LONG),szv);
|
||||
if (pptr==NULL) {memcpy(&pt[ll].up,&l0,sizeof(l0));
|
||||
} else {
|
||||
long l=(char*)pptr-pbuff;
|
||||
pptr=buffer+l;
|
||||
pt[ll].up=0;
|
||||
CPYMEM(pt[ll].up,pptr+MAKELONG(pi,ninter,nline,QI_SHORT),szl);
|
||||
}
|
||||
pptr=NULL;
|
||||
CPYMEM(pptr,pch+MAKEVOID(pi,down,up,QI_SHORT,QI_LONG),szv);
|
||||
if (pptr==NULL) {memcpy(&pt[ll].down,&l0,sizeof(l0));
|
||||
} else {
|
||||
long l=(char*)pptr-pbuff;
|
||||
pptr=buffer+l;
|
||||
pt[ll].down=0;
|
||||
CPYMEM(pt[ll].down,pptr+MAKELONG(pi,ninter,nline,QI_SHORT),szl);
|
||||
}
|
||||
pptr=NULL;
|
||||
CPYMEM(pptr,pch+MAKEVOID(pi,next,up,QI_SHORT,QI_LONG),szv);
|
||||
if (pptr==NULL) {memcpy(&pt[ll].next,&l0,sizeof(l0));
|
||||
} else {
|
||||
long l=(char *)pptr-pbuff;
|
||||
pptr=buffer+l;
|
||||
pt[ll].next=0;
|
||||
CPYMEM(pt[ll].next,pptr+MAKELONG(pi,ninter,nline,QI_SHORT),szl);
|
||||
}
|
||||
// time characteristics for each interval
|
||||
pt[ll].pint=new CInter(times,addinfo,id,ll+1,iIM,jIM,sore);
|
||||
if (pt[ll].pint==NULL) throw("Out of memory\n");
|
||||
pch=pch+lintone+1+strlen((char*)(pch+lintone));
|
||||
}
|
||||
if (sign_buffer!=NULL) {delete []sign_buffer; sign_buffer=NULL;}
|
||||
return;
|
||||
}
|
||||
//----------------------------------------
|
||||
//return result of constructor execution
|
||||
BOOL CTreeInter::Valid()
|
||||
{
|
||||
return(valid);
|
||||
}
|
||||
//-------------------------------------------
|
||||
// error message
|
||||
void CTreeInter::TextErr(char *p)
|
||||
{
|
||||
strcpy(p,texterr);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
//set current interval at the first interval
|
||||
void CTreeInter::BeginInter(void)
|
||||
{
|
||||
for (unsigned long i=0;i<qinter;i++) {
|
||||
pt[i].sign=0;
|
||||
}
|
||||
curninter=1;
|
||||
return;
|
||||
}
|
||||
//--------------------------------------------------
|
||||
//read identifier information of current interval
|
||||
void CTreeInter::NextInter(ident **id)
|
||||
{
|
||||
*id=NULL;
|
||||
for (unsigned long i=curninter;i<=qinter;i++) {
|
||||
if (pt[i-1].sign==0) {
|
||||
pt[i-1].sign=1;
|
||||
curninter=i;
|
||||
CInter *p=pt[i-1].pint;
|
||||
p->ReadIdent(id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
//------------------------------------------------
|
||||
// return pointer to interval with the same identifier information
|
||||
// set current interval
|
||||
CInter *CTreeInter::FindInter(ident *id)
|
||||
//id - identifier information
|
||||
{
|
||||
unsigned long n;
|
||||
ident *idcur;
|
||||
pt[curninter-1].pint->ReadIdent(&idcur);
|
||||
if (id==idcur) return(pt[curninter-1].pint); //the same processor
|
||||
if (id->nlev==idcur->nlev) { // the same level
|
||||
n=pt[curninter-1].up;
|
||||
if (n>0) n=pt[n-1].down;
|
||||
else n=curninter;// first interval
|
||||
while(n>0) {
|
||||
if (pt[n-1].sign==0 && pt[n-1].pint->CompIdent(id)==1) {
|
||||
pt[n-1].sign=1;
|
||||
curninter=n;
|
||||
return(pt[n-1].pint);
|
||||
}
|
||||
n=pt[n-1].next;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
// need level > current level
|
||||
n=curninter;
|
||||
if (id->nlev>idcur->nlev) {
|
||||
// find need down level
|
||||
while (id->nlev>idcur->nlev) {
|
||||
n=pt[n-1].down;
|
||||
if (n==0) return(NULL);
|
||||
pt[n-1].pint->ReadIdent(&idcur);
|
||||
}
|
||||
// find need interval on finded level
|
||||
while(n>0) {
|
||||
if (pt[n-1].sign==0 && pt[n-1].pint->CompIdent(id)==1) {
|
||||
pt[n-1].sign=1;
|
||||
curninter=n;
|
||||
return(pt[n-1].pint);
|
||||
}
|
||||
n=pt[n-1].next;
|
||||
}
|
||||
return(NULL);
|
||||
} else {
|
||||
// find need up level
|
||||
while (id->nlev<idcur->nlev) {
|
||||
n=pt[n-1].up;
|
||||
if (n==0) return(NULL);
|
||||
pt[n-1].pint->ReadIdent(&idcur);
|
||||
}
|
||||
unsigned long n1=n;
|
||||
n=pt[n-1].up;
|
||||
if (n>0) n=pt[n-1].down;else n=n1;
|
||||
while(n>0) {
|
||||
if (pt[n-1].sign==0 && pt[n-1].pint->CompIdent(id)==1) {
|
||||
pt[n-1].sign=1;
|
||||
curninter=n;
|
||||
return(pt[n-1].pint);
|
||||
}
|
||||
n=pt[n-1].next;
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
//--------------------------------------------------
|
||||
//sum time characteristics
|
||||
void CTreeInter::SumLevel(void)
|
||||
{
|
||||
for (short i=maxnlev;i>0;i--) {
|
||||
for (unsigned long j=0;j<qinter;j++) {
|
||||
ident *id;
|
||||
pt[j].pint->ReadIdent(&id);
|
||||
if (id->nlev==i) {
|
||||
// psum - up level
|
||||
unsigned long up=pt[j].up;
|
||||
CInter *psum=pt[up-1].pint;
|
||||
pt[j].pint->SumInter(psum);
|
||||
}
|
||||
}
|
||||
}
|
||||
pt[0].pint->SumInter(NULL);
|
||||
}
|
||||
//---------------------------------------------------
|
||||
//processor time
|
||||
void CTreeInter::ReadProcTime(double &time)
|
||||
{
|
||||
time=proctime;
|
||||
}
|
||||
//---------------------------------------------------
|
||||
//processor name
|
||||
void CTreeInter::ReadProcName(char **name)
|
||||
{
|
||||
*name=pprocname;
|
||||
}
|
||||
//--------------------------------------------------
|
||||
// deallocate memory for tree interval
|
||||
CTreeInter::~CTreeInter()
|
||||
{
|
||||
if (pprocname!=NULL) delete []pprocname;
|
||||
if (sign_buffer!=NULL) delete []sign_buffer;
|
||||
if (pt==NULL) return;
|
||||
for (unsigned long i=0;i<qinter;i++) {
|
||||
if (pt[i].pint!=NULL) pt[i].pint->~CInter();
|
||||
pt[i].pint=NULL;
|
||||
}
|
||||
delete []pt;
|
||||
}
|
||||
63
dvm/tools/pppa/branches/dvm4.07/src/treeinter.h
Normal file
63
dvm/tools/pppa/branches/dvm4.07/src/treeinter.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef _TREEINTER_H
|
||||
#define _TREEINTER_H
|
||||
#include "zlib.h"
|
||||
#include "inter.h"
|
||||
#include "strall.h"
|
||||
#include "stdio.h"
|
||||
#include "bool.h"
|
||||
typedef struct ttree{
|
||||
unsigned long up,next,down;
|
||||
int sign;
|
||||
CInter *pint;
|
||||
} ptree;
|
||||
struct inter_short{
|
||||
short nlev,type;
|
||||
};
|
||||
struct inter_long{
|
||||
unsigned long nline,nline_end,expr,qproc,ninter,SendCallCount,RecvCallCount;
|
||||
};
|
||||
struct inter_void{
|
||||
void *up,*next,*down,*ptimes;
|
||||
};
|
||||
struct inter_double{
|
||||
double nenter,SendCallTime,MinSendCallTime,
|
||||
MaxSendCallTime,RecvCallTime,MinRecvCallTime,
|
||||
MaxRecvCallTime,
|
||||
times[3*StatGrpCount*StatGrpCount];
|
||||
};
|
||||
typedef struct tinter {
|
||||
inter_double d;
|
||||
inter_void v;
|
||||
inter_long l;
|
||||
inter_short sh;
|
||||
}pinter;
|
||||
#define QI_SHORT sizeof(inter_short)/SZSH
|
||||
#define QI_LONG sizeof(inter_long)/SZL
|
||||
#define QI_VOID sizeof(inter_void)/SZV
|
||||
#define QI_DOUBLE sizeof(inter_double)/SZD
|
||||
class CTreeInter {
|
||||
public:
|
||||
CTreeInter(gzFile stream,unsigned long lint,char* pbuf,unsigned int n,
|
||||
unsigned long qfrag,short maxn,char * ppn,double proct,int i,int j,short sore,unsigned char *pbuffer);
|
||||
~CTreeInter();
|
||||
BOOL Valid();
|
||||
void TextErr(char *t);
|
||||
void BeginInter(void);
|
||||
void NextInter(ident **p);
|
||||
CInter *FindInter(ident *id);
|
||||
void SumLevel(void);
|
||||
void ReadProcTime(double &time);
|
||||
void ReadProcName(char **name);
|
||||
ptree (*pt);
|
||||
protected:
|
||||
unsigned int nproc;
|
||||
unsigned long qinter;
|
||||
unsigned long curninter;
|
||||
short maxnlev;
|
||||
BOOL valid;
|
||||
char texterr[80];
|
||||
char *pprocname;
|
||||
unsigned char * sign_buffer;
|
||||
double proctime;
|
||||
};
|
||||
#endif
|
||||
8
dvm/tools/pppa/branches/dvm4.07/src/ver.h
Normal file
8
dvm/tools/pppa/branches/dvm4.07/src/ver.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef VER_H
|
||||
#define VER_H
|
||||
|
||||
#define VER_PPPA "Analyzer 2.6,(c) 02.02.2010"
|
||||
#define RTS_VERSION "RTS VERSION = 2871"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user