diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2018-04-24 20:10:13 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2018-04-24 20:10:13 (GMT) |
commit | e6bc326ec0c417ef7b003da535b2e071442d2067 (patch) | |
tree | 700a274f00d7cee9d17c14c79dca71d97a328fc1 /tools/lib | |
parent | b3c5284692093953132c6c8227e0980b670bf4ad (diff) | |
download | hdf5-e6bc326ec0c417ef7b003da535b2e071442d2067.zip hdf5-e6bc326ec0c417ef7b003da535b2e071442d2067.tar.gz hdf5-e6bc326ec0c417ef7b003da535b2e071442d2067.tar.bz2 |
Fix for HDFFV-10180 Performance issues with H5Oget_info.
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.c | 12 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 4 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 4 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 8 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_ref.c | 4 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 6 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 22 | ||||
-rw-r--r-- | tools/lib/h5trav.h | 2 |
10 files changed, 34 insertions, 32 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 94cca58..041ac8d 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -433,7 +433,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) HGOTO_DONE(0); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, - trav_grp_objs,trav_grp_symlinks, tinfo) < 0) { + trav_grp_objs,trav_grp_symlinks, tinfo, 0) < 0) { parallel_print("Error: Could not get file contents\n"); opts->err_stat = 1; HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents"); @@ -465,7 +465,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) HGOTO_DONE(0); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, - trav_grp_objs,trav_grp_symlinks, tinfo) < 0) { + trav_grp_objs,trav_grp_symlinks, tinfo, 0) < 0) { parallel_print("Error: Could not get file contents\n"); opts->err_stat = 1; HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents\n"); @@ -645,7 +645,7 @@ h5diff(const char *fname1, /* optional data pass */ info1_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name(file1_id, obj1fullname, &oinfo1, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, 0, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); } @@ -695,7 +695,7 @@ h5diff(const char *fname1, /* optional data pass */ info2_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name(file2_id, obj2fullname, &oinfo2, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, 0, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); } @@ -846,7 +846,7 @@ h5diff(const char *fname1, info1_grp->opts = (diff_opt_t*)opts; if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE, - trav_grp_objs, trav_grp_symlinks, info1_grp) < 0) { + trav_grp_objs, trav_grp_symlinks, info1_grp, 0) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); } @@ -860,7 +860,7 @@ h5diff(const char *fname1, info2_grp->opts = (diff_opt_t*)opts; if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE, - trav_grp_objs, trav_grp_symlinks, info2_grp) < 0) { + trav_grp_objs, trav_grp_symlinks, info2_grp, 0) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); } /* end if */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 11f5e41..e72f738 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -2096,8 +2096,8 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t if (nfound_b && opts->m_verbose) { H5O_info_t oi1, oi2; - H5Oget_info(obj1_id, &oi1); - H5Oget_info(obj2_id, &oi2); + H5Oget_info2(obj1_id, &oi1, 0); + H5Oget_info2(obj2_id, &oi2, 0); parallel_print("Referenced dataset %lu %lu\n", (unsigned long) oi1.addr, (unsigned long) oi2.addr); parallel_print( "------------------------------------------------------------\n"); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 7f08cc7..4ad4c90 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -154,9 +154,9 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t h5difftrace("build_match_list_attrs start\n"); - if(H5Oget_info(loc1_id, &oinfo1) < 0) + if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info first object failed"); - if(H5Oget_info(loc2_id, &oinfo2) < 0) + if(H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info second object failed"); table_attrs_init(&table_lp); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 11888bc..7ba82dd 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1758,14 +1758,14 @@ h5tools_is_obj_same(hid_t loc_id1, const char *name1, hbool_t ret_val = 0; if ( name1 && HDstrcmp(name1, ".")) - H5Oget_info_by_name(loc_id1, name1, &oinfo1, H5P_DEFAULT); + H5Oget_info_by_name2(loc_id1, name1, &oinfo1, 0, H5P_DEFAULT); else - H5Oget_info(loc_id1, &oinfo1); + H5Oget_info2(loc_id1, &oinfo1, 0); if ( name2 && HDstrcmp(name2, ".")) - H5Oget_info_by_name(loc_id2, name2, &oinfo2, H5P_DEFAULT); + H5Oget_info_by_name2(loc_id2, name2, &oinfo2, 0, H5P_DEFAULT); else - H5Oget_info(loc_id2, &oinfo2); + H5Oget_info2(loc_id2, &oinfo2, 0); if (oinfo1.fileno == oinfo2.fileno && oinfo1.addr==oinfo2.addr) ret_val = 1; diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 38ace81..42f9d05 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1905,7 +1905,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5O_info_t oinfo; obj_t *obj = NULL; /* Found object */ - H5Oget_info(type, &oinfo); + H5Oget_info2(type, &oinfo, 0); obj = search_obj(h5dump_type_table, oinfo.addr); if(obj) { diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index d6e5f01..a874c0f 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -113,7 +113,7 @@ init_ref_path_table(void) return (-1); /* Iterate over objects in this file */ - if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) { + if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL, 0) < 0) { error_msg("unable to construct reference path table\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ @@ -184,7 +184,7 @@ ref_path_table_lookup(const char *thepath) /* Get the object info now */ /* (returns failure for dangling soft links) */ - if(H5Oget_info_by_name(thefile, thepath, &oi, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(thefile, thepath, &oi, 0, H5P_DEFAULT) < 0) return HADDR_UNDEF; /* Return OID */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index a018394..3d029d2 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1120,7 +1120,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai const char *path; obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp); - H5Oget_info(obj, &oi); + H5Oget_info2(obj, &oi, 0); /* Print object type and close object */ switch(oi.type) { diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 5272e81..fad3c5b 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -507,7 +507,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen if(H5Tcommitted(type) > 0) { H5O_info_t type_oinfo; - H5Oget_info(type, &type_oinfo); + H5Oget_info2(type, &type_oinfo, 0); if(search_obj(info->type_table, type_oinfo.addr) == NULL) add_obj(info->type_table, type_oinfo.addr, name, FALSE); } /* end if */ @@ -573,7 +573,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, info->dset_table = *dset_table; /* Find all shared objects */ - return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info)); + return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, 0)); } @@ -729,7 +729,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ } /* get target object info */ - if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) { + if(H5Oget_info_by_name2(file_id, linkpath, &trg_oinfo, 0, lapl) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get object information for <%s>\n", linkpath); HGOTO_DONE(FAIL); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index b6d32f7..e2df439 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -43,6 +43,7 @@ typedef struct { hbool_t is_absolute; /* Whether the traversal has absolute paths */ const char *base_grp_name; /* Name of the group that serves as the base * for iteration */ + unsigned fields; /* Fields needed in H5O_info_t struct */ } trav_ud_traverse_t; typedef struct { @@ -201,7 +202,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, H5O_info_t oinfo; /* Get information about the object */ - if(H5Oget_info_by_name(loc_id, path, &oinfo, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) { if(new_name) HDfree(new_name); return(H5_ITER_ERROR); @@ -251,13 +252,13 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, */ static int traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, - hbool_t recurse, const trav_visitor_t *visitor) + hbool_t recurse, const trav_visitor_t *visitor, unsigned fields) { H5O_info_t oinfo; /* Object info for starting group */ int ret_value = SUCCEED; /* Get info for starting object */ - if(H5Oget_info_by_name(file_id, grp_name, &oinfo, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info_by_name failed"); /* Visit the starting object */ @@ -282,6 +283,7 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, udata.visitor = visitor; udata.is_absolute = (*grp_name == '/'); udata.base_grp_name = grp_name; + udata.fields = fields; /* Check for iteration of links vs. visiting all links recursively */ if(recurse) { @@ -356,9 +358,9 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id) size_t idx = info->nused - 1; if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".")) - H5Oget_info_by_name(loc_id, info->paths[idx].path, &oinfo, H5P_DEFAULT); + H5Oget_info_by_name2(loc_id, info->paths[idx].path, &oinfo, 0, H5P_DEFAULT); else - H5Oget_info(loc_id, &oinfo); + H5Oget_info2(loc_id, &oinfo, 0); info->paths[idx].objno = oinfo.addr; info->paths[idx].fileno = oinfo.fileno; @@ -436,7 +438,7 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info) info_visitor.udata = info; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(file_id, "/", TRUE, TRUE, &info_visitor) < 0) + if(traverse(file_id, "/", TRUE, TRUE, &info_visitor, 0) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: @@ -602,7 +604,7 @@ h5trav_gettable(hid_t fid, trav_table_t *table) table_visitor.udata = table; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(fid, "/", TRUE, TRUE, &table_visitor) < 0) + if(traverse(fid, "/", TRUE, TRUE, &table_visitor, 0) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: @@ -1027,7 +1029,7 @@ h5trav_print(hid_t fid) print_visitor.udata = &print_udata; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(fid, "/", TRUE, TRUE, &print_visitor) < 0) + if(traverse(fid, "/", TRUE, TRUE, &print_visitor, 0) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: @@ -1047,7 +1049,7 @@ done: int h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start, hbool_t recurse, h5trav_obj_func_t visit_obj, h5trav_lnk_func_t visit_lnk, - void *udata) + void *udata, unsigned fields) { trav_visitor_t visitor; /* Visitor structure for objects */ int ret_value = SUCCEED; @@ -1058,7 +1060,7 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start, visitor.udata = udata; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(fid, grp_name, visit_start, recurse, &visitor) < 0) + if(traverse(fid, grp_name, visit_start, recurse, &visitor, fields) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index c2ad9b7..a1d33b7 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -134,7 +134,7 @@ extern "C" { H5TOOLS_DLL void h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order); H5TOOLS_DLL int h5trav_visit(hid_t file_id, const char *grp_name, hbool_t visit_start, hbool_t recurse, h5trav_obj_func_t visit_obj, - h5trav_lnk_func_t visit_lnk, void *udata); + h5trav_lnk_func_t visit_lnk, void *udata, unsigned fields); H5TOOLS_DLL herr_t symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path); H5TOOLS_DLL hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path); |