⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tdump.c

📁 Parallel programming/Lou Baker, Bradley J.Smith .—New York:McGraw-Hill Book Co.
💻 C
字号:
/* routines to implement a picl
-style tracing feature
  NOT compatible with ParaGraph!

  L. Baker	DAGONET SOFTWARE 11/93


assumes an external  char *CurDir;


HOST = MASTER  in Master/Slave model (assumed)


caveat: recv has only 1023 bytes for msg! might have to up this.
Also, potential problems if "host" does not generate traces often
to recover trace messages from other slave nodes.


*/

#define PICLCODE
#define DEBUG

/*#define TRUEPVM*/

/*#define TRUEMPI*/

#include <time.h>
#include <stdio.h>

char *CurDir="baker";/* dummy for now*/

/* below only for node zero. wasted space otherwise. Not much though*/

#define NAMESIZE 60
static char TraceFileName[NAMESIZE];
static FILE *TraceFileP=NULL;
static long int tracekt= 0l;

#define MaxCurDirS 20


typedef time_t Time; /* UNIX time: good to milliseconds */

typedef int MSGTYPE;
struct traceitem
	{
	Time  when;
	int what;
	int   who;/*rank*/
	char  where[MaxCurDirS];
	};

#define isize sizeof(struct traceitem)
static char event[17][11]={"SEND Start","END Send ",
     "START Recv","END Recv  ","Open Trace","Clse Trace",
     "FLUSH Strt","FLUSH EndT","LEVEL Chng","START Trce","END Trce  ",
     "START Barr","END Barr  ","User Msg: ","START Wait","END Wait  ",
     "NULL Msg  "};
FILE *in,*out;

main(int argc,char **argv)
{
/*convert a trace.out file into a file to be sorted and dumped */
int size;
struct traceitem data;
char str[21],*whats;
in=fopen("trace.out","rb");
out=fopen("trace.prc","w");
if(in==NULL||out==NULL)exit(0);
while(1)
	{
        size=fread(&data,isize,1,in);
	if(!size)break;
	strncpy(&str,&(data.where),20);
	str[21]='\000';
	/*fprintf(out,"%d %d %d %s\n",data->when,data->who,data->what,&str);*/
        whats =&( event[data.what-1][0]);	
	fprintf(out,"%d %d %s %s\n",data.when,data.who,whats,&str);
	}
fclose(in);
fclose(out);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -