summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-12-03 21:04:07 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-12-03 21:04:07 (GMT)
commite30b98d7fbffc23065435c2b475fb5fce563afb6 (patch)
tree7d9e01f661a560c7fcfdf58ea23700e289b532cc
parent6e1ab59a750da75acec98ee519de16729cb0795e (diff)
downloadhdf5-e30b98d7fbffc23065435c2b475fb5fce563afb6.zip
hdf5-e30b98d7fbffc23065435c2b475fb5fce563afb6.tar.gz
hdf5-e30b98d7fbffc23065435c2b475fb5fce563afb6.tar.bz2
[svn-r4665] Purpose:
Code cleanup Description: Changed the logging file driver to use bitmasked flags for features to enable, instead of using a verbosity level. Platforms tested: Solaris 2.6 (baldric)
-rw-r--r--src/H5FDlog.c273
-rw-r--r--src/H5FDlog.h30
-rw-r--r--test/h5test.c6
3 files changed, 193 insertions, 116 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index a9f76af..f04b0c6 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -24,15 +24,11 @@
#include "H5MMprivate.h" /* Memory allocation */
#include "H5Pprivate.h" /*property lists */
-
#ifdef MAX
#undef MAX
#define MAX(X,Y) ((X)>(Y)?(X):(Y))
#endif /* MAX */
-/* The size of the buffer to track allocation requests */
-#define TRACK_BUFFER 130*(1024*1024)
-
/* The driver identification number, initialized at runtime */
static hid_t H5FD_LOG_g = 0;
@@ -43,8 +39,9 @@ static hid_t H5FD_LOG_g = 0;
/* Driver-specific file access properties */
typedef struct H5FD_log_fapl_t {
- char *logfile; /* Allocated log file name */
- int verbosity; /* Verbosity of logging information */
+ char *logfile; /* Allocated log file name */
+ unsigned flags; /* Flags for logging behavior */
+ size_t buf_size; /* Size of buffers for track flavor and number of times each byte is accessed */
} H5FD_log_fapl_t;
/* Define strings for the different file memory types */
@@ -277,20 +274,21 @@ H5FD_log_init(void)
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_fapl_log(hid_t fapl_id, char *logfile, int verbosity)
+H5Pset_fapl_log(hid_t fapl_id, char *logfile, unsigned flags, size_t buf_size)
{
H5FD_log_fapl_t fa; /* File access property list information */
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=FAIL;
FUNC_ENTER(H5Pset_fapl_log, FAIL);
- H5TRACE3("e","isIs",fapl_id,logfile,verbosity);
+ H5TRACE3("e","isIu",fapl_id,logfile,flags);
if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id)))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
- fa.logfile = logfile;
- fa.verbosity=verbosity;
+ fa.logfile=logfile;
+ fa.flags=flags;
+ fa.buf_size=buf_size;
ret_value= H5P_set_driver(plist, H5FD_LOG, &fa);
FUNC_LEAVE(ret_value);
@@ -479,18 +477,24 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
file->inode = sb.st_ino;
#endif
- /* Get the verbosity of the logging */
- file->fa.verbosity=fa->verbosity;
+ /* Get the flags for logging */
+ file->fa.flags=fa->flags;
/* Check if we are doing any logging at all */
- if(file->fa.verbosity>=0) {
- file->iosize=TRACK_BUFFER; /* Default size for now */
- file->nread=H5MM_calloc(file->iosize);
- assert(file->nread);
- file->nwrite=H5MM_calloc(file->iosize);
- assert(file->nwrite);
- file->flavor=H5MM_calloc(file->iosize);
- assert(file->flavor);
+ if(file->fa.flags!=0) {
+ file->iosize=file->fa.buf_size;
+ if(file->fa.flags&H5FD_LOG_NUM_READ) {
+ file->nread=H5MM_calloc(file->iosize);
+ assert(file->nread);
+ } /* end if */
+ if(file->fa.flags&H5FD_LOG_NUM_WRITE) {
+ file->nwrite=H5MM_calloc(file->iosize);
+ assert(file->nwrite);
+ } /* end if */
+ if(file->fa.flags&H5FD_LOG_FLAVOR) {
+ file->flavor=H5MM_calloc(file->iosize);
+ assert(file->flavor);
+ } /* end if */
if(fa->logfile)
file->logfp=HDfopen(fa->logfile,"w");
else
@@ -498,7 +502,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
} /* end if */
FUNC_LEAVE((H5FD_t*)file);
-}
+} /* end H5FD_log_open() */
/*-------------------------------------------------------------------------
@@ -532,80 +536,93 @@ H5FD_log_close(H5FD_t *_file)
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to flush file");
#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&timeval_start,NULL);
+ if(file->fa.flags&H5FD_LOG_TIME_CLOSE)
+ HDgettimeofday(&timeval_start,NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
if (close(file->fd)<0)
HRETURN_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file");
#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&timeval_stop,NULL);
+ if(file->fa.flags&H5FD_LOG_TIME_CLOSE)
+ HDgettimeofday(&timeval_stop,NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Dump I/O information */
- if(file->fa.verbosity>=0) {
+ if(file->fa.flags!=0) {
haddr_t addr;
haddr_t last_addr;
unsigned char last_val;
#ifdef H5_HAVE_GETTIMEOFDAY
- /* Calculate the elapsed gettimeofday time */
- timeval_diff.tv_usec=timeval_stop.tv_usec-timeval_start.tv_usec;
- timeval_diff.tv_sec=timeval_stop.tv_sec-timeval_start.tv_sec;
- if(timeval_diff.tv_usec<0) {
- timeval_diff.tv_usec+=1000000;
- timeval_diff.tv_sec--;
- } /* end if */
- HDfprintf(file->logfp,"Close took: (%f s)\n",(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0));
+ if(file->fa.flags&H5FD_LOG_TIME_CLOSE) {
+ /* Calculate the elapsed gettimeofday time */
+ timeval_diff.tv_usec=timeval_stop.tv_usec-timeval_start.tv_usec;
+ timeval_diff.tv_sec=timeval_stop.tv_sec-timeval_start.tv_sec;
+ if(timeval_diff.tv_usec<0) {
+ timeval_diff.tv_usec+=1000000;
+ timeval_diff.tv_sec--;
+ } /* end if */
+ HDfprintf(file->logfp,"Close took: (%f s)\n",(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0));
+ } /* end if */
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Dump the write I/O information */
- HDfprintf(file->logfp,"Dumping write I/O information:\n");
- last_val=file->nwrite[0];
- last_addr=0;
- addr=1;
- while(addr<file->eoa) {
- if(file->nwrite[addr]!=last_val) {
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) written to %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
- last_val=file->nwrite[addr];
- last_addr=addr;
- } /* end if */
- addr++;
- } /* end while */
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) written to %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
+ if(file->fa.flags&H5FD_LOG_FILE_WRITE) {
+ HDfprintf(file->logfp,"Dumping write I/O information:\n");
+ last_val=file->nwrite[0];
+ last_addr=0;
+ addr=1;
+ while(addr<file->eoa) {
+ if(file->nwrite[addr]!=last_val) {
+ HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) written to %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
+ last_val=file->nwrite[addr];
+ last_addr=addr;
+ } /* end if */
+ addr++;
+ } /* end while */
+ HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) written to %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
+ } /* end if */
/* Dump the read I/O information */
- HDfprintf(file->logfp,"Dumping read I/O information:\n");
- last_val=file->nread[0];
- last_addr=0;
- addr=1;
- while(addr<file->eoa) {
- if(file->nread[addr]!=last_val) {
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) read from %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
- last_val=file->nread[addr];
- last_addr=addr;
- } /* end if */
- addr++;
- } /* end while */
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) read from %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
+ if(file->fa.flags&H5FD_LOG_FILE_READ) {
+ HDfprintf(file->logfp,"Dumping read I/O information:\n");
+ last_val=file->nread[0];
+ last_addr=0;
+ addr=1;
+ while(addr<file->eoa) {
+ if(file->nread[addr]!=last_val) {
+ HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) read from %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
+ last_val=file->nread[addr];
+ last_addr=addr;
+ } /* end if */
+ addr++;
+ } /* end while */
+ HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) read from %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
+ } /* end if */
/* Dump the I/O flavor information */
- HDfprintf(file->logfp,"Dumping I/O flavor information:\n");
- last_val=file->flavor[0];
- last_addr=0;
- addr=1;
- while(addr<file->eoa) {
- if(file->flavor[addr]!=last_val) {
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) flavor is %s\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),flavors[last_val]);
- last_val=file->flavor[addr];
- last_addr=addr;
- } /* end if */
- addr++;
- } /* end while */
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) flavor is %s\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),flavors[last_val]);
+ if(file->fa.flags&H5FD_LOG_FLAVOR) {
+ HDfprintf(file->logfp,"Dumping I/O flavor information:\n");
+ last_val=file->flavor[0];
+ last_addr=0;
+ addr=1;
+ while(addr<file->eoa) {
+ if(file->flavor[addr]!=last_val) {
+ HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) flavor is %s\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),flavors[last_val]);
+ last_val=file->flavor[addr];
+ last_addr=addr;
+ } /* end if */
+ addr++;
+ } /* end while */
+ HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) flavor is %s\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),flavors[last_val]);
+ } /* end if */
/* Free the logging information */
- file->nwrite=H5MM_xfree(file->nwrite);
- file->nread=H5MM_xfree(file->nread);
- file->flavor=H5MM_xfree(file->flavor);
+ if(file->fa.flags&H5FD_LOG_FILE_WRITE)
+ file->nwrite=H5MM_xfree(file->nwrite);
+ if(file->fa.flags&H5FD_LOG_FILE_READ)
+ file->nread=H5MM_xfree(file->nread);
+ if(file->fa.flags&H5FD_LOG_FLAVOR)
+ file->flavor=H5MM_xfree(file->flavor);
if(file->logfp!=stderr)
fclose(file->logfp);
} /* end if */
@@ -747,13 +764,15 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hsize_t size)
printf("%s: flavor=%s, size=%lu\n",FUNC,flavors[type],(unsigned long)size);
#endif /* QAK */
/* Retain the (first) flavor of the information written to the file */
- if(file->fa.verbosity>=0) {
- assert(addr<file->iosize);
- H5_CHECK_OVERFLOW(size,hsize_t,size_t);
- HDmemset(&file->flavor[addr],type,(size_t)size);
+ if(file->fa.flags!=0) {
+ if(file->fa.flags&H5FD_LOG_FLAVOR) {
+ assert(addr<file->iosize);
+ H5_CHECK_OVERFLOW(size,hsize_t,size_t);
+ HDmemset(&file->flavor[addr],type,(size_t)size);
+ } /* end if */
- if(file->fa.verbosity>1)
- HDfprintf(file->logfp,"%10a-%10a (%10lu bytes) Allocated, flavor=%s\n",addr,addr+size-1,(unsigned long)size,flavors[file->flavor[addr]]);
+ if(file->fa.flags&H5FD_LOG_ALLOC)
+ HDfprintf(file->logfp,"%10a-%10a (%10Hu bytes) Allocated, flavor=%s\n",addr,addr+size-1,size,flavors[type]);
} /* end if */
FUNC_LEAVE(addr);
@@ -891,30 +910,39 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr
HRETURN_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow");
/* Log the I/O information about the read */
- if(file->fa.verbosity>=0) {
+ if(file->fa.flags!=0) {
size_t tmp_size=size;
haddr_t tmp_addr=addr;
- assert((addr+size)<file->iosize);
- while(tmp_size-->0)
- file->nread[tmp_addr++]++;
+ /* Log information about the number of times these locations are read */
+ if(file->fa.flags&H5FD_LOG_FILE_READ) {
+ assert((addr+size)<file->iosize);
+ while(tmp_size-->0)
+ file->nread[tmp_addr++]++;
+ } /* end if */
/* Log information about the seek, if it's going to occur */
- if(file->fa.verbosity>1 && (addr!=file->pos || OP_READ!=file->op))
- HDfprintf(file->logfp,"Seek: From %10a To %10a\n",file->pos,addr);
+ if(file->fa.flags&H5FD_LOG_LOC_SEEK) {
+ if(addr!=file->pos || OP_READ!=file->op)
+ HDfprintf(file->logfp,"Seek: From %10a To %10a\n",file->pos,addr);
+ } /* end if */
/* Log information about the read */
- if(file->fa.verbosity>0)
- HDfprintf(file->logfp,"%10a-%10a (%10lu bytes) Read, flavor=%s\n",addr,addr+size-1,(unsigned long)size,flavors[file->flavor[addr]]);
- }
+ if(file->fa.flags&H5FD_LOG_LOC_READ) {
+ /* Output the flavor information, if we have it */
+ if(file->fa.flags&H5FD_LOG_FLAVOR)
+ HDfprintf(file->logfp,"%10a-%10a (%10Zu bytes) Read, flavor=%s\n",addr,addr+size-1,size,flavors[file->flavor[addr]]);
+ else
+ HDfprintf(file->logfp,"%10a-%10a (%10Zu bytes) Read\n",addr,addr+size-1,size);
+ } /* end if */
+ } /* end if */
/* Seek to the correct location */
if ((addr!=file->pos || OP_READ!=file->op) &&
file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) {
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- HRETURN_ERROR(H5E_IO, H5E_SEEKERROR, FAIL,
- "unable to seek to proper position");
+ HRETURN_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position");
}
/*
@@ -969,7 +997,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr,
+H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr,
size_t size, const void *buf)
{
H5FD_log_t *file = (H5FD_log_t*)_file;
@@ -1000,7 +1028,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
HRETURN_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow");
/* Log the I/O information about the write */
- if(file->fa.verbosity>=0) {
+ if(file->fa.flags&H5FD_LOG_FILE_WRITE) {
size_t tmp_size=size;
haddr_t tmp_addr=addr;
@@ -1012,31 +1040,36 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
/* Seek to the correct location */
if (addr!=file->pos || OP_WRITE!=file->op) {
#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&timeval_start,NULL);
+ if(file->fa.flags&H5FD_LOG_TIME_SEEK)
+ HDgettimeofday(&timeval_start,NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
if(file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) {
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- HRETURN_ERROR(H5E_IO, H5E_SEEKERROR, FAIL,
- "unable to seek to proper position");
+ HRETURN_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position");
} /* end if */
#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&timeval_stop,NULL);
+ if(file->fa.flags&H5FD_LOG_TIME_SEEK)
+ HDgettimeofday(&timeval_stop,NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Log information about the seek */
- if(file->fa.verbosity>1) {
+ if(file->fa.flags&H5FD_LOG_LOC_SEEK) {
+ HDfprintf(file->logfp,"Seek: From %10a To %10a",file->pos,addr);
#ifdef H5_HAVE_GETTIMEOFDAY
- /* Calculate the elapsed gettimeofday time */
- timeval_diff.tv_usec=timeval_stop.tv_usec-timeval_start.tv_usec;
- timeval_diff.tv_sec=timeval_stop.tv_sec-timeval_start.tv_sec;
- if(timeval_diff.tv_usec<0) {
- timeval_diff.tv_usec+=1000000;
- timeval_diff.tv_sec--;
- } /* end if */
- HDfprintf(file->logfp,"Seek: From %10a To %10a (%f s)\n",file->pos,addr,(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0));
+ if(file->fa.flags&H5FD_LOG_TIME_SEEK) {
+ /* Calculate the elapsed gettimeofday time */
+ timeval_diff.tv_usec=timeval_stop.tv_usec-timeval_start.tv_usec;
+ timeval_diff.tv_sec=timeval_stop.tv_sec-timeval_start.tv_sec;
+ if(timeval_diff.tv_usec<0) {
+ timeval_diff.tv_usec+=1000000;
+ timeval_diff.tv_sec--;
+ } /* end if */
+ HDfprintf(file->logfp," (%f s)\n",(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0));
+ } /* end if */
+ else
#else /* H5_HAVE_GETTIMEOFDAY */
- HDfprintf(file->logfp,"Seek: From %10a To %10a\n",file->pos,addr);
+ HDfprintf(file->logfp,"\n");
#endif /* H5_HAVE_GETTIMEOFDAY */
} /* end if */
} /* end if */
@@ -1046,6 +1079,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
* results
*/
#ifdef H5_HAVE_GETTIMEOFDAY
+ if(file->fa.flags&H5FD_LOG_TIME_WRITE)
HDgettimeofday(&timeval_start,NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
while (size>0) {
@@ -1056,6 +1090,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
/* error */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
+ if(file->fa.flags&H5FD_LOG_LOC_WRITE)
+ HDfprintf(file->logfp,"Error! Writing: %10a-%10a (%10Zu bytes)\n",orig_addr,orig_addr+orig_size-1,orig_size);
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed");
}
assert(nbytes>0);
@@ -1065,15 +1101,26 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
buf = (const char*)buf + nbytes;
}
#ifdef H5_HAVE_GETTIMEOFDAY
+ if(file->fa.flags&H5FD_LOG_TIME_WRITE)
HDgettimeofday(&timeval_stop,NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Log information about the write */
- if(file->fa.verbosity>0) {
+ if(file->fa.flags&H5FD_LOG_LOC_WRITE) {
+ /* Output the flavor information, if desired */
+ if(file->fa.flags&H5FD_LOG_FLAVOR)
+ HDfprintf(file->logfp,"%10a-%10a (%10Zu bytes) (%s) Written",orig_addr,orig_addr+orig_size-1,orig_size,flavors[file->flavor[orig_addr]]);
+ else
+ HDfprintf(file->logfp,"%10a-%10a (%10Zu bytes) Written",orig_addr,orig_addr+orig_size-1,orig_size);
+
/* Check if this is the first write into a "default" section, grabbed by the metadata agregation algorithm */
- if(file->flavor[orig_addr]==H5FD_MEM_DEFAULT)
- HDmemset(&file->flavor[orig_addr],type,orig_size);
+ if(file->fa.flags&H5FD_LOG_FLAVOR) {
+ if(file->flavor[orig_addr]==H5FD_MEM_DEFAULT)
+ HDmemset(&file->flavor[orig_addr],type,orig_size);
+ } /* end if */
+
#ifdef H5_HAVE_GETTIMEOFDAY
+ if(file->fa.flags&H5FD_LOG_TIME_WRITE) {
/* Calculate the elapsed gettimeofday time */
timeval_diff.tv_usec=timeval_stop.tv_usec-timeval_start.tv_usec;
timeval_diff.tv_sec=timeval_stop.tv_sec-timeval_start.tv_sec;
@@ -1081,9 +1128,11 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
timeval_diff.tv_usec+=1000000;
timeval_diff.tv_sec--;
} /* end if */
- HDfprintf(file->logfp,"%10a-%10a (%10lu bytes) (%s) Written (%f s)\n",orig_addr,orig_addr+orig_size-1,(unsigned long)orig_size,flavors[file->flavor[orig_addr]],(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0));
+ HDfprintf(file->logfp," (%f s)\n",(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0));
+ } /* end if */
+ else
#else /* H5_HAVE_GETTIMEOFDAY */
- HDfprintf(file->logfp,"%10a-%10a (%10lu bytes) (%s) Written\n",orig_addr,orig_addr+orig_size-1,(unsigned long)orig_size,flavors[file->flavor[orig_addr]]);
+ HDfprintf(file->logfp,"\n");
#endif /* H5_HAVE_GETTIMEOFDAY */
} /* end if */
diff --git a/src/H5FDlog.h b/src/H5FDlog.h
index 65d1222..9319999 100644
--- a/src/H5FDlog.h
+++ b/src/H5FDlog.h
@@ -14,12 +14,40 @@
#define H5FD_LOG (H5FD_log_init())
+/* Flags for H5Pset_fapl_log() */
+/* Flags for tracking where reads/writes/seeks occur */
+#define H5FD_LOG_LOC_READ 0x0001
+#define H5FD_LOG_LOC_WRITE 0x0002
+#define H5FD_LOG_LOC_SEEK 0x0004
+#define H5FD_LOG_LOC_IO (H5FD_LOG_LOC_READ|H5FD_LOG_LOC_WRITE|H5FD_LOG_LOC_SEEK)
+/* Flags for tracking number of times each byte is read/written */
+#define H5FD_LOG_FILE_READ 0x0008
+#define H5FD_LOG_FILE_WRITE 0x0010
+#define H5FD_LOG_FILE_IO (H5FD_LOG_FILE_READ|H5FD_LOG_FILE_WRITE)
+/* Flag for tracking "flavor" (type) of information stored at each byte */
+#define H5FD_LOG_FLAVOR 0x0020
+/* Flags for tracking total number of reads/writes/seeks */
+#define H5FD_LOG_NUM_READ 0x0040
+#define H5FD_LOG_NUM_WRITE 0x0080
+#define H5FD_LOG_NUM_SEEK 0x0100
+#define H5FD_LOG_NUM_IO (H5FD_LOG_NUM_READ|H5FD_LOG_NUM_WRITE|H5FD_LOG_NUM_SEEK)
+/* Flags for tracking time spent in open/read/write/seek/close */
+#define H5FD_LOG_TIME_OPEN 0x0200 /* Not implemented yet */
+#define H5FD_LOG_TIME_READ 0x0400 /* Not implemented yet */
+#define H5FD_LOG_TIME_WRITE 0x0800 /* Partially implemented (need to track total time) */
+#define H5FD_LOG_TIME_SEEK 0x1000 /* Partially implemented (need to track total time & track time for seeks during reading) */
+#define H5FD_LOG_TIME_CLOSE 0x2000 /* Fully implemented */
+#define H5FD_LOG_TIME_IO (H5FD_LOG_TIME_OPEN|H5FD_LOG_TIME_READ|H5FD_LOG_TIME_WRITE|H5FD_LOG_TIME_SEEK|H5FD_LOG_TIME_CLOSE)
+/* Flag for tracking allocation of space in file */
+#define H5FD_LOG_ALLOC 0x4000
+#define H5FD_LOG_ALL (H5FD_LOG_ALLOC|H5FD_LOG_TIME_IO|H5FD_LOG_NUM_IO|H5FD_LOG_FLAVOR|H5FD_LOG_FILE_IO|H5FD_LOG_LOC_IO)
+
#ifdef __cplusplus
extern "C" {
#endif
__DLL__ hid_t H5FD_log_init(void);
-__DLL__ herr_t H5Pset_fapl_log(hid_t fapl_id, char *logfile, int verbosity);
+__DLL__ herr_t H5Pset_fapl_log(hid_t fapl_id, char *logfile, unsigned flags, size_t buf_size);
#ifdef __cplusplus
}
diff --git a/test/h5test.c b/test/h5test.c
index 05df6c1..62fdc90 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -393,7 +393,7 @@ h5_fileaccess(void)
char s[1024];
hid_t fapl = -1;
hsize_t fam_size = 100*1024*1024; /*100 MB*/
- long verbosity = 1;
+ long log_flags = H5FD_LOG_LOC_IO;
H5FD_mem_t mt;
/* First use the environment variable, then the constant */
@@ -458,9 +458,9 @@ h5_fileaccess(void)
} else if (!HDstrcmp(name, "log")) {
/* Log file access */
if ((val = HDstrtok(NULL, " \t\n\r")))
- verbosity = HDstrtol(val, NULL, 0);
+ log_flags = HDstrtol(val, NULL, 0);
- if (H5Pset_fapl_log(fapl, NULL, (int)verbosity) < 0)
+ if (H5Pset_fapl_log(fapl, NULL, log_flags, 0) < 0)
return -1;
} else {
/* Unknown driver */