Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how stats are printed in H5Z #4097

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/H5Z.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
#include "szlib.h"
#endif

/* This module can collect and optionally dump some simple filter statistics
* to stdout. If you want to do this, you need to define H5Z_DEBUG and set
* the DUMP_DEBUG_STATS_g flag to true.
*/

/* Local typedefs */
#ifdef H5Z_DEBUG
typedef struct H5Z_stats_t {
Expand Down Expand Up @@ -60,6 +65,8 @@ static size_t H5Z_table_used_g = 0;
static H5Z_class2_t *H5Z_table_g = NULL;
#ifdef H5Z_DEBUG
static H5Z_stats_t *H5Z_stat_table_g = NULL;
/* Set to true if you want to dump compression statistics to stdout */
static const bool DUMP_DEBUG_STATS_g = false;
#endif /* H5Z_DEBUG */

/* Local functions */
Expand Down Expand Up @@ -138,7 +145,7 @@ H5Z_term_package(void)
int dir, nprint = 0;
size_t i;

if (H5DEBUG(Z)) {
if (DUMP_DEBUG_STATS_g) {
for (i = 0; i < H5Z_table_used_g; i++) {
for (dir = 0; dir < 2; dir++) {
struct {
Expand All @@ -153,11 +160,11 @@ H5Z_term_package(void)

if (0 == nprint++) {
/* Print column headers */
fprintf(H5DEBUG(Z), "H5Z: filter statistics "
"accumulated over life of library:\n");
fprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "Filter", "Total", "Errors",
fprintf(stdout, "H5Z: filter statistics "
"accumulated over life of library:\n");
fprintf(stdout, " %-16s %10s %10s %8s %8s %8s %10s\n", "Filter", "Total", "Errors",
"User", "System", "Elapsed", "Bandwidth");
fprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "------", "-----", "------",
fprintf(stdout, " %-16s %10s %10s %8s %8s %8s %10s\n", "------", "-----", "------",
"----", "------", "-------", "---------");
} /* end if */

Expand All @@ -174,7 +181,7 @@ H5Z_term_package(void)
H5Z_stat_table_g[i].stats[dir].times.elapsed);

/* Print the statistics */
fprintf(H5DEBUG(Z), " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE " %8s %8s %8s %10s\n",
fprintf(stdout, " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE " %8s %8s %8s %10s\n",
(dir ? "<" : ">"), comment, H5Z_stat_table_g[i].stats[dir].total,
H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system,
timestrs.elapsed, bandwidth);
Expand Down Expand Up @@ -205,7 +212,7 @@ H5Z_term_package(void)
/*-------------------------------------------------------------------------
* Function: H5Zregister
*
* Purpose: This function registers new filter.
* Purpose: This function registers a new filter
*
* Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
Expand Down
Loading