summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-04-04 15:50:48 (GMT)
committerGitHub <noreply@github.com>2022-04-04 15:50:48 (GMT)
commit99ba670f6add3bf83c0361537230e686f3976d1e (patch)
treef41ec5e49211babab51b0d80736a513001ad9e5c /tools
parent309601db39422dc7843566b197678b262a634f7b (diff)
downloadhdf5-99ba670f6add3bf83c0361537230e686f3976d1e.zip
hdf5-99ba670f6add3bf83c0361537230e686f3976d1e.tar.gz
hdf5-99ba670f6add3bf83c0361537230e686f3976d1e.tar.bz2
Add option for h5repack timing #1142 (#1575)
Diffstat (limited to 'tools')
-rw-r--r--tools/src/h5repack/h5repack.c88
-rw-r--r--tools/src/h5repack/h5repack.h6
-rw-r--r--tools/src/h5repack/h5repack_copy.c99
-rw-r--r--tools/src/h5repack/h5repack_main.c14
-rw-r--r--tools/src/h5repack/h5repack_refs.c9
-rw-r--r--tools/test/h5repack/testfiles/h5repack-help.txt3
6 files changed, 168 insertions, 51 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 7cad36b..bcb156b 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -221,6 +221,7 @@ h5repack_addlayout(const char *str, pack_opt_t *options)
* to free the stack.
*-------------------------------------------------------------------------
*/
+
hid_t
copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt,
pack_opt_t *options)
@@ -354,24 +355,28 @@ done:
int
copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
{
- hid_t attr_id = H5I_INVALID_HID; /* attr ID */
- hid_t attr_out = H5I_INVALID_HID; /* attr ID */
- hid_t space_id = H5I_INVALID_HID; /* space ID */
- hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
- hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
- size_t msize; /* size of type */
- void * buf = NULL; /* data buffer */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- htri_t is_named; /* Whether the datatype is named */
- hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
- char name[255];
- H5O_info2_t oinfo; /* object info */
- int j;
- unsigned u;
- hbool_t is_ref = 0;
- H5T_class_t type_class = -1;
- int ret_value = 0;
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_out = H5I_INVALID_HID; /* attr ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
+ hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
+ size_t msize; /* size of type */
+ void * buf = NULL; /* data buffer */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ htri_t is_named; /* Whether the datatype is named */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
+ H5_timer_t timer; /* Timer for read/write operations */
+ H5_timevals_t times; /* Elapsed time for each operation */
+ static double read_time = 0;
+ static double write_time = 0;
+ char name[255];
+ H5O_info2_t oinfo; /* object info */
+ int j;
+ unsigned u;
+ hbool_t is_ref = 0;
+ H5T_class_t type_class = -1;
+ int ret_value = 0;
if (H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
@@ -468,6 +473,9 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
} /* end for each member */
} /* end if type_class is H5T_COMPOUND */
+ read_time = 0;
+ write_time = 0;
+
if (!is_ref) {
/*-----------------------------------------------------------------
* read to memory
@@ -478,8 +486,17 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
if (buf == NULL) {
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Aread(attr_id, wtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ read_time += times.elapsed;
+ }
/*-----------------------------------------------------------------
* copy
@@ -488,8 +505,18 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Acreate2 failed on ,%s>", name);
+
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Awrite(attr_out, wtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Awrite failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ write_time += times.elapsed;
+ }
/*close*/
if (H5Aclose(attr_out) < 0)
@@ -499,11 +526,14 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
* be reclaimed */
if (TRUE == h5tools_detect_vlen(wtype_id))
H5Treclaim(wtype_id, space_id, H5P_DEFAULT, buf);
+
HDfree(buf);
buf = NULL;
} /*H5T_REFERENCE*/
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_ATTR_TIME, "attr", read_time, write_time, name);
+ else
HDprintf(FORMAT_OBJ_ATTR, "attr", name);
/*---------------------------------------------------------------------
@@ -569,7 +599,7 @@ check_options(pack_opt_t *options)
* Objects to layout
*-------------------------------------------------------------------------
*/
- if (options->verbose && have_request(options)) {
+ if (options->verbose > 0 && have_request(options)) {
if (options->all_layout == 1) {
HDprintf("All objects to modify layout are...\n");
switch (options->layout_g) {
@@ -610,7 +640,7 @@ check_options(pack_opt_t *options)
char *name = options->op_tbl->objs[i].path;
if (options->op_tbl->objs[i].chunk.rank > 0) {
- if (options->verbose) {
+ if (options->verbose > 0) {
HDprintf(" <%s> with chunk size ", name);
for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
HDprintf("%d ", (int)options->op_tbl->objs[i].chunk.chunk_lengths[k]);
@@ -619,7 +649,7 @@ check_options(pack_opt_t *options)
has_ck = 1;
}
else if (options->op_tbl->objs[i].chunk.rank == -2) { /* TODO: replace 'magic number' */
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf(" <%s> %s\n", name, "NONE (contiguous)");
has_ck = 1;
}
@@ -633,7 +663,7 @@ check_options(pack_opt_t *options)
*-------------------------------------------------------------------------
*/
- if (options->verbose && have_request(options)) {
+ if (options->verbose > 0 && have_request(options)) {
if (options->all_filter == 1) {
HDprintf("All objects to apply filter are...\n");
for (k = 0; k < options->n_filter_g; k++) {
@@ -670,7 +700,7 @@ check_options(pack_opt_t *options)
char * name = pack.path;
for (j = 0; j < pack.nfilters; j++) {
- if (options->verbose) {
+ if (options->verbose > 0) {
if (pack.filter[j].filtn >= 0) {
if (pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) {
HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn),
@@ -708,7 +738,7 @@ check_options(pack_opt_t *options)
*------------------------------------------------------------------------
*/
if (options->ublock_filename != NULL && options->ublock_size == 0) {
- if (options->verbose) {
+ if (options->verbose > 0) {
HDprintf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
options->ublock_filename);
options->ublock_size = 1024;
@@ -781,21 +811,21 @@ check_objects(const char *fname, pack_opt_t *options)
*-------------------------------------------------------------------------
*/
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs);
for (i = 0; i < options->op_tbl->nelems; i++) {
pack_info_t obj = options->op_tbl->objs[i];
char * name = obj.path;
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf(" <%s>", name);
/* the input object names are present in the file and are valid */
if (h5trav_getindext(name, travt) < 0)
H5TOOLS_GOTO_ERROR((-1), "%s Could not find <%s> in file <%s>. Exiting...\n",
- (options->verbose ? "\n" : ""), name, fname);
- if (options->verbose)
+ (options->verbose > 0 ? "\n" : ""), name, fname);
+ if (options->verbose > 0)
HDprintf("...Found\n");
for (ifil = 0; ifil < obj.nfilters; ifil++) {
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index 74525f4..b242a71 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -27,6 +27,12 @@
#define FORMAT_OBJ_ATTR " %-27s %s\n" /* obj type, name */
#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */
+/* timing formats */
+#define FORMAT_OBJ_TIME " %-27s %e/%e %s\n" /* obj type, name */
+#define FORMAT_OBJ_ATTR_TIME " %-27s %e/%e %s\n" /* obj type, name */
+#define FORMAT_OBJ_NOTIME " %-27s %s\n" /* obj type, name */
+#define FORMAT_OBJ_ATTR_NOTIME " %-27s %s\n" /* obj type, name */
+
/* File space default information */
#define FS_PAGESIZE_DEF 4096
#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 934b4d1..65843d4 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -39,7 +39,8 @@
*/
static int get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t size_datum,
hsize_t dims_hslab[], hsize_t *hslab_nbytes_p);
-static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr);
+static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr, pack_opt_t *options,
+ double read_time, double write_time);
static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options);
static int copy_user_block(const char *infile, const char *outfile, hsize_t size);
#if defined(H5REPACK_DEBUG_USER_BLOCK)
@@ -298,7 +299,7 @@ copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options)
* create the output file
*-------------------------------------------------------------------------
*/
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf("Making new file ...\n");
if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, options->fout_fapl)) < 0)
@@ -643,6 +644,10 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
int req_filter; /* there was a request for a filter */
int req_obj_layout = 0; /* request layout to current object */
unsigned crt_order_flags; /* group creation order flag */
+ H5_timer_t timer; /* Timer for read/write operations */
+ H5_timevals_t times; /* Elapsed time for each operation */
+ static double read_time = 0;
+ static double write_time = 0;
h5tool_link_info_t linkinfo;
unsigned i;
unsigned u;
@@ -661,7 +666,12 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
*-------------------------------------------------------------------------
*/
- if (options->verbose) {
+ if (options->verbose == 2) {
+ HDprintf("-----------------------------------------------------------------\n");
+ HDprintf(" Type Filter (Compression) Timing read/write Name\n");
+ HDprintf("-----------------------------------------------------------------\n");
+ }
+ else {
HDprintf("-----------------------------------------\n");
HDprintf(" Type Filter (Compression) Name\n");
HDprintf("-----------------------------------------\n");
@@ -682,7 +692,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
*-------------------------------------------------------------------------
*/
case H5TRAV_TYPE_GROUP:
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_NOTIME, "group", travt->objs[i].name);
+ else
HDprintf(FORMAT_OBJ, "group", travt->objs[i].name);
/* open input group */
@@ -749,6 +761,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
case H5TRAV_TYPE_DATASET: {
hbool_t use_h5ocopy;
+ read_time = 0.0;
+ write_time = 0.0;
+
has_filter = 0;
req_filter = 0;
@@ -972,7 +987,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
H5P_DEFAULT, dcpl_out, H5P_DEFAULT);
if (dset_out == H5I_INVALID_HID) {
H5TOOLS_INFO("H5Dcreate2 failed");
- if (options->verbose)
+ if (options->verbose > 0)
HDprintf(" warning: could not create dataset <%s>. Applying original "
"settings\n",
travt->objs[i].name);
@@ -1013,11 +1028,27 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
}
if (buf != NULL) {
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) <
0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ read_time += times.elapsed;
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ write_time += times.elapsed;
+ }
/* Check if we have VL data in the dataset's
* datatype that must be reclaimed */
@@ -1115,12 +1146,28 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
hs_select_nelmts = 1;
} /* end (else) rank == 0 */
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Dread(dset_in, wtype_id, hslab_space, f_space_id,
H5P_DEFAULT, hslab_buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ read_time += times.elapsed;
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, dxpl_id,
hslab_buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ write_time += times.elapsed;
+ }
/* reclaim any VL memory, if necessary */
if (vl_data)
@@ -1149,7 +1196,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
* print amount of compression used
*-------------------------------------------------------------------------
*/
- if (options->verbose) {
+ if (options->verbose > 0) {
double ratio = 0;
/* only print the compression ration if there was a filter request */
@@ -1160,10 +1207,12 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
/* compression ratio = uncompressed size / compressed size */
if (dsize_out != 0)
ratio = (double)dsize_in / (double)dsize_out;
- print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1);
+ print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1, options,
+ read_time, write_time);
}
else
- print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0);
+ print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0, options,
+ read_time, write_time);
/* print a message that the filter was not applied
* (in case there was a filter)
@@ -1220,6 +1269,10 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
if (H5Pset_copy_object(ocpl_id, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
+ if (options->verbose == 2) {
+ H5_timer_init(&timer);
+ H5_timer_start(&timer);
+ }
if (H5Ocopy(fidin, /* Source file or group identifier */
travt->objs[i].name, /* Name of the source object to be copied */
fidout, /* Destination file or group identifier */
@@ -1227,6 +1280,11 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
ocpl_id, /* Properties which apply to the copy */
H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
+ if (options->verbose == 2) {
+ H5_timer_stop(&timer);
+ H5_timer_get_times(timer, &times);
+ write_time += times.elapsed;
+ }
if (H5Pclose(ocpl_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
@@ -1247,7 +1305,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
if (H5Dclose(dset_out) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_TIME, "dset", 0.0, write_time, travt->objs[i].name);
+ else
HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
} /* end whether we have request for filter/chunking */
@@ -1260,7 +1320,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
*-------------------------------------------------------------------------
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_NOTIME, "type", travt->objs[i].name);
+ else
HDprintf(FORMAT_OBJ, "type", travt->objs[i].name);
if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
@@ -1300,7 +1362,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
*/
case H5TRAV_TYPE_LINK:
case H5TRAV_TYPE_UDLINK:
- if (options->verbose)
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_NOTIME, "link", travt->objs[i].name);
+ else
HDprintf(FORMAT_OBJ, "link", travt->objs[i].name);
/* Check -X option. */
@@ -1425,7 +1489,8 @@ done:
*-------------------------------------------------------------------------
*/
static void
-print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
+print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_t *options, double read_time,
+ double write_time)
{
char strfilter[255];
#if defined(PRINT_DEBUG)
@@ -1514,7 +1579,10 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
} /* end for each filter */
if (!pr)
- HDprintf(FORMAT_OBJ, "dset", objname);
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_TIME, "dset", read_time, write_time, objname);
+ else
+ HDprintf(FORMAT_OBJ, "dset", objname);
else {
char str[512], temp[512];
@@ -1522,7 +1590,10 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
HDstrcat(str, strfilter);
HDsprintf(temp, " (%.3f:1)", ratio);
HDstrcat(str, temp);
- HDprintf(FORMAT_OBJ, str, objname);
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_TIME, str, read_time, write_time, objname);
+ else
+ HDprintf(FORMAT_OBJ, str, objname);
}
} /* end print_dataset_info() */
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 29af231..98d2a73 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -31,7 +31,7 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:E*G:LM:P:S:T:VXW";
+static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:v*z:E*G:LM:P:S:T:VXW";
static struct long_options l_opts[] = {{"alignment", require_arg, 'a'},
{"block", require_arg, 'b'},
{"compact", require_arg, 'c'},
@@ -50,7 +50,7 @@ static struct long_options l_opts[] = {{"alignment", require_arg, 'a'},
{"ssize", require_arg, 's'},
{"threshold", require_arg, 't'},
{"ublock", require_arg, 'u'},
- {"verbose", no_arg, 'v'},
+ {"verbose", optional_arg, 'v'},
{"sort_order", require_arg, 'z'},
{"enable-error-stack", optional_arg, 'E'},
{"fs_pagesize", require_arg, 'G'},
@@ -93,7 +93,8 @@ usage(const char *prog)
" Optional value 2 also prints file open errors.\n");
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
- PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n");
+ PRINTVALSTREAM(rawoutstream, " -v N, --verbose=N Verbose mode, print object information.\n");
+ PRINTVALSTREAM(rawoutstream, " N - is an integer greater than 1, 2 displays read/write timing\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n");
PRINTVALSTREAM(rawoutstream,
@@ -527,7 +528,12 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
goto done;
case 'v':
- options->verbose = 1;
+ if (opt_arg != NULL) {
+ if (2 == HDatoi(opt_arg))
+ options->verbose = 2;
+ }
+ else
+ options->verbose = 1;
break;
case 'f':
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index 6191624..6d62e52 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -182,8 +182,11 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
/* create the reference, -1 parameter for objects */
if (H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed");
- if (options->verbose) {
- HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
+ if (options->verbose > 0) {
+ if (options->verbose == 2)
+ HDprintf(FORMAT_OBJ_NOTIME, "dset", travt->objs[i].name);
+ else
+ HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
HDprintf("object <%s> object reference created to <%s>\n",
travt->objs[i].name, refname);
}
@@ -276,7 +279,7 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti
H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed");
if (H5Sclose(region_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if (options->verbose) {
+ if (options->verbose > 0) {
HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
HDprintf("object <%s> region reference created to <%s>\n",
travt->objs[i].name, refname);
diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt
index 25c247c..1bc6807 100644
--- a/tools/test/h5repack/testfiles/h5repack-help.txt
+++ b/tools/test/h5repack/testfiles/h5repack-help.txt
@@ -6,7 +6,8 @@ usage: h5repack [OPTIONS] file1 file2
Optional value 2 also prints file open errors.
OPTIONS
-h, --help Print a usage message and exit
- -v, --verbose Verbose mode, print object information
+ -v N, --verbose=N Verbose mode, print object information.
+ N - is an integer greater than 1, 2 displays read/write timing
-V, --version Print version number and exit
-n, --native Use a native HDF5 type when repacking
--src-vol-value Value (ID) of the VOL connector to use for opening the