From cc2184b6efd25633b8a27cb23d57380e2f28a5b4 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Fri, 30 Apr 1999 10:54:52 -0500 Subject: [svn-r1240] Changes since 19990427 ---------------------- ./tools/h5ls.c Added a `--address' (`-a') switch which causes h5ls to display file addresses for raw data. For contiguous datasets it's just a nice simple number, but for chunked datasets it's a list of logical dataset coordinates, file addresses, filter masks, and storage sizes. Changed `--dump' switch to `--data'. ./src/H5D.c ./src/H5F.c ./src/H5Fprivate.h Enhanced the indexed-storage B-tree iterator so it can dump raw data addresses (and other info) to the standard error stream. Added H5Ddebug() so h5ls has a way to dump addresses for datasets. I'm not sure what else this API function should do, so I think we should discuss it before we document it. So far, h5ls is the only thing that uses it, and we can easily change that. ./src/H5Tconv.c ./test/dtypes.c Finally had a chance to verify Paul's H5T_conv_s_s (general string to string conversions) bug fixes and incorporate them into H5T_conv_f_f (general floating-point to floating-point conversions) and H5T_conv_i_i (general integer to integer conversons). Thanks Paul. ./src/H5D.c ./src/H5S.c ./src/H5Sprivate.h Added performance timers around data space read and write callbacks. They were already there for the gather/scatter callbacks. The timings for read/write callbacks are displayed along with gather/scatter when data space debugging is turned on. ./bin/iostats Updated to print totals. Added a `--fast' option that doesn't do any output except the totals and is much faster. ./bin/trace Changed __unused__ to UNUSED to match source code. ./config/gnu-flags Updated error message for pgcc. I've sent bug reports to the pgcc people but the new version still has the same bug. ./configure.in ./config/conclude.in ./config/depend.in Fixed dependencies for non-GNU makes when run in a directory other than the hdf5 source tree. Updated GNU `make dep' rules to copy the distributed dependencies for non-GNU makes into the source tree when run in some other directory. --- bin/iostats | 88 +++++++++++++++++++++++++++-------------- bin/trace | 2 +- config/conclude.in | 2 + config/depend.in | 2 +- config/gnu-flags | 8 ++-- configure | 12 +++++- configure.in | 8 +++- src/.distdep | 112 ++++++++++++++++++++++++++--------------------------- src/H5D.c | 61 +++++++++++++++++++++++++++++ src/H5Distore.c | 60 +++++++++++++++++++++++++++- src/H5Dpublic.h | 1 + src/H5F.c | 2 - src/H5Fistore.c | 60 +++++++++++++++++++++++++++- src/H5Fprivate.h | 23 ++++++----- src/H5S.c | 36 ++++++++++++++++- src/H5Sprivate.h | 6 +++ src/H5Tconv.c | 25 +++++++----- test/.distdep | 66 +++++++++++++++---------------- test/dtypes.c | 54 ++++++++++++++++++++++++++ tools/h5ls.c | 26 +++++++++---- 20 files changed, 491 insertions(+), 163 deletions(-) diff --git a/bin/iostats b/bin/iostats index d55d550..0e96e29 100755 --- a/bin/iostats +++ b/bin/iostats @@ -3,51 +3,81 @@ # Usage: pipe the output of Linux's `strace' program into the stdin of # this command, and the output of this command into gnuplot. +my ($fast,$npasses); +if ($ARGV[0] =~ /^--?fast$/) { + $fast = 1; + shift; +} + my $filename = shift || "tstab2.h5"; my $total = 0; my %What; # What{pos}{nbytes}{r|w} = naccesses +my($total_writes, $total_bytes_out, $total_reads, $total_bytes_in); while (<>) { - if (!defined $fd) { - if (/^open\("(.*?)".*=\s+(\d+)/ && $1 eq $filename) { - $fd = $2; - $pos = 0; - } - } elsif (/^close\((\d+)/ && $1==$fd) { - $fd = undef; - } elsif (/^lseek\((\d+), -?\d+,.*= (\d+)/ && - $1==$fd && $2>=0) { - $pos = $2; - } elsif (/^lseek\((\d+),/ && $1==$fd) { - die $_; - } elsif (/^write\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ && - $1==$fd && $3>=0) { - my $nbytes = $3; + if (!defined $fd) { + if (/^open\("(.*?)".*=\s+(\d+)/ && $1 eq $filename) { + $fd = $2; + $pos = 0; + } + } elsif (/^close\((\d+)/ && $1==$fd) { + $fd = undef; + } elsif (!$fast && + /^lseek\((\d+), -?\d+,.*= (\d+)/ && + $1==$fd && $2>=0) { + $pos = $2; + } elsif (!$fast && /^lseek\((\d+),/ && $1==$fd) { + die $_; + } elsif (/^write\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ && + $1==$fd && $3>=0) { + my $nbytes = $3; + if ($fast) { + $total_writes++; + $total_bytes_out += $nbytes; + } else { $What{$pos}{$nbytes}{w}++; printf "%d %d\n", $total, $pos; $pos += $nbytes; $total += $nbytes; - } elsif (/^write\((\d+),/ && $1==$fd) { - die $_; - } elsif (/^read\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ && - $1==$fd && $3>=0) { - my $nbytes = $3; + } + } elsif (/^write\((\d+),/ && $1==$fd) { + die $_; + } elsif (/^read\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ && + $1==$fd && $3>=0) { + my $nbytes = $3; + if ($fast) { + $total_reads++; + $total_bytes_in += $nbytes; + } else { $What{$pos}{$nbytes}{r}++; printf "%d %d\n", $total, $pos; $pos += $nbytes; $total += $nbytes; - } elsif (/^read\((\d+),/ && $1==$fd) { - die $_; - } + } + } elsif (/^read\((\d+),/ && $1==$fd) { + die $_; + } } -print "="x36, "\n"; +if (!$fast) { + print "="x36, "\n"; printf "%8s %8s %8s %8s\n","Position","NBytes","NReads","NWrites"; -for $pos (sort {$a<=>$b} keys %What) { - for $nbytes (sort {$a<=>$b} keys %{$What{$pos}}) { - printf "%8d %8d %8d %8d\n", $pos, $nbytes, - $What{$pos}{$nbytes}{r}, - $What{$pos}{$nbytes}{w}; + for $pos (sort {$a<=>$b} keys %What) { + for $nbytes (sort {$a<=>$b} keys %{$What{$pos}}) { + printf("%8d %8d %8d %8d\n", $pos, $nbytes, + $What{$pos}{$nbytes}{r}, + $What{$pos}{$nbytes}{w}); + $total_writes += $What{$pos}{$nbytes}{w}; + $total_reads += $What{$pos}{$nbytes}{r}; + $total_bytes_out += $What{$pos}{$nbytes}{w} * $nbytes; + $total_bytes_in += $What{$pos}{$nbytes}{r} * $nbytes; + } } } + +print "="x36, "\n"; +printf("Write: %8d calls, %10d total bytes, %10g average bytes\n", + $total_writes, $total_bytes_out, $total_bytes_out/$total_writes); +printf("Read: %8d calls, %10d total bytes, %10g average bytes\n", + $total_reads, $total_bytes_in, $total_bytes_in/$total_reads); diff --git a/bin/trace b/bin/trace index dfc14c2..aa4f3ca 100755 --- a/bin/trace +++ b/bin/trace @@ -92,7 +92,7 @@ sub argstring ($$$) { # Normalize the data type by removing redundant white space, # certain type qualifiers, and indirection. $atype =~ s/^\bconst\b//; - $atype =~ s/\b__unused__\b//g; + $atype =~ s/\bUNUSED\b//g; $atype =~ s/\s+/ /g; $ptr = length $1 if $atype =~ s/(\*+)//; $atype =~ s/^\s+//; diff --git a/config/conclude.in b/config/conclude.in index 63bd512..00c8172 100644 --- a/config/conclude.in +++ b/config/conclude.in @@ -146,3 +146,5 @@ maintainer-clean: distclean @DEPEND1@ @DEPEND2@ +@DEPEND3@ +@DEPEND4@ diff --git a/config/depend.in b/config/depend.in index 7c61f4f..a02ad20 100644 --- a/config/depend.in +++ b/config/depend.in @@ -38,7 +38,7 @@ dep depend: .distdep $(CC) -M -MG $(CPPFLAGS) $$dep |sed 's/\.o/.lo/' >>$@; \ fi; \ done; - -perl -p $(top_srcdir)/bin/distdep .depend >.distdep + -perl -p $(top_srcdir)/bin/distdep .depend >$(srcdir)/.distdep -include .depend diff --git a/config/gnu-flags b/config/gnu-flags index 46a38f4..71de5e3 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -44,14 +44,14 @@ EOF v2=`echo $cc_version |cut -f2 -d.` v3=`echo $cc_version |cut -f3 -d.` v=`expr $v2 '*' 1000 + $v3` - if test $v -lt 91060; then + if test $v -le 91066; then cat <read) { +#ifdef H5S_DEBUG + H5_timer_begin(&timer); +#endif status = (sconv->read)(dataset->ent.file, &(dataset->layout), &(dataset->create_parms->pline), &(dataset->create_parms->efl), @@ -1561,6 +1564,12 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * fall through and xfer the data in the more roundabout way */ } else { /* direct xfer accomplished successfully */ +#ifdef H5S_DEBUG + H5_timer_end(&(sconv->stats[1].read_timer), &timer); + sconv->stats[1].read_nbytes += nelmts * + H5T_get_size(dataset->type); + sconv->stats[1].read_ncalls++; +#endif goto succeed; } #ifdef H5D_DEBUG @@ -1920,6 +1929,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * application buffer to file. */ if (H5T_IS_NOOP(tpath) && sconv->write) { +#ifdef H5S_DEBUG + H5_timer_begin(&timer); +#endif status = (sconv->write)(dataset->ent.file, &(dataset->layout), &(dataset->create_parms->pline), &(dataset->create_parms->efl), @@ -1936,6 +1948,11 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, * fall through and xfer the data in the more roundabout way */ } else { /* direct xfer accomplished successfully */ +#ifdef H5S_DEBUG + H5_timer_end(&(sconv->stats[0].write_timer), &timer); + sconv->stats[0].write_nbytes += nelmts * H5T_get_size(mem_type); + sconv->stats[0].write_ncalls++; +#endif goto succeed; } #ifdef H5D_DEBUG @@ -2515,3 +2532,47 @@ H5D_get_storage_size(H5D_t *dset) FUNC_LEAVE(size); } + + +/*------------------------------------------------------------------------- + * Function: H5Ddebug + * + * Purpose: Prints various information about a dataset. This function is + * not to be documented in the API at this time. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Robb Matzke + * Wednesday, April 28, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Ddebug(hid_t dset_id, unsigned UNUSED flags) +{ + H5D_t *dset=NULL; + + FUNC_ENTER(H5Ddebug, FAIL); + H5TRACE2("e","iIu",dset_id,flags); + + /* Check args */ + if (H5I_DATASET!=H5I_get_type(dset_id) || + NULL==(dset=H5I_object(dset_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); + } + + /* Print B-tree information */ + if (H5D_CHUNKED==dset->layout.type) { + H5F_istore_dump_btree(dset->ent.file, stdout, dset->layout.ndims, + &(dset->layout.addr)); + } else if (H5D_CONTIGUOUS==dset->layout.type) { + HDfprintf(stdout, " %-10s %a\n", "Address:", + &(dset->layout.addr)); + } + + FUNC_LEAVE(SUCCEED); +} diff --git a/src/H5Distore.c b/src/H5Distore.c index 904caf8..3fdfd0b 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -147,6 +147,7 @@ typedef struct H5F_istore_ud1_t { haddr_t addr; /*file address of chunk */ H5O_layout_t mesg; /*layout message */ hsize_t total_storage; /*output from iterator */ + FILE *stream; /*debug output stream */ } H5F_istore_ud1_t; /* inherits B-tree like properties from H5B */ @@ -724,7 +725,9 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key, /*------------------------------------------------------------------------- * Function: H5F_istore_iterate * - * Purpose: Simply counts the number of chunks for a dataset. + * Purpose: Simply counts the number of chunks for a dataset. If the + * UDATA.STREAM member is non-null then debugging information is + * written to that stream. * * Return: Success: Non-negative * @@ -744,8 +747,27 @@ H5F_istore_iterate (H5F_t UNUSED *f, void *_lt_key, { H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; H5F_istore_key_t *lt_key = (H5F_istore_key_t *)_lt_key; + int i; FUNC_ENTER(H5F_istore_iterate, FAIL); + + if (bt_udata->stream) { + if (0==bt_udata->total_storage) { + fprintf(bt_udata->stream, " Address:\n"); + fprintf(bt_udata->stream, + " Flags Bytes Address Logical Offset\n"); + fprintf(bt_udata->stream, + " ========== ======== ========== " + "==============================\n"); + } + HDfprintf(bt_udata->stream, " 0x%08x %8Zu %10a [", + lt_key->filter_mask, lt_key->nbytes, addr); + for (i=0; imesg.ndims; i++) { + HDfprintf(bt_udata->stream, "%s%Hd", i?", ":"", lt_key->offset[i]); + } + fputs("]\n", bt_udata->stream); + } + bt_udata->total_storage += lt_key->nbytes; FUNC_LEAVE(SUCCEED); } @@ -1952,8 +1974,8 @@ H5F_istore_allocated(H5F_t *f, int ndims, haddr_t *addr) H5F_istore_ud1_t udata; FUNC_ENTER(H5F_istore_nchunks, 0); + HDmemset(&udata, 0, sizeof udata); udata.mesg.ndims = ndims; - udata.total_storage = 0; if (H5B_iterate(f, H5B_ISTORE, addr, &udata)<0) { HRETURN_ERROR(H5E_IO, H5E_INTERNAL, 0, "unable to iterate over chunk B-tree"); @@ -1963,6 +1985,40 @@ H5F_istore_allocated(H5F_t *f, int ndims, haddr_t *addr) /*------------------------------------------------------------------------- + * Function: H5F_istore_dump_btree + * + * Purpose: Prints information about the storage B-tree to the specified + * stream. + * + * Return: Success: Non-negative + * + * Failure: negative + * + * Programmer: Robb Matzke + * Wednesday, April 28, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, haddr_t *addr) +{ + H5F_istore_ud1_t udata; + + FUNC_ENTER(H5F_istore_dump_btree, FAIL); + HDmemset(&udata, 0, sizeof udata); + udata.mesg.ndims = ndims; + udata.stream = stream; + if (H5B_iterate(f, H5B_ISTORE, addr, &udata)<0) { + HRETURN_ERROR(H5E_IO, H5E_INTERNAL, 0, + "unable to iterate over chunk B-tree"); + } + FUNC_LEAVE(SUCCEED); +} + + +/*------------------------------------------------------------------------- * Function: H5F_istore_stats * * Purpose: Print raw data cache statistics to the debug stream. If diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 6130715..89caad6 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -56,6 +56,7 @@ __DLL__ herr_t H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, __DLL__ herr_t H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf); __DLL__ herr_t H5Dextend (hid_t dset_id, const hsize_t *size); +__DLL__ herr_t H5Ddebug(hid_t dset_id, unsigned int flags); #ifdef __cplusplus } diff --git a/src/H5F.c b/src/H5F.c index 17cf4cb..7c19921 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -509,11 +509,9 @@ H5F_compare_files(void * _obj, const void * _key) FUNC_ENTER(H5F_compare_files, FALSE); #if WIN32 - ret_value = (obj->shared->key.dev == key->dev && obj->shared->key.fileindexhi == key->fileindexhi && obj->shared->key.fileindexlo == key->fileindexlo); - #else ret_value = (obj->shared->key.dev == key->dev && obj->shared->key.ino == key->ino); diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 904caf8..3fdfd0b 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -147,6 +147,7 @@ typedef struct H5F_istore_ud1_t { haddr_t addr; /*file address of chunk */ H5O_layout_t mesg; /*layout message */ hsize_t total_storage; /*output from iterator */ + FILE *stream; /*debug output stream */ } H5F_istore_ud1_t; /* inherits B-tree like properties from H5B */ @@ -724,7 +725,9 @@ H5F_istore_insert(H5F_t *f, const haddr_t *addr, void *_lt_key, /*------------------------------------------------------------------------- * Function: H5F_istore_iterate * - * Purpose: Simply counts the number of chunks for a dataset. + * Purpose: Simply counts the number of chunks for a dataset. If the + * UDATA.STREAM member is non-null then debugging information is + * written to that stream. * * Return: Success: Non-negative * @@ -744,8 +747,27 @@ H5F_istore_iterate (H5F_t UNUSED *f, void *_lt_key, { H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; H5F_istore_key_t *lt_key = (H5F_istore_key_t *)_lt_key; + int i; FUNC_ENTER(H5F_istore_iterate, FAIL); + + if (bt_udata->stream) { + if (0==bt_udata->total_storage) { + fprintf(bt_udata->stream, " Address:\n"); + fprintf(bt_udata->stream, + " Flags Bytes Address Logical Offset\n"); + fprintf(bt_udata->stream, + " ========== ======== ========== " + "==============================\n"); + } + HDfprintf(bt_udata->stream, " 0x%08x %8Zu %10a [", + lt_key->filter_mask, lt_key->nbytes, addr); + for (i=0; imesg.ndims; i++) { + HDfprintf(bt_udata->stream, "%s%Hd", i?", ":"", lt_key->offset[i]); + } + fputs("]\n", bt_udata->stream); + } + bt_udata->total_storage += lt_key->nbytes; FUNC_LEAVE(SUCCEED); } @@ -1952,8 +1974,8 @@ H5F_istore_allocated(H5F_t *f, int ndims, haddr_t *addr) H5F_istore_ud1_t udata; FUNC_ENTER(H5F_istore_nchunks, 0); + HDmemset(&udata, 0, sizeof udata); udata.mesg.ndims = ndims; - udata.total_storage = 0; if (H5B_iterate(f, H5B_ISTORE, addr, &udata)<0) { HRETURN_ERROR(H5E_IO, H5E_INTERNAL, 0, "unable to iterate over chunk B-tree"); @@ -1963,6 +1985,40 @@ H5F_istore_allocated(H5F_t *f, int ndims, haddr_t *addr) /*------------------------------------------------------------------------- + * Function: H5F_istore_dump_btree + * + * Purpose: Prints information about the storage B-tree to the specified + * stream. + * + * Return: Success: Non-negative + * + * Failure: negative + * + * Programmer: Robb Matzke + * Wednesday, April 28, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, haddr_t *addr) +{ + H5F_istore_ud1_t udata; + + FUNC_ENTER(H5F_istore_dump_btree, FAIL); + HDmemset(&udata, 0, sizeof udata); + udata.mesg.ndims = ndims; + udata.stream = stream; + if (H5B_iterate(f, H5B_ISTORE, addr, &udata)<0) { + HRETURN_ERROR(H5E_IO, H5E_INTERNAL, 0, + "unable to iterate over chunk B-tree"); + } + FUNC_LEAVE(SUCCEED); +} + + +/*------------------------------------------------------------------------- * Function: H5F_istore_stats * * Purpose: Print raw data cache statistics to the debug stream. If diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 93f3f64..ad9d86f 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -303,16 +303,17 @@ typedef struct H5F_search_t { dev_t dev; /* Device number containing file */ ino_t ino; /* Unique file number on device */ #if WIN32 -/* - Specifies the low-order word of a unique identifier associated with the file. - This identifier and the volume serial number uniquely identify a file. This number - may change when the system is restarted or when the file is opened. After a process - opens a file, the identifier is constant until the file is closed. An application can - use this identifier and the volume serial number to determine whether two handles refer - to the same file. -*/ - int fileindexlo; - int fileindexhi; + /* + * Specifies the low-order word of a unique identifier associated with the + * file. This identifier and the volume serial number uniquely identify a + * file. This number may change when the system is restarted or when the + * file is opened. After a process opens a file, the identifier is + * constant until the file is closed. An application can use this + * identifier and the volume serial number to determine whether two + * handles refer to the same file. + */ + int fileindexlo; + int fileindexhi; #endif } H5F_search_t; @@ -658,6 +659,8 @@ __DLL__ herr_t H5F_istore_allocate (H5F_t *f, const double split_ratios[], const struct H5O_pline_t *pline, const struct H5O_fill_t *fill); +__DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, + haddr_t *addr); /* Functions that operate on contiguous storage wrt boot block */ __DLL__ herr_t H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, diff --git a/src/H5S.c b/src/H5S.c index b2874ce06..bf4e9cd 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -134,7 +134,9 @@ H5S_term_interface(void) for (j=0; j<2; j++) { if (0==path->stats[j].gath_ncalls && 0==path->stats[j].scat_ncalls && - 0==path->stats[j].bkg_ncalls) { + 0==path->stats[j].bkg_ncalls && + 0==path->stats[j].read_ncalls && + 0==path->stats[j].write_ncalls) { continue; } if (0==nprints++) { @@ -202,6 +204,38 @@ H5S_term_interface(void) path->stats[j].bkg_timer.etime, buf); } + + /* Read */ + if (path->stats[j].read_ncalls) { + H5_bandwidth(buf, + (double)(path->stats[j].read_nbytes), + path->stats[j].read_timer.etime); + HDfprintf(H5DEBUG(S), + " %16s %10Hu %10Hu %8.2f %8.2f %8.2f " + "%10s\n", "read", + path->stats[j].read_nbytes, + path->stats[j].read_ncalls, + path->stats[j].read_timer.utime, + path->stats[j].read_timer.stime, + path->stats[j].read_timer.etime, + buf); + } + + /* Write */ + if (path->stats[j].write_ncalls) { + H5_bandwidth(buf, + (double)(path->stats[j].write_nbytes), + path->stats[j].write_timer.etime); + HDfprintf(H5DEBUG(S), + " %16s %10Hu %10Hu %8.2f %8.2f %8.2f " + "%10s\n", "write", + path->stats[j].write_nbytes, + path->stats[j].write_ncalls, + path->stats[j].write_timer.utime, + path->stats[j].write_timer.stime, + path->stats[j].write_timer.etime, + buf); + } } } } diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index b01d9dc..0a652e2 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -278,6 +278,12 @@ typedef struct H5S_conv_t { H5_timer_t bkg_timer; /*time for background */ hsize_t bkg_nbytes; /*background throughput */ hsize_t bkg_ncalls; /*number of calls */ + H5_timer_t read_timer; /*time for read calls */ + hsize_t read_nbytes; /*total bytes read */ + hsize_t read_ncalls; /*number of calls */ + H5_timer_t write_timer; /*time for write calls */ + hsize_t write_nbytes; /*total bytes written */ + hsize_t write_ncalls; /*number of calls */ } stats[2]; /* 0=output, 1=input */ #endif } H5S_conv_t; diff --git a/src/H5Tconv.c b/src/H5Tconv.c index d1f8c6a..7aad1e1 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1259,16 +1259,19 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, direction = 1; olap = nelmts; } else if (src->size>=dst->size) { + double olap_d = HDceil((double)(dst->size)/ + (double)(src->size-dst->size)); + + olap = (size_t)olap_d; sp = dp = (uint8_t*)buf; direction = 1; - olap = (size_t)(HDceil((double)(src->size)/ - (double)(src->size-dst->size))-1); } else { + double olap_d = HDceil((double)(src->size)/ + (double)(dst->size-src->size)); + olap = (size_t)olap_d; sp = (uint8_t*)buf + (nelmts-1) * src->size; dp = (uint8_t*)buf + (nelmts-1) * dst->size; direction = -1; - olap = (size_t)(HDceil((double)(dst->size)/ - (double)(dst->size-src->size))-1); } /* The conversion loop */ @@ -1283,7 +1286,7 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, d = elmtno= nelmts-olap ? dbuf : dp; + d = elmtno+olap >= nelmts ? dbuf : dp; } #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ @@ -1636,16 +1639,18 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, direction = 1; olap = nelmts; } else if (src_p->size>=dst_p->size) { + double olap_d = HDceil((double)(dst_p->size)/ + (double)(src_p->size-dst_p->size)); + olap = (size_t)olap_d; sp = dp = (uint8_t*)buf; direction = 1; - olap = (size_t)(HDceil((double)(src_p->size)/ - (double)(src_p->size-dst_p->size))-1); } else { + double olap_d = HDceil((double)(src_p->size)/ + (double)(dst_p->size-src_p->size)); + olap = (size_t)olap_d; sp = (uint8_t*)buf + (nelmts-1) * src_p->size; dp = (uint8_t*)buf + (nelmts-1) * dst_p->size; direction = -1; - olap = (size_t)(HDceil((double)(dst_p->size)/ - (double)(dst_p->size-src_p->size))-1); } /* The conversion loop */ @@ -1659,7 +1664,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, d = elmtno= nelmts-olap ? dbuf : dp; + d = elmtno+olap >= nelmts ? dbuf : dp; } #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ diff --git a/test/.distdep b/test/.distdep index 8e28539..b3c51d3 100644 --- a/test/.distdep +++ b/test/.distdep @@ -1,4 +1,4 @@ -h5test.o: \ +h5test.lo: \ h5test.c \ h5test.h \ ../src/hdf5.h \ @@ -30,7 +30,7 @@ h5test.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -big.o: \ +big.lo: \ big.c \ h5test.h \ ../src/hdf5.h \ @@ -62,7 +62,7 @@ big.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -bittests.o: \ +bittests.lo: \ bittests.c \ h5test.h \ ../src/hdf5.h \ @@ -94,7 +94,7 @@ bittests.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -chunk.o: \ +chunk.lo: \ chunk.c \ ../src/hdf5.h \ ../src/H5public.h \ @@ -119,7 +119,7 @@ chunk.o: \ ../src/H5RApublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -cmpd_dset.o: \ +cmpd_dset.lo: \ cmpd_dset.c \ h5test.h \ ../src/hdf5.h \ @@ -151,7 +151,7 @@ cmpd_dset.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -dsets.o: \ +dsets.lo: \ dsets.c \ h5test.h \ ../src/hdf5.h \ @@ -183,7 +183,7 @@ dsets.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -dtypes.o: \ +dtypes.lo: \ dtypes.c \ h5test.h \ ../src/hdf5.h \ @@ -215,7 +215,7 @@ dtypes.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -extend.o: \ +extend.lo: \ extend.c \ h5test.h \ ../src/hdf5.h \ @@ -247,7 +247,7 @@ extend.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -external.o: \ +external.lo: \ external.c \ h5test.h \ ../src/hdf5.h \ @@ -279,7 +279,7 @@ external.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -fillval.o: \ +fillval.lo: \ fillval.c \ h5test.h \ ../src/hdf5.h \ @@ -311,7 +311,7 @@ fillval.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -flush1.o: \ +flush1.lo: \ flush1.c \ h5test.h \ ../src/hdf5.h \ @@ -343,7 +343,7 @@ flush1.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -flush2.o: \ +flush2.lo: \ flush2.c \ h5test.h \ ../src/hdf5.h \ @@ -375,7 +375,7 @@ flush2.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -gheap.o: \ +gheap.lo: \ gheap.c \ h5test.h \ ../src/hdf5.h \ @@ -410,7 +410,7 @@ gheap.o: \ ../src/H5Gprivate.h \ ../src/H5Bprivate.h \ ../src/H5Eprivate.h -hyperslab.o: \ +hyperslab.lo: \ hyperslab.c \ ../src/H5private.h \ ../src/H5public.h \ @@ -418,7 +418,7 @@ hyperslab.o: \ ../src/H5api_adpt.h \ ../src/H5MMprivate.h \ ../src/H5MMpublic.h -iopipe.o: \ +iopipe.lo: \ iopipe.c \ ../src/hdf5.h \ ../src/H5public.h \ @@ -443,7 +443,7 @@ iopipe.o: \ ../src/H5RApublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -istore.o: \ +istore.lo: \ istore.c \ h5test.h \ ../src/hdf5.h \ @@ -484,7 +484,7 @@ istore.o: \ ../src/H5Iprivate.h \ ../src/H5Pprivate.h \ ../src/H5MMprivate.h -lheap.o: \ +lheap.lo: \ lheap.c \ h5test.h \ ../src/hdf5.h \ @@ -519,7 +519,7 @@ lheap.o: \ ../src/H5Gprivate.h \ ../src/H5Bprivate.h \ ../src/H5HLprivate.h -links.o: \ +links.lo: \ links.c \ h5test.h \ ../src/hdf5.h \ @@ -551,7 +551,7 @@ links.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -mount.o: \ +mount.lo: \ mount.c \ h5test.h \ ../src/hdf5.h \ @@ -583,7 +583,7 @@ mount.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -mtime.o: \ +mtime.lo: \ mtime.c \ h5test.h \ ../src/hdf5.h \ @@ -615,7 +615,7 @@ mtime.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -ohdr.o: \ +ohdr.lo: \ ohdr.c \ h5test.h \ ../src/hdf5.h \ @@ -653,7 +653,7 @@ ohdr.o: \ ../src/H5Oprivate.h \ ../src/H5Sprivate.h \ ../src/H5Zprivate.h -overhead.o: \ +overhead.lo: \ overhead.c \ ../src/hdf5.h \ ../src/H5public.h \ @@ -678,7 +678,7 @@ overhead.o: \ ../src/H5RApublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -ragged.o: \ +ragged.lo: \ ragged.c \ ../src/hdf5.h \ ../src/H5public.h \ @@ -704,7 +704,7 @@ ragged.o: \ ../src/H5Spublic.h \ ../src/H5Tpublic.h \ ../src/H5private.h -stab.o: \ +stab.lo: \ stab.c \ h5test.h \ ../src/hdf5.h \ @@ -739,7 +739,7 @@ stab.o: \ ../src/H5Gprivate.h \ ../src/H5Bprivate.h \ ../src/H5Gpkg.h -tattr.o: \ +tattr.lo: \ tattr.c \ testhdf5.h \ ../src/H5private.h \ @@ -766,7 +766,7 @@ tattr.o: \ ../src/H5Rpublic.h \ ../src/H5RApublic.h \ ../src/H5Spublic.h -testhdf5.o: \ +testhdf5.lo: \ testhdf5.c \ testhdf5.h \ ../src/H5private.h \ @@ -775,7 +775,7 @@ testhdf5.o: \ ../src/H5api_adpt.h \ ../src/H5Eprivate.h \ ../src/H5Epublic.h -tfile.o: \ +tfile.lo: \ tfile.c \ testhdf5.h \ ../src/H5private.h \ @@ -790,7 +790,7 @@ tfile.o: \ ../src/H5Fprivate.h \ ../src/H5Fpublic.h \ ../src/H5Dpublic.h -th5s.o: \ +th5s.lo: \ th5s.c \ testhdf5.h \ ../src/H5private.h \ @@ -817,7 +817,7 @@ th5s.o: \ ../src/H5Tpublic.h \ ../src/H5Zprivate.h \ ../src/H5Zpublic.h -tmeta.o: \ +tmeta.lo: \ tmeta.c \ testhdf5.h \ ../src/H5private.h \ @@ -829,7 +829,7 @@ tmeta.o: \ ../src/H5Ipublic.h \ ../src/H5Fprivate.h \ ../src/H5Fpublic.h -trefer.o: \ +trefer.lo: \ trefer.c \ testhdf5.h \ ../src/H5private.h \ @@ -856,7 +856,7 @@ trefer.o: \ ../src/H5Rpublic.h \ ../src/H5RApublic.h \ ../src/H5Spublic.h -tselect.o: \ +tselect.lo: \ tselect.c \ testhdf5.h \ ../src/H5private.h \ @@ -883,7 +883,7 @@ tselect.o: \ ../src/H5Rpublic.h \ ../src/H5RApublic.h \ ../src/H5Spublic.h -unlink.o: \ +unlink.lo: \ unlink.c \ h5test.h \ ../src/hdf5.h \ @@ -915,7 +915,7 @@ unlink.o: \ ../src/H5Fprivate.h \ ../src/H5Rprivate.h \ ../src/H5Tprivate.h -enum.o: \ +enum.lo: \ enum.c \ h5test.h \ ../src/hdf5.h \ diff --git a/test/dtypes.c b/test/dtypes.c index 0e164c7..1565888 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -2265,6 +2265,59 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) /*------------------------------------------------------------------------- + * Function: test_conv_int_2 + * + * Purpose: Tests overlap calculates in H5T_conv_i_i(), which should be + * the same as for H5T_conv_f_f() and H5T_conv_s_s(). + * + * Return: Success: 0 + * + * Failure: number of errors + * + * Programmer: Robb Matzke + * Friday, April 30, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +test_conv_int_2(void) +{ + int i, j; + hid_t src_type, dst_type; + char buf[32*100]; + + printf("%-70s", "Testing overlap calculations"); + fflush(stdout); + + memset(buf, 0, sizeof buf); + for (i=1; i<=32; i++) { + for (j=1; j<=32; j++) { + + /* Source type */ + src_type = H5Tcopy(H5T_NATIVE_CHAR); + H5Tset_size(src_type, i); + + /* Destination type */ + dst_type = H5Tcopy(H5T_NATIVE_CHAR); + H5Tset_size(dst_type, j); + + /* + * Conversion. If overlap calculations aren't right then an + * assertion will fail in H5T_conv_i_i() + */ + H5Tconvert(src_type, dst_type, 100, buf, NULL); + H5Tclose(src_type); + H5Tclose(dst_type); + } + } + PASSED(); + return 0; +} + + +/*------------------------------------------------------------------------- * Function: my_isnan * * Purpose: Determines whether VAL points to NaN. @@ -2984,6 +3037,7 @@ main(void) reset_hdf5(); /* Test software integer conversion functions */ + nerrors += test_conv_int_2(); nerrors += run_integer_tests("sw"); /* Test software floating-point conversion functions */ diff --git a/tools/h5ls.c b/tools/h5ls.c index 6073738..6dc1ed5 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -18,7 +18,8 @@ /* Command-line switches */ static int verbose_g = 0; /*lots of extra output */ static int width_g = 80; /*output width in characters */ -static hbool_t dump_g = FALSE; /*display dataset values? */ +static hbool_t address_g = FALSE; /*print raw data addresses */ +static hbool_t data_g = FALSE; /*display dataset values? */ static hbool_t label_g = FALSE; /*label compound values? */ static hbool_t string_g = FALSE; /*print 1-byte numbers as ASCII? */ static hbool_t fullname_g = FALSE; /*print full path names */ @@ -83,7 +84,8 @@ usage (const char *progname) usage: %s [OPTIONS] FILE [OBJECTS...]\n\ OPTIONS\n\ -h, -?, --help Print a usage message and exit\n\ - -d, --dump Print the values of datasets\n\ + -a, --address Print addresses for raw data\n\ + -d, --data Print the values of datasets\n\ -f, --full Print full path names instead of base names\n\ -g, --group Show information about a group, not its contents\n\ -l, --label Label members of compound datasets\n\ @@ -1312,13 +1314,16 @@ dataset_list2(hid_t dset, const char UNUSED *name) display_type(type, 15); printf("\n"); + /* Print address information */ + if (address_g) H5Ddebug(dset, 0); + /* Close stuff */ H5Tclose(type); H5Sclose(space); H5Pclose(dcpl); } - if (dump_g) dump_dataset_values(dset); + if (data_g) dump_dataset_values(dset); return 0; } @@ -1402,7 +1407,7 @@ datatype_list2(hid_t type, const char UNUSED *name) static herr_t ragged_list2(hid_t UNUSED ra, const char UNUSED *name) { - if (dump_g) { + if (data_g) { puts(" Data: Not implemented yet (see values of member"); puts(" datasets `raw', `over', and `meta')"); } @@ -1752,10 +1757,12 @@ main (int argc, char *argv[]) } else if (!strcmp(argv[argno], "--help")) { usage(progname); exit(0); + } else if (!strcmp(argv[argno], "--address")) { + address_g = TRUE; } else if (!strcmp(argv[argno], "--group")) { grp_literal_g = TRUE; - } else if (!strcmp(argv[argno], "--dump")) { - dump_g = TRUE; + } else if (!strcmp(argv[argno], "--data")) { + data_g = TRUE; } else if (!strcmp(argv[argno], "--full")) { fullname_g = TRUE; } else if (!strcmp(argv[argno], "--label")) { @@ -1799,8 +1806,11 @@ main (int argc, char *argv[]) case 'h': /* --help */ usage(progname); exit(0); - case 'd': /* --dump */ - dump_g++; + case 'a': /* --address */ + address_g = TRUE; + break; + case 'd': /* --data */ + data_g = TRUE; break; case 'f': /* --full */ fullname_g = TRUE; -- cgit v0.12