diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-03-02 12:34:09 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-03-02 12:34:09 (GMT) |
commit | 7d53a8b8375ed235f2387cecce1016c914971006 (patch) | |
tree | 5520062228cff73b7e6dde6566512cf4718ae83a /src | |
parent | 6661b21e9a948aa7790be13409f5b3e69c2ebbc9 (diff) | |
download | hdf5-7d53a8b8375ed235f2387cecce1016c914971006.zip hdf5-7d53a8b8375ed235f2387cecce1016c914971006.tar.gz hdf5-7d53a8b8375ed235f2387cecce1016c914971006.tar.bz2 |
Removed the rest of the hlog code
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/H5C.c | 6 | ||||
-rw-r--r-- | src/H5FDvfd_swmr.c | 43 | ||||
-rw-r--r-- | src/H5FDvfd_swmr_private.h | 6 | ||||
-rw-r--r-- | src/H5Fvfd_swmr.c | 117 | ||||
-rw-r--r-- | src/H5PB.c | 52 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/hlog.c | 366 | ||||
-rw-r--r-- | src/hlog.h | 138 |
9 files changed, 5 insertions, 728 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index af4920b..038948c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,7 +12,6 @@ set (H5_SOURCES ${HDF5_SRC_DIR}/H5system.c ${HDF5_SRC_DIR}/H5timer.c ${HDF5_SRC_DIR}/H5trace.c - ${HDF5_SRC_DIR}/hlog.c ) set (H5_HDRS @@ -816,7 +815,6 @@ set (H5_PUBLIC_HEADERS set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5private.h - ${HDF5_SRC_DIR}/hlog.h ${HDF5_SRC_DIR}/H5Apkg.h ${HDF5_SRC_DIR}/H5Aprivate.h @@ -1325,13 +1325,7 @@ H5C_evict_or_refresh_all_entries_in_page(H5F_t * f, uint64_t page, entry_ptr = entry_ptr->pi_next; } - if (!found) { - hlog_fast(mdc_invalidation, "no MDC match for page %" PRIu64 - " length %" PRIu32 " tick %" PRIu64, page, length, tick); - } - done: - FUNC_LEAVE_NOAPI(ret_value) } /* H5C_evict_or_refresh_all_entries_in_page() */ diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c index 6e29376..bc82be5 100644 --- a/src/H5FDvfd_swmr.c +++ b/src/H5FDvfd_swmr.c @@ -103,12 +103,6 @@ static htri_t H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, H5FD_vfd_swmr_md_index *md_index, const H5FD_vfd_swmr_md_header *md_header); static herr_t H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *, hbool_t); -HLOG_OUTLET_SHORT_DEFN(index_motion, swmr); -HLOG_OUTLET_SHORT_DEFN(swmr_stats, swmr); -HLOG_OUTLET_SHORT_DEFN(swmr_read, swmr); -HLOG_OUTLET_SHORT_DEFN(swmr_read_exception, swmr_read); -HLOG_OUTLET_MEDIUM_DEFN(swmr_read_err, swmr_read_exception, HLOG_OUTLET_S_ON); - static const H5FD_class_t H5FD_vfd_swmr_g = { "vfd_swmr", /* name */ MAXADDR, /* maxaddr */ @@ -430,15 +424,8 @@ swmr_reader_close(H5FD_vfd_swmr_t *file) { vfd_swmr_reader_did_increase_tick_to(0); - if (file->api_elapsed_ticks != NULL) { - uint32_t i; - for (i = 0; i < file->api_elapsed_nbuckets; i++) { - hlog_fast(swmr_stats, - "%s: %" PRIu32 " ticks elapsed in API %" PRIu64 " times", - __func__, i, file->api_elapsed_ticks[i]); - } + if (file->api_elapsed_ticks != NULL) H5MM_xfree(file->api_elapsed_ticks); - } /* Close the metadata file */ if(file->md_fd >= 0 && HDclose(file->md_fd) < 0) { @@ -858,10 +845,6 @@ H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, entry = vfd_swmr_pageno_to_mdf_idx_entry(index, num_entries, target_page, false); - hlog_fast(swmr_read, "%s: enter type %d addr %" PRIuHADDR " size %zu " - "file %s", __func__, type, addr, size, - (entry == NULL) ? "lower" : "shadow"); - if (entry == NULL) { /* Cannot find addr in index, read from the underlying hdf5 file */ if(H5FD_read(file->hdf5_file_lf, type, addr, size, buf) < 0) { @@ -926,31 +909,14 @@ H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, * is John's hack to allow the library to find the superblock * signature. */ - if (!file->pb_configured) { - hlog_fast(swmr_read_exception, - "%s: skipping checksum, page buffer not configured", __func__); - } else if (entry->length != init_size) { - hlog_fast(swmr_read_exception, - "%s: skipping checksum, buffer size != entry size", __func__); - } else if (H5_checksum_metadata(buf, entry->length, 0) != entry->chksum) { + if (H5_checksum_metadata(buf, entry->length, 0) != entry->chksum) { H5FD_vfd_swmr_md_header tmp_header; - hlog_fast(swmr_read_err, "%s: bad checksum", __func__); - hlog_fast(swmr_read_err, "addr %" PRIuHADDR " page %" PRIuHADDR - " len %zu type %d ...", addr, addr / fs_page_size, init_size, type); - hlog_fast(swmr_read_err, "... index[%" PRId64 "] lower pgno %" PRIu64 - " shadow pgno %" PRIu64 " len %" PRIu32 " sum %" PRIx32, - (int64_t)(entry - index), entry->hdf5_page_offset, - entry->md_file_page_offset, entry->length, entry->chksum); - if (H5FD__vfd_swmr_header_deserialize(file, &tmp_header) != TRUE) { HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, "checksum error in shadow file entry; could not load header"); } - hlog_fast(swmr_read_err, "... header tick last read %" PRIu64 - " latest %" PRIu64, file->md_header.tick_num, tmp_header.tick_num); - HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, "checksum error in shadow file entry"); } @@ -1145,11 +1111,8 @@ H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *file, hbool_t open) if (rc != TRUE) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not read header"); - if (md_header.index_offset != last_index_offset) { - hlog_fast(index_motion, "index offset changed %" PRIu64 "\n", - md_header.index_offset); + if (md_header.index_offset != last_index_offset) last_index_offset = md_header.index_offset; - } if (open) ; // ignore tick number on open diff --git a/src/H5FDvfd_swmr_private.h b/src/H5FDvfd_swmr_private.h index 74a937f..feb75c9 100644 --- a/src/H5FDvfd_swmr_private.h +++ b/src/H5FDvfd_swmr_private.h @@ -13,7 +13,6 @@ #define _H5FDvfd_swmr_private_H #include "H5queue.h" /* for TAILQ_* */ -#include "hlog.h" /* for TAILQ_* */ /* Forward declaration */ struct H5F_t; @@ -64,11 +63,6 @@ typedef TAILQ_HEAD(eot_queue, eot_queue_entry) eot_queue_t; extern eot_queue_t eot_queue_g; -HLOG_OUTLET_DECL(swmr); -HLOG_OUTLET_DECL(pbwr); -HLOG_OUTLET_DECL(shadow_index_reclaim); -HLOG_OUTLET_DECL(mdc_invalidation); - /***************************************/ /* Library-private Function Prototypes */ /***************************************/ diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index fafff01..b408e54 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -48,7 +48,6 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ -#include "hlog.h" /****************/ /* Local Macros */ @@ -85,18 +84,6 @@ unsigned int vfd_swmr_api_entries_g = 0;/* Times the library was entered * on the 0->1 and 1->0 * transitions. */ -HLOG_OUTLET_SHORT_DEFN(swmr, all); -HLOG_OUTLET_SHORT_DEFN(eot, swmr); -HLOG_OUTLET_SHORT_DEFN(eotq, eot); -HLOG_OUTLET_SHORT_DEFN(shadow_defrees, swmr); -HLOG_OUTLET_MEDIUM_DEFN(noisy_shadow_defrees, shadow_defrees, - HLOG_OUTLET_S_OFF); -HLOG_OUTLET_SHORT_DEFN(shadow_index_enlarge, swmr); -HLOG_OUTLET_SHORT_DEFN(shadow_index_reclaim, swmr); -HLOG_OUTLET_SHORT_DEFN(shadow_index_update, swmr); -HLOG_OUTLET_SHORT_DEFN(tick, swmr); -HLOG_OUTLET_SHORT_DEFN(mdc_invalidation, swmr); - /* * The head of the end of tick queue (EOT queue) for files opened in either * VFD SWMR write or VFD SWMR read mode @@ -249,9 +236,6 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create) HDassert(shared->tick_num != 0); vfd_swmr_reader_did_increase_tick_to(shared->tick_num); - hlog_fast(tick, "%s first tick %" PRIu64, - __func__, shared->tick_num); - #if 0 /* JRM */ HDfprintf(stderr, "##### initialized index: tick/used/len = %lld/%d/%d #####\n", @@ -347,7 +331,6 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) TAILQ_REMOVE(&shared->shadow_defrees, curr, link); H5FL_FREE(shadow_defree_t, curr); } - hlog_fast(shadow_defrees, "Emptied deferred shadow frees."); HDassert(TAILQ_EMPTY(&shared->shadow_defrees)); } else { /* For file flush */ @@ -372,9 +355,6 @@ shadow_range_defer_free(H5F_shared_t *shared, uint64_t offset, uint32_t length) shadow_defree->length = length; shadow_defree->tick_num = shared->tick_num; - if (TAILQ_EMPTY(&shared->shadow_defrees)) - hlog_fast(shadow_defrees, "Adding first deferred shadow free."); - TAILQ_INSERT_HEAD(&shared->shadow_defrees, shadow_defree, link); return 0; } @@ -474,10 +454,6 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, \ "error in allocating space from the metadata file") - hlog_fast(noisy_shadow_defrees, - "shadow index %" PRIu32 " page offset %" PRIu64 " -> %" PRIuHADDR, - i, index[i].md_file_page_offset * shared->fs_page_size, md_addr); - HDassert(md_addr % shared->fs_page_size == 0); /* Compute checksum and update the index entry */ @@ -558,20 +534,12 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, "unable to flush clean entry"); } - hlog_fast(noisy_shadow_defrees, - "released %" PRIu32 " bytes at %" PRIu64, - shadow_defree->length, shadow_defree->offset); - TAILQ_REMOVE(&shared->shadow_defrees, shadow_defree, link); H5FL_FREE(shadow_defree_t, shadow_defree); } - if (queue_was_nonempty && TAILQ_EMPTY(&shared->shadow_defrees)) - hlog_fast(shadow_defrees, "Removed last deferred shadow free."); - done: - FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_update_vfd_swmr_metadata_file() */ @@ -740,22 +708,11 @@ clean_shadow_index(H5F_t *f, uint32_t nentries, for (i = j = ndeleted = 0; i < nentries; i++) { ie = &idx[i]; - if (ie->clean) { - hlog_fast(shadow_index_reclaim, - "Visiting clean shadow index slot %" PRIu32 - " lower page %" PRIu64 " last flush %" PRIu64 " ticks ago", - i, ie->hdf5_page_offset, tick_num - ie->tick_of_last_flush); - } - if (ie->clean && ie->tick_of_last_flush + max_lag < tick_num) { HDassert(!ie->garbage); HDassert(ie->entry_ptr == NULL); - hlog_fast(shadow_index_reclaim, - "Reclaiming shadow index slot %" PRIu32 - " lower page %" PRIu64, i, ie->hdf5_page_offset); - if (ie->md_file_page_offset != 0) { if (shadow_image_defer_free(shared, ie) == -1) return -1; @@ -992,9 +949,6 @@ update_eot: if(H5F_vfd_swmr_insert_entry_eot(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to insert entry into the EOT queue") - hlog_fast(eot, "%s leave tick %" PRIu64 " idx len %" PRIu32, - __func__, shared->tick_num, shared->mdf_idx_entries_used); - done: FUNC_LEAVE_NOAPI(ret_value) } @@ -1119,10 +1073,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) HDassert(!shared->vfd_swmr_writer); HDassert(file); - hlog_fast(eot, "%s enter file %p index len %" PRIu32 " used %" PRIu32, - __func__, (void *)file, - shared->mdf_idx_len, shared->mdf_idx_entries_used); - /* 1) Direct the VFD SWMR reader VFD to load the current header * from the metadata file, and report the current tick. * @@ -1135,10 +1085,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, \ "error in retrieving tick_num from driver") - hlog_fast(tick, - "%s last tick %" PRIu64 " new tick %" PRIu64, - __func__, shared->tick_num, tmp_tick_num); - /* This is ok if we're entering the API, but it should * not happen if we're exiting the API. */ @@ -1246,13 +1192,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) */ HDassert(oent->length == nent->length); - hlog_fast(shadow_index_update, - "shadow page for slot %" PRIu32 " lower page %" PRIu64 - " moved, %" PRIu64 " -> %" PRIu64, i, - oent->hdf5_page_offset, - oent->md_file_page_offset, - nent->md_file_page_offset); - /* the page has been altered -- evict it and * any contained metadata cache entries. */ @@ -1274,10 +1213,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) * for several ticks, we can probably omit this. However, * lets not worry about this for the first cut. */ - hlog_fast(shadow_index_update, - "writer removed shadow index slot %" PRIu32 - " for page %" PRIu64, i, oent->hdf5_page_offset); - change[nchanges].pgno = oent->hdf5_page_offset; change[nchanges].length = oent->length; nchanges++; @@ -1288,10 +1223,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) * nent->hdf5_page_offset */ - hlog_fast(shadow_index_update, - "writer added shadow index slot %" PRIu32 - " for page %" PRIu64, j, nent->hdf5_page_offset); - /* The page has been added to the index. */ change[nchanges].pgno = nent->hdf5_page_offset; change[nchanges].length = nent->length; @@ -1303,9 +1234,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) for (; j < new_mdf_idx_entries_used; j++) { const H5FD_vfd_swmr_idx_entry_t *nent = &new_mdf_idx[j]; - hlog_fast(shadow_index_update, - "writer added shadow index slot %" PRIu32 - " for page %" PRIu64, j, nent->hdf5_page_offset); change[nchanges].pgno = nent->hdf5_page_offset; change[nchanges].length = nent->length; nchanges++; @@ -1320,11 +1248,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) * index. Evict it from the page buffer and also evict any * contained metadata cache entries */ - - hlog_fast(shadow_index_update, - "writer removed shadow index slot %" PRIu32 - " for page %" PRIu64, i, oent->hdf5_page_offset); - change[nchanges].pgno = oent->hdf5_page_offset; change[nchanges].length = oent->length; nchanges++; @@ -1339,10 +1262,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) } } for (i = 0; i < nchanges; i++) { - hlog_fast(mdc_invalidation, - "invalidating MDC entries at page %" PRIu64 - " length %" PRIu32 " tick %" PRIu64, - change[i].pgno, change[i].length, tmp_tick_num); if (H5C_evict_or_refresh_all_entries_in_page(f, change[i].pgno, change[i].length, tmp_tick_num) < 0) { @@ -1387,16 +1306,6 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, bool entering_api) done: - hlog_fast(eot, "%s exit tick %" PRIu64 - " len %" PRIu32 " -> %" PRIu32 - " used %" PRIu32 " -> %" PRIu32 - " added %" PRIu32 " removed %" PRIu32 " moved %" PRIu32 " %s", - __func__, shared->tick_num, - shared->old_mdf_idx_len, shared->mdf_idx_len, - shared->old_mdf_idx_entries_used, shared->mdf_idx_entries_used, - entries_added, entries_removed, entries_moved, - (ret_value == SUCCEED) ? "success" : "failure"); - if (change != NULL) free(change); @@ -1415,12 +1324,6 @@ insert_eot_entry(eot_queue_entry_t *entry_ptr) break; } - hlog_fast(eotq, "%s: entry %p after %p file %p " - "tick %" PRIu64 " ending %jd.%09ld", __func__, - (void *)entry_ptr, (void *)prec_ptr, (void *)entry_ptr->vfd_swmr_file, - entry_ptr->tick_num, (intmax_t)entry_ptr->end_of_tick.tv_sec, - entry_ptr->end_of_tick.tv_nsec); - /* Insert the entry onto the EOT queue */ if (prec_ptr != NULL) TAILQ_INSERT_AFTER(&eot_queue_g, prec_ptr, entry_ptr, link); @@ -1441,20 +1344,10 @@ H5F_vfd_swmr_update_entry_eot(eot_queue_entry_t *entry) TAILQ_REMOVE(&eot_queue_g, entry, link); - hlog_fast(eotq, "%s: updating entry %p file %p " - "tick %" PRIu64 " ending %jd.%09ld", __func__, - (void *)entry, (void *)entry->vfd_swmr_file, - entry->tick_num, (intmax_t)entry->end_of_tick.tv_sec, - entry->end_of_tick.tv_nsec); - HDassert(entry->vfd_swmr_writer == shared->vfd_swmr_writer); entry->tick_num = shared->tick_num; entry->end_of_tick = shared->end_of_tick; - hlog_fast(eotq, "%s: ... to tick %" PRIu64 " ending %jd.%09ld", __func__, - entry->tick_num, (intmax_t)entry->end_of_tick.tv_sec, - entry->end_of_tick.tv_nsec); - insert_eot_entry(entry); } @@ -1487,11 +1380,6 @@ H5F_vfd_swmr_remove_entry_eot(H5F_t *f) } if (curr != NULL) { - hlog_fast(eotq, "%s: entry %p file %p " - "tick %" PRIu64 " ending %jd.%09ld", __func__, - (void *)curr, (void *)curr->vfd_swmr_file, curr->tick_num, - (intmax_t)curr->end_of_tick.tv_sec, - curr->end_of_tick.tv_nsec); TAILQ_REMOVE(&eot_queue_g, curr, link); curr = H5FL_FREE(eot_queue_entry_t, curr); } @@ -1632,9 +1520,6 @@ H5F__vfd_swmr_update_end_of_tick_and_tick_num(H5F_shared_t *shared, shared->tick_num++; - hlog_fast(tick, "%s tick %" PRIu64 " -> %" PRIu64, - __func__, shared->tick_num - 1, shared->tick_num); - if ( H5PB_vfd_swmr__set_tick(shared) < 0 ) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, \ @@ -1951,8 +1836,6 @@ vfd_swmr_enlarge_shadow_index(H5F_t *f) FUNC_ENTER_NOAPI(NULL) - hlog_fast(shadow_index_enlarge, "Enlarging shadow index."); - old_mdf_idx = shared->mdf_idx; old_mdf_idx_len = shared->mdf_idx_len; @@ -45,8 +45,6 @@ #include "H5PBpkg.h" /* File access */ -#include "hlog.h" - /****************/ /* Local Macros */ /****************/ @@ -143,17 +141,6 @@ H5FL_DEFINE_STATIC(H5PB_t); /* Declare a free list to manage the H5PB_entry_t struct */ H5FL_DEFINE_STATIC(H5PB_entry_t); -HLOG_OUTLET_DECL(pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pagebuffer, all); -HLOG_OUTLET_SHORT_DEFN(pb_access_sizes, pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pbflush, pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pbflush_entry, pbflush); -HLOG_OUTLET_SHORT_DEFN(pbio, pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pbrd, pbio); -HLOG_OUTLET_SHORT_DEFN(pbwr, pbio); -HLOG_OUTLET_SHORT_DEFN(lengthen_pbentry, pagebuffer); -HLOG_OUTLET_SHORT_DEFN(pbrm, pagebuffer); - /*------------------------------------------------------------------------- * @@ -862,19 +849,11 @@ H5PB_flush(H5F_shared_t *shared) flush_ptr = entry_ptr; entry_ptr = entry_ptr->ht_next; - hlog_fast(pbflush, "%s: visiting %zu-byte page %" PRIu64, - __func__, flush_ptr->size, flush_ptr->page); if ( flush_ptr->is_dirty ) { - if (flush_ptr->delay_write_until != 0) { - hlog_fast(pbflush, "%s: delaying %zu-byte page %" PRIu64 - " until %" PRIu64 " (now %" PRIu64 ")", - __func__, flush_ptr->size, flush_ptr->page, - flush_ptr->delay_write_until, - shared->tick_num); + if (flush_ptr->delay_write_until != 0) continue; - } if ( H5PB__flush_entry(shared, pb_ptr, flush_ptr) < 0 ) @@ -967,20 +946,10 @@ H5PB_log_access_by_size_counts(const H5PB_t *pb) const size_t nslots = NELMTS(pb->access_size_count); size_t i, lo, hi; - hlog_fast(pb_access_sizes, "page buffer %p metadata accesses by size:", - (const void *)pb); - for (lo = 0, hi = pb->page_size, i = 0; i < nslots - 1; i++, lo = hi + 1, hi *= 2) { - hlog_fast(pb_access_sizes, - "%16" PRIu64 " accesses %8zu - %8zu bytes long", - pb->access_size_count[i], lo, hi); } - - hlog_fast(pb_access_sizes, - "%16" PRIu64 " accesses %8zu - greater bytes long", - pb->access_size_count[i], lo); } @@ -1179,10 +1148,6 @@ H5PB_read(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, size_t size, /* Sanity checks */ HDassert(shared); - hlog_fast(pbrd, "%s %p type %d %" PRIuHADDR " size %zu", - __func__, (void *)shared, type, addr, size); - - pb_ptr = shared->pb_ptr; if (pb_ptr != NULL && type != H5FD_MEM_DRAW) @@ -2333,9 +2298,6 @@ H5PB_vfd_swmr__update_index(H5F_t *f, H5PB__SEARCH_INDEX(pb_ptr, ie_ptr->hdf5_page_offset, entry, FAIL); if (entry == NULL || !entry->is_dirty) { - hlog_fast(shadow_index_reclaim, - "Marking shadow index slot %" PRIu32 " clean at tick %" PRIu64, - i, tick_num); idx_ent_not_in_tl_flushed++; ie_ptr->clean = TRUE; ie_ptr->tick_of_last_flush = tick_num; @@ -2522,9 +2484,6 @@ H5PB_write(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, size_t size, FUNC_ENTER_NOAPI(FAIL) - hlog_fast(pbwr, "%s %p type %d addr %" PRIuHADDR " size %zu", - __func__, (void *)shared, type, addr, size); - pb_ptr = shared->pb_ptr; if (pb_ptr != NULL && type != H5FD_MEM_DRAW) @@ -3338,10 +3297,6 @@ H5PB__flush_entry(H5F_shared_t *shared, H5PB_t *pb_ptr, H5PB_entry_t *const entr HDassert((pb_ptr->vfd_swmr_writer) || (!(entry_ptr->is_mpmde))); HDassert(0 == entry_ptr->delay_write_until); - hlog_fast(pbflush_entry, - "%s: flushing %zu-byte page %" PRIu64 " @ %" PRIuHADDR, - __func__, entry_ptr->size, entry_ptr->page, entry_ptr->addr); - /* Retrieve the 'eoa' for the file */ if ( HADDR_UNDEF == (eoa = H5FD_get_eoa(shared->lf, entry_ptr->mem_type)) ) @@ -4718,11 +4673,6 @@ H5PB__write_meta(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, uint64_t last_page = page + roundup(size, pb_ptr->page_size) / pb_ptr->page_size; - hlog_fast(lengthen_pbentry, - "lengthening page %" PRIu64 " from %zu bytes to %zu, " - "last page %" PRIu64 "\n", page, entry_ptr->size, size, - last_page); - for (iter_page = page + 1; iter_page < last_page; iter_page++) { H5PB__SEARCH_INDEX(pb_ptr, iter_page, overlap, FAIL) HDassert(overlap == NULL); diff --git a/src/Makefile.am b/src/Makefile.am index cb3fa3c..bf565d8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -115,8 +115,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \ H5VLpassthru.c \ H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ - H5Zscaleoffset.c H5Zszip.c H5Ztrans.c \ - hlog.c + H5Zscaleoffset.c H5Zszip.c H5Ztrans.c # Only compile parallel sources if necessary if BUILD_PARALLEL_CONDITIONAL diff --git a/src/hlog.c b/src/hlog.c deleted file mode 100644 index d2d0e51..0000000 --- a/src/hlog.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights reserved. - * - * See COPYING at the top of the HDF5 distribution for license terms. - */ -/* - * Copyright (c) 2004 Urbana-Champaign Independent Media Center. - * All rights reserved. - * - * See COPYING at the top of the HDF5 distribution for license terms. - */ -#include <err.h> -#include <errno.h> -#include <stdarg.h> -#include <stdbool.h> -#include <stdint.h> /* for uintmax_t */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include <sys/param.h> -#include <sys/cdefs.h> - -#include "hlog.h" -#include "H5time_private.h" - -TAILQ_HEAD(, hlog_outlet) hlog_outlets = TAILQ_HEAD_INITIALIZER(hlog_outlets); - -HLOG_OUTLET_TOP_DEFN(all); - -static struct timespec timestamp_zero; - -void hlog_init(void) _constructor; -static void hlog_init_timestamps(void); - -void -hlog_init(void) -{ - const char *settings0; - char *item, *settings; - - if ((settings0 = getenv("HLOG")) == NULL) - return; - - if ((settings = strdup(settings0)) == NULL) { - warn("%s: cannot duplicate settings string", __func__); - return; - } - - while ((item = strsep(&settings, " ,")) != NULL) { - hlog_outlet_state_t state; - char key[64 + 1], val[4 + 1]; // + 1 for the terminating NUL - int nconverted; - - nconverted = sscanf(item, " %64[0-9a-z_] = %4s ", key, val); - if (nconverted != 2) { - warnx("%s: malformed HLOG item \"%s\"", __func__, item); - continue; - } - - if (strcmp(val, "on") == 0 || strcmp(val, "yes") == 0) - state = HLOG_OUTLET_S_ON; - else if (strcmp(val, "off") == 0 || strcmp(val, "no") == 0) - state = HLOG_OUTLET_S_OFF; - else if (strcmp(val, "pass") == 0) - state = HLOG_OUTLET_S_PASS; - else { - warnx("%s: bad HLOG value \"%s\" in item \"%s\"", __func__, - val, item); - continue; - } - - if (hlog_set_state(key, state, true) == -1) { - warn("%s: could not set state for HLOG item \"%s\"", __func__, - item); - } - } - - free(settings); -} - - -static void -hlog_init_timestamps(void) -{ - static bool initialized = false; - - if (initialized) - return; - - if (clock_gettime(CLOCK_MONOTONIC, ×tamp_zero) == -1) - err(EXIT_FAILURE, "%s: clock_gettime", __func__); - - initialized = true; -} - -static void -hlog_print_time(void) -{ - struct timespec elapsed, now; - - hlog_init_timestamps(); - - if (clock_gettime(CLOCK_MONOTONIC, &now) == -1) - err(EXIT_FAILURE, "%s: clock_gettime", __func__); - - timespecsub(&now, ×tamp_zero, &elapsed); - - fprintf(stderr, "%ju.%.9ld ", (uintmax_t)elapsed.tv_sec, elapsed.tv_nsec); -} - -void -vhlog(const char *fmt, va_list ap) -{ - hlog_print_time(); - (void)vfprintf(stderr, fmt, ap); - (void)fputc('\n', stderr); -} - -static char * -message_extend_stderr(const char *fmt0) -{ - static const char sep[] = ": "; - const char *m; - char *fmt; - size_t fmtlen; - - m = strerror(errno); - - fmtlen = strlen(fmt0) + strlen(m) + sizeof(sep); - - if ((fmt = malloc(fmtlen)) == NULL) { - err(EXIT_FAILURE, "%s: malloc failed", __func__); - return NULL; - } - - /* Note well the safe strcpy, strcat usage. Thank you. */ - strcpy(fmt, fmt0); - strcat(fmt, sep); - strcat(fmt, m); - - return fmt; -} - -static char * -message_extend(const char *fmt0) -{ - return message_extend_stderr(fmt0); -} - -void -vhlog_err(int status, const char *fmt0, va_list ap) -{ - char *fmt; - - if ((fmt = message_extend(fmt0)) == NULL) - exit(status); - vhlog(fmt, ap); - free(fmt); - - exit(status); -} - -void -vhlog_errx(int status, const char *fmt, va_list ap) -{ - vhlog(fmt, ap); - exit(status); -} - -void -vhlog_warn(const char *fmt0, va_list ap) -{ - char *fmt; - - if ((fmt = message_extend(fmt0)) == NULL) - return; - vhlog(fmt, ap); - free(fmt); -} - -void -vhlog_warnx(const char *fmt, va_list ap) -{ - vhlog(fmt, ap); -} - -void -hlog_err(int status, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog_err(status, fmt, ap); - va_end(ap); -} - -void -hlog_errx(int status, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog_errx(status, fmt, ap); - va_end(ap); -} - -void -hlog_warn(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog_warn(fmt, ap); - va_end(ap); -} - -void -hlog_warnx(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog_warnx(fmt, ap); - va_end(ap); -} - -struct hlog_outlet * -hlog_outlet_find_active(struct hlog_outlet *ls0) -{ - struct hlog_outlet *ls; - - HLOG_OUTLET_FOREACH(ls, ls0) { - switch (ls->ls_state) { - case HLOG_OUTLET_S_PASS: - continue; - case HLOG_OUTLET_S_OFF: - return NULL; - case HLOG_OUTLET_S_ON: - default: - return ls; - } - } - return NULL; -} - -void -hlog_always(struct hlog_outlet *ls _unused, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vhlog(fmt, ap); - va_end(ap); -} - -void -hlog_impl(struct hlog_outlet *ls0, const char *fmt, ...) -{ - struct hlog_outlet *ls; - va_list ap; - - if ((ls = hlog_outlet_find_active(ls0)) == NULL) { - ls0->ls_resolved = HLOG_OUTLET_S_OFF; - return; - } - - ls0->ls_resolved = HLOG_OUTLET_S_ON; - - va_start(ap, fmt); - vhlog(fmt, ap); - va_end(ap); -} - -static void -hlog_outlet_reset_all(void) -{ - struct hlog_outlet *ls; - - TAILQ_FOREACH(ls, &hlog_outlets, ls_next) - ls->ls_resolved = HLOG_OUTLET_S_PASS; -} - -struct hlog_outlet * -hlog_outlet_lookup(const char *name) -{ - struct hlog_outlet *ls; - - TAILQ_FOREACH(ls, &hlog_outlets, ls_next) { - if (strcmp(ls->ls_name, name) == 0) - return ls; - } - return NULL; -} - -static struct hlog_outlet * -hlog_outlet_create(const char *name) -{ - struct hlog_outlet *ls; - - if ((ls = calloc(1, sizeof(*ls))) == NULL) - return NULL; - else if ((ls->ls_name0 = strdup(name)) == NULL) { - free(ls); - return NULL; - } - ls->ls_name = ls->ls_name0; - ls->ls_rendezvous = true; - return ls; -} - -static void -hlog_outlet_destroy(struct hlog_outlet *ls) -{ - /*LINTED*/ - if (ls->ls_name0 != NULL) - free(ls->ls_name0); - free(ls); -} - -int -hlog_set_state(const char *name, hlog_outlet_state_t state, bool rendezvous) -{ - struct hlog_outlet *ls; - errno = 0; - - switch (state) { - case HLOG_OUTLET_S_PASS: - case HLOG_OUTLET_S_OFF: - case HLOG_OUTLET_S_ON: - break; - default: - errno = EINVAL; - return -1; - } - if ((ls = hlog_outlet_lookup(name)) == NULL && !rendezvous) { - errno = ESRCH; - return -1; - } else if (ls == NULL) { - if ((ls = hlog_outlet_create(name)) == NULL) - return -1; - TAILQ_INSERT_TAIL(&hlog_outlets, ls, ls_next); - } - ls->ls_state = state; - hlog_outlet_reset_all(); - return 0; -} - -void -hlog_outlet_register(struct hlog_outlet *ls_arg) -{ - struct hlog_outlet *ls; - if ((ls = hlog_outlet_lookup(ls_arg->ls_name)) == NULL || - ls->ls_rendezvous) { - TAILQ_INSERT_TAIL(&hlog_outlets, ls_arg, ls_next); - if (ls == NULL) - return; - warnx("%s: rendezvous with log-outlet '%s'", __func__, - ls->ls_name); - ls_arg->ls_state = ls->ls_state; - TAILQ_REMOVE(&hlog_outlets, ls, ls_next); - hlog_outlet_destroy(ls); - } else - warnx("%s: duplicate log-outlet, '%s'", __func__, ls->ls_name); -} diff --git a/src/hlog.h b/src/hlog.h deleted file mode 100644 index 2489a47..0000000 --- a/src/hlog.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights reserved. - * - * See COPYING at the top of the HDF5 distribution for license terms. - */ -/* - * Copyright (c) 2004 Urbana-Champaign Independent Media Center. - * All rights reserved. - * - * See COPYING at the top of the HDF5 distribution for license terms. - */ -#ifndef _HLOG_H -#define _HLOG_H - -#include <stdarg.h> -#include <stdbool.h> -#include <syslog.h> -#include <sys/cdefs.h> - -#include "H5queue.h" - -#ifndef _unused -#define _unused __attribute__((unused)) -#endif - -#ifndef _constructor -#define _constructor __attribute__((constructor)) -#endif - -#ifndef _noreturn -#define _noreturn __attribute__((__noreturn__)) -#endif - -#ifndef _printflike -#define _printflike(_fmt, _args) \ - __attribute__((__format__(__printf__,_fmt,_args))) -#endif - -enum hlog_outlet_state { - HLOG_OUTLET_S_PASS = 0 - , HLOG_OUTLET_S_OFF = 1 - , HLOG_OUTLET_S_ON = 2 -}; - -typedef enum hlog_outlet_state hlog_outlet_state_t; - -struct hlog_outlet { - hlog_outlet_state_t ls_resolved; - struct hlog_outlet *ls_parent; - hlog_outlet_state_t ls_state; - const char *ls_name; - char *ls_name0; - bool ls_rendezvous; - TAILQ_ENTRY(hlog_outlet) ls_next; -}; - -typedef struct hlog_outlet hlog_outlet_t; - -#define HLOG_CONSTRUCTOR(__sym) \ -void hlog_constructor_##__sym(void) _constructor; \ -void \ -hlog_constructor_##__sym(void) \ -{ \ - hlog_outlet_register(&__sym); \ -} \ -void hlog_undefined_##__sym(void) _constructor - -#define HLOG_OUTLET_FOREACH(__le, __le0) \ - for ((__le) = (__le0); (__le) != NULL; (__le) = (__le)->ls_parent) - -#define HLOG_OUTLET_DECL1(__sym) extern struct hlog_outlet __sym - -#define HLOG_JOIN_SYMS(x, y) x ## y - -#define HLOG_PREFIX(_sfx) HLOG_JOIN_SYMS(hlog_gbl_, _sfx) - -#define HLOG_OUTLET_DECL(__name) HLOG_OUTLET_DECL1(HLOG_PREFIX(__name)) - -#define HLOG_OUTLET_DEFN(__sym, __name, __parent, __state) \ - struct hlog_outlet __sym = { \ - .ls_name = __name \ - , .ls_parent = (__parent) \ - , .ls_state = (__state) \ - }; \ - HLOG_CONSTRUCTOR(__sym) - -#define HLOG_OUTLET_MEDIUM_DEFN(__name, __parent, __state) \ - HLOG_OUTLET_DEFN(HLOG_PREFIX(__name), #__name, &HLOG_PREFIX(__parent), \ - __state) - -#define HLOG_OUTLET_SHORT_DEFN(__name, __parent) \ - HLOG_OUTLET_MEDIUM_DEFN(__name, __parent, HLOG_OUTLET_S_PASS) - -#define HLOG_OUTLET_TOP_DEFN(__name) \ - HLOG_OUTLET_DEFN(HLOG_PREFIX(__name), #__name, NULL, HLOG_OUTLET_S_PASS) - -HLOG_OUTLET_DECL(all); - -#define hlog(_name, _fmt, ...) \ - hlog_impl(&HLOG_PREFIX(_name), _fmt, __VA_ARGS__) - -#define hlog_fast(_name, ...) \ - do { \ - hlog_outlet_t *_ls0 = &HLOG_PREFIX(_name); \ - \ - if (_ls0->ls_resolved == HLOG_OUTLET_S_OFF) \ - break; \ - else if (_ls0->ls_resolved == HLOG_OUTLET_S_ON) \ - hlog_always(_ls0, __VA_ARGS__); \ - else \ - hlog_impl(_ls0, __VA_ARGS__); \ - } while (/*CONSTCOND*/0) - -struct hlog_outlet *hlog_outlet_find_active(struct hlog_outlet *); -void hlog_outlet_register(struct hlog_outlet *); -struct hlog_outlet *hlog_outlet_lookup(const char *); -int hlog_set_state(const char *, hlog_outlet_state_t, bool); - -void vhlog(const char *, va_list) _printflike(1,0); - -void vhlog_warn(const char *, va_list) _printflike(1,0); -void vhlog_warnx(const char *, va_list) _printflike(1,0); -void vhlog_err(int, const char *, va_list) _printflike(2,0) _noreturn; -void vhlog_errx(int, const char *, va_list) _printflike(2,0) _noreturn; - -void hlog_warnx(const char *, ...) _printflike(1,2); -void hlog_warn(const char *, ...) _printflike(1,2); - -void hlog_err(int, const char *, ...) _printflike(2,3) _noreturn; -void hlog_errx(int, const char *, ...) _printflike(2,3) _noreturn; - -void hlog_always(struct hlog_outlet *, const char *, ...) - _printflike(2,3); - -void hlog_impl(struct hlog_outlet *, const char *, ...) - _printflike(2,3); - -#endif /* _HLOG_H */ |