From 1330d5b2628bd513c3429ac01c3b1b6089eee072 Mon Sep 17 00:00:00 2001 From: Patrick Vogler Date: Mon, 24 Jun 2024 16:31:02 +0200 Subject: [PATCH] Moved metering to a compile time option to streamline API --- .gitignore | 3 + CMakeLists.txt | 2 + Makefile | 50 +++- include/library/private/constants.h | 15 + include/library/private/types.h | 19 -- src/library/CMakeLists.txt | 9 + src/library/libbwc.c | 410 ++++++++++++++++++++-------- src/tools/CMakeLists.txt | 4 +- src/tools/bwccmdl.c | 66 ----- 9 files changed, 363 insertions(+), 215 deletions(-) diff --git a/.gitignore b/.gitignore index c04684b..f87240c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ # Prerequisites *.d +# BWC Data Files +*.bwc + # Object files *.o *.ko diff --git a/CMakeLists.txt b/CMakeLists.txt index d0d4735..b03f1c7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,6 +181,8 @@ add_subdirectory(src/library) #----------------------------------------------------------# if(${TOOL}) add_subdirectory(src/tools) +else() + set(ignoreMe "${BUILD_EAS3}${BUILD_NETCDF}") endif() #----------------------------------------------------------# diff --git a/Makefile b/Makefile index 4db8802..6d562dc 100755 --- a/Makefile +++ b/Makefile @@ -53,14 +53,19 @@ .PHONY: single .PHONY: tool +.PHONY: profiling .PHONY: eas3 .PHONY: netCDF -.PHONY: --build_debug +.PHONY: build_debug .PHONY: default .PHONY: debug .PHONY: full +.PHONY: release + +.PHONY: cmdl +.PHONY: cldebug #*--------------------------------------------------------*# # Initialize the compiler flags used to build the library. # @@ -73,6 +78,8 @@ BUILD_PREC="Double" BUILD_TOOL="False" +BUILD_PROF="False" + BUILD_EAS3="False" BUILD_NETCDF="False" @@ -95,12 +102,25 @@ help: @echo "" @echo " [Type] [Description]" @echo "" - @echo " debug Compiles BigWhoop and the command line tool with " - @echo " full file support. All relevant debug flags are set." + @echo " debug Compiles BigWhoop with all relevant debug flags." @echo "" - @echo " full Compiles BigWhoop (with OpenMP enabled if applica-" - @echo " ble) and the command line tool with full file sup-" - @echo " port. Code optimization is set to the highest level." + @echo " full Removes all files and folders created during a pre-" + @echo " vious compile run. Compiles BigWhoop (with OpenMP " + @echo " enabled if applicable). Code optimization is set to" + @echo " the highest level." + @echo "" + @echo " release Compiles BigWhoop (with OpenMP enabled if applica-" + @echo " ble). Code optimization is set to the highest level." + @echo "" + @echo " cmdl Removes all files and folders created during a pre-" + @echo " vious compile run. Compiles BigWhoop (with OpenMP " + @echo " enabled if applicable). All relevant debug flags " + @echo " are set. " + @echo "" + @echo " cmdl Removes all files and folders created during a pre-" + @echo " vious compile run. Compiles BigWhoop (with OpenMP " + @echo " enabled if applicable). Code optimization is set to" + @echo " the highest level." @echo "" @echo " clean Removes all files and folders created during a pre-" @echo " vious compile run." @@ -116,6 +136,8 @@ help: @echo "" @echo " tool Build the command line tool." @echo "" + @echo " profiling Enable Profiling." + @echo "" @echo " eas3 Adds support for the eas3 file format to the com-" @echo " mand line tool." @echo "" @@ -125,7 +147,7 @@ help: #*--------------------------------------------------------*# # Define private targets. # #*--------------------------------------------------------*# ---build_debug: +build_debug: $(eval BUILD_TYPE="Debug") #*--------------------------------------------------------*# @@ -143,6 +165,11 @@ single: tool: $(eval BUILD_TOOL="True") +#*--------------------------------------------------------*# +# Define target used to activate command line tool build. # +#*--------------------------------------------------------*# +profiling: + $(eval BUILD_PROF="True") #*--------------------------------------------------------*# # Define targets used to activate file format support. # @@ -156,9 +183,11 @@ netCDF: #*--------------------------------------------------------*# # Define the wrappers for the compile command targets. # #*--------------------------------------------------------*# -debug: | clean --build_debug tool eas3 build_bwc display +debug: | clean build_debug build_bwc display +full: | clean build_bwc display release: | build_bwc display -full: | clean tool eas3 build_bwc display +cmdl: | clean tool profiling eas3 build_bwc display +cldebug: | clean build_debug tool profiling eas3 build_bwc display #*--------------------------------------------------------*# # Define target used to output compile information. # @@ -182,6 +211,7 @@ display: @echo " Link Type: $(LINK_TYPE)" @echo " Precision: $(BUILD_PREC)" @echo " Utilities: $(BUILD_TOOL)" + @echo " Profiling: $(BUILD_PROF)" @echo "" @echo " Build date: $(shell date)" @echo " User: $(USER)" @@ -192,7 +222,7 @@ display: # Define the main compile command targets. # #*--------------------------------------------------------*# build_bwc: - mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j + mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DPROF=${BUILD_PROF}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j clean: - /bin/rm -rf build/ bin/ lib/ lib64/ include/library/public \ No newline at end of file diff --git a/include/library/private/constants.h b/include/library/private/constants.h index 7cb1b56..c8af8d0 100755 --- a/include/library/private/constants.h +++ b/include/library/private/constants.h @@ -103,4 +103,19 @@ bwc_tile_sizeof, // Tiling defined by size of one tile bwc_tile_numbof, // Tiling defined by the number of tiles } bwc_tile_instr; + + /*----------------------------------------------------------------------------------------------*\ + ! ! + ! DESCRIPTION: ! + ! ------------ ! + ! ! + ! These constants are used to signal the dataset sample precision. ! + ! ! + \*----------------------------------------------------------------------------------------------*/ + typedef enum + { + bwc_type_half, + bwc_type_single, + bwc_type_double, + } bwc_type; #endif \ No newline at end of file diff --git a/include/library/private/types.h b/include/library/private/types.h index 153be17..9f38bb8 100755 --- a/include/library/private/types.h +++ b/include/library/private/types.h @@ -713,24 +713,5 @@ bwc_gl_ctrl control; // Global control structure bwc_tile *tile; // Structure defining bwc tile. - - struct meter - { - double bpd; // Average bits per datapoint. - double cpr; // Compression ratio - double css; // Codestream size. - - struct time - { - double ttl; // Total compression time. - - double cpy; // Total time used copying data. - double nrm; // Total time used normalizing data. - - double wav; // Total time used for wavelet transform. - double ent; // Total time used for entropy encoding. - double ass; // Total codestream assembly time. - } time; - } meter; } bwc_field; #endif \ No newline at end of file diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt index 549453e..b07ce5d 100755 --- a/src/library/CMakeLists.txt +++ b/src/library/CMakeLists.txt @@ -94,6 +94,15 @@ else() target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION) endif() +#----------------------------------------------------------# +# Set the target compile definition for the profiling # +# output. # +#----------------------------------------------------------# +if(${PROF}) + target_compile_definitions(bwclib PRIVATE -DBWC_PROFILE) + MESSAGE(STATUS "Profiling: ${PROF}") +endif() + #----------------------------------------------------------# # Set the Version and SOVersion and define the public API # # for the BigWhoop library. # diff --git a/src/library/libbwc.c b/src/library/libbwc.c index d8648bb..02c02da 100755 --- a/src/library/libbwc.c +++ b/src/library/libbwc.c @@ -56,6 +56,9 @@ #include #include #include +#ifdef BWC_PROFILE + #include +#endif #include "bitstream.h" #include "constants.h" @@ -73,6 +76,72 @@ || | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] || || || \************************************************************************************************************/ +/*----------------------------------------------------------------------------------------------------------*\ +! ! +! DESCRIPTION: ! +! ------------ ! +! This function takes an integer value and generates a version with the appropri- ! +! ate byte unit in log2 format that is returned to the function caller. ! +! ! +! DEVELOPMENT HISTORY: ! +! -------------------- ! +! ! +! Date Author Change Id Release Description Of Change ! +! ---- ------ --------- ------- --------------------- ! +! 03.05.2019 Patrick Vogler B87D120 V 0.1.0 function created ! +! 04.05.2021 Patrick Vogler B87E7E4 V 0.1.0 clean up ! +! ! +\*----------------------------------------------------------------------------------------------------------*/ +#if defined BWC_PROFILE + const char* + get_size(uint64_t integer) + { + /*-----------------------*\ + ! DEFINE INT VARIABLES: ! + \*-----------------------*/ + uint64_t multiplier; + uint8_t i; + + /*-----------------------*\ + ! DEFINE CHAR VARIABLES: ! + \*-----------------------*/ + char *sizes[] = { "EiB", "PiB", "TiB", "GiB", "MiB", "KiB", "B" }; + static char str[20]; + + /*--------------------------------------------------------*\ + ! Set up the multiplier used to evaluate the digital unit ! + ! prefix and allocate the character array returned to the ! + ! function caller. ! + \*--------------------------------------------------------*/ + multiplier = 1024ULL * 1024ULL * 1024ULL * + 1024ULL * 1024ULL * 1024ULL; + + /*--------------------------------------------------------*\ + ! If larger than 0, iterate over the byte units until the ! + ! integer is within its range and populate the char. array ! + ! with the appropriate information. ! + \*--------------------------------------------------------*/ + if(integer > 0) + { + for(i = 0; i < 7; ++i, multiplier /= 1024) + { + if(integer < multiplier) + continue; + if(integer % multiplier == 0) + sprintf(str, "%" PRIu64 " %s", integer / multiplier, sizes[i]); + else + sprintf(str, "%.1f %s", floor((10.0 * integer) / multiplier) / 10.0, sizes[i]); + break; + } + } + else + { + strcpy(str, "0 B"); + } + return str; + } +#endif + /*----------------------------------------------------------------------------------------------------------*\ ! FUNCTION NAME: uint8 initialize_precinct(bwc_field *const field, bwc_precinct *precinct, ! ! -------------- const uint32 dX, const uint32 dY, ! @@ -3885,11 +3954,30 @@ bwc_compress(bwc_field *const field, bwc_data *const data) uint64 i; uint16 p; + #ifdef BWC_PROFILE + uint64 css; + uint64 nfs; + #endif + /*-----------------------*\ ! DEFINE FLOAT VARIABLES: ! \*-----------------------*/ double start, end; + #ifdef BWC_PROFILE + double bpd; + double cpr; + + double ttl; + + double cpy; + double nrm; + + double wav; + double ent; + double ass; + #endif + /*-----------------------*\ ! DEFINE STRUCTS: ! \*-----------------------*/ @@ -3908,10 +3996,12 @@ bwc_compress(bwc_field *const field, bwc_data *const data) /*--------------------------------------------------------*\ ! Initialize the compression time measurement. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - field->meter.time.ttl = omp_get_wtime(); - #else - field->meter.time.ttl = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + ttl = omp_get_wtime(); + #else + ttl = (double)clock(); + #endif #endif /*--------------------------------------------------------*\ @@ -3978,18 +4068,22 @@ bwc_compress(bwc_field *const field, bwc_data *const data) ! Fill the working buffer with the flow field data for the ! ! current tile parameter. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif fill_buffer(field, tile, parameter, working_buffer, data, p); - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.cpy += end - start; - #else - end = (double)clock(); - field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + cpy += end - start; + #else + end = (double)clock(); + cpy += (end - start)/CLOCKS_PER_SEC; + #endif #endif /*--------------------------------------------------------*\ @@ -3997,60 +4091,72 @@ bwc_compress(bwc_field *const field, bwc_data *const data) ! scale it to the dynamic range specified by the Qm param- ! ! eter. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif normalize_param(field, parameter); - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.nrm += end - start; - #else - end = (double)clock(); - field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + nrm += end - start; + #else + end = (double)clock(); + nrm += (end - start)/CLOCKS_PER_SEC; + #endif #endif /*--------------------------------------------------------*\ ! Perform the forward discrete wavelet transform. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif if(forward_wavelet_transform(field, parameter)) { free(working_buffer); return 1; } - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.wav += end - start; - #else - end = (double)clock(); - field->meter.time.wav += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + wav += end - start; + #else + end = (double)clock(); + wav += (end - start)/CLOCKS_PER_SEC; + #endif #endif /*--------------------------------------------------------*\ ! Tier1 encode the current tile parameter. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif if(t1_encode(field, tile, parameter)) { free(working_buffer); return 1; } - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.ent += end - start; - #else - end = (double)clock(); - field->meter.time.ent += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + ent += end - start; + #else + end = (double)clock(); + ent += (end - start)/CLOCKS_PER_SEC; + #endif #endif /*--------------------------------------------------------*\ @@ -4062,31 +4168,37 @@ bwc_compress(bwc_field *const field, bwc_data *const data) /*--------------------------------------------------------*\ ! Tier2 encode the current tile. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif if(t2_encode(field, tile)) { free(working_buffer); return 1; } - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.ent += end - start; - #else - end = (double)clock(); - field->meter.time.ent += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + ent += end - start; + #else + end = (double)clock(); + ent += (end - start)/CLOCKS_PER_SEC; + #endif #endif } /*--------------------------------------------------------*\ ! Assemble compressed codestream. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif data->codestream.data = assemble_codestream(field); if(!data->codestream.data) @@ -4094,12 +4206,14 @@ bwc_compress(bwc_field *const field, bwc_data *const data) free(working_buffer); return 1; } - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.ass += end - start; - #else - end = (double)clock(); - field->meter.time.ass += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + ass += end - start; + #else + end = (double)clock(); + ass += (end - start)/CLOCKS_PER_SEC; + #endif #endif /*--------------------------------------------------------*\ @@ -4108,12 +4222,33 @@ bwc_compress(bwc_field *const field, bwc_data *const data) free(working_buffer); /*--------------------------------------------------------*\ - ! Calculate the compression time. ! + ! Output the profiling information. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl; - #else - field->meter.time.ttl = ((double)clock() - field->meter.time.ttl)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + ttl = omp_get_wtime() - ttl; + #else + ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC; + #endif + + nfs = (uint64)(info->nX * info->nY * info->nZ * info->nTS * info->nPar * info->precision); + css = (uint64)data->codestream.data->size; + + + cpr = (double)nfs/css; + bpd = (double)(css * 64.0f)/nfs; + + printf("==============================================================\n"); + printf(" Compression Time: %*.2f s\n", 25, ttl); + printf(" - Wavelet transformation: %*.2f s\n", 25, wav); + printf(" - Entropy encoding: %*.2f s\n", 25, ent); + printf(" - Codestream assembly: %*.2f s\n", 25, ass); + printf("\n"); + printf(" Compression Ratio: %*.2f\n", 27, cpr); + printf(" - Codestream size: %*s\n", 25, get_size(css)); + printf(" - Field size: %*s\n", 25, get_size(nfs)); + printf(" - Average bpd: %*.2f\n", 27, bpd); + printf("==============================================================\n"); #endif /*--------------------------------------------------------*\ @@ -4240,6 +4375,17 @@ bwc_decompress(bwc_field *const field, bwc_data *const data) \*-----------------------*/ double start, end; + #ifdef BWC_PROFILE + double ttl; + + double cpy; + double nrm; + + double wav; + double ent; + double ass; + #endif + /*-----------------------*\ ! DEFINE STRUCTS: ! \*-----------------------*/ @@ -4259,11 +4405,14 @@ bwc_decompress(bwc_field *const field, bwc_data *const data) /*--------------------------------------------------------*\ ! Initialize the decompression time measurement. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - field->meter.time.ttl = omp_get_wtime(); - #else - field->meter.time.ttl = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + ttl = omp_get_wtime(); + #else + ttl = (double)clock(); + #endif #endif + /*--------------------------------------------------------*\ ! Save the global control and info structure to temporary ! @@ -4350,61 +4499,73 @@ bwc_decompress(bwc_field *const field, bwc_data *const data) /*--------------------------------------------------------*\ ! Tier1 decode the current tile parameter. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif if(t1_decode(field, tile, parameter)) { free(working_buffer); return 1; } - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.ent += end - start; - #else - end = (double)clock(); - field->meter.time.ent += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + ent += end - start; + #else + end = (double)clock(); + ent += (end - start)/CLOCKS_PER_SEC; + #endif #endif /*--------------------------------------------------------*\ ! Perform the inverse discrete wavelet transform. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif if(inverse_wavelet_transform(field, parameter)) { free(working_buffer); return 1; } - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.wav += end - start; - #else - end = (double)clock(); - field->meter.time.wav += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + wav += end - start; + #else + end = (double)clock(); + wav += (end - start)/CLOCKS_PER_SEC; + #endif #endif /*--------------------------------------------------------*\ ! Denormalize the working buffer scale it to the original ! ! dynamic range specified by the Qm parameter. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif denormalize_param(field, parameter); - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.nrm += end - start; - #else - end = (double)clock(); - field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + nrm += end - start; + #else + end = (double)clock(); + nrm += (end - start)/CLOCKS_PER_SEC; + #endif #endif /*--------------------------------------------------------*\ @@ -4412,18 +4573,22 @@ bwc_decompress(bwc_field *const field, bwc_data *const data) ! in the flow field data structure for the current tile pa-! ! rameter. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - start = omp_get_wtime(); - #else - start = (double)clock(); + #if defined BWC_PROFILE + #if defined (_OPENMP) + start = omp_get_wtime(); + #else + start = (double)clock(); + #endif #endif flush_buffer(field, tile, parameter, working_buffer, data, p); - #if defined (_OPENMP) - end = omp_get_wtime(); - field->meter.time.cpy += end - start; - #else - end = (double)clock(); - field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + end = omp_get_wtime(); + cpy += end - start; + #else + end = (double)clock(); + cpy += (end - start)/CLOCKS_PER_SEC; + #endif #endif /*--------------------------------------------------------*\ @@ -4440,13 +4605,22 @@ bwc_decompress(bwc_field *const field, bwc_data *const data) free(working_buffer); /*--------------------------------------------------------*\ - ! Calculate the decompression time. ! + ! Output the profiling information. ! \*--------------------------------------------------------*/ - #if defined (_OPENMP) - field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl; - #else - field->meter.time.ttl = ((double)clock() - field->meter.time.ttl)/CLOCKS_PER_SEC; + #if defined BWC_PROFILE + #if defined (_OPENMP) + ttl = omp_get_wtime() - ttl; + #else + ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC; + #endif + + printf("==============================================================\n"); + printf(" Decompression Time: %*.2f s\n", 24, ttl); + printf(" - Wavelet transformation: %*.2f s\n", 24, wav); + printf(" - Entropy encoding: %*.2f s\n", 24, ent); + printf("==============================================================\n"); #endif + return 0; } \ No newline at end of file diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index adf9154..7469e1a 100755 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -52,14 +52,14 @@ add_executable(bwccmd bwccmdl.c # Set the target compile definition for the requested file # # format support. # #----------------------------------------------------------# -MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}") - if(${BUILD_EAS3}) target_compile_definitions(bwccmd PRIVATE -DBWC_EAS3) + MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}") endif() if(${BUILD_NETCDF}) target_compile_definitions(bwccmd PRIVATE -DBWC_NETCDF) + MESSAGE(STATUS "NetCDF file format support: ${BUILD_NETCDF}") endif() #----------------------------------------------------------# diff --git a/src/tools/bwccmdl.c b/src/tools/bwccmdl.c index 32c928d..05ebab9 100644 --- a/src/tools/bwccmdl.c +++ b/src/tools/bwccmdl.c @@ -3012,57 +3012,6 @@ main(int argc, { printf("==============================================================\n"); } - - /*--------------------------------------------------------*\ - ! Calculate the original field size, compression ratio and ! - ! bits per datapoint and print the miscellaneous compres- ! - ! sion information to the standard output. ! - \*--------------------------------------------------------*/ - if(file->info.parameter) - { - param = file->info.parameter->root; - - while(param != NULL) - { - size += (param->size * param->precision); - param = param -> next; - } - } - - comp_ratio = (double)size/(file->codestream.data->size); - bpd = (double)(file->codestream.data->size * 64)/size; - - /*--------------------------------------------------------*\ - ! Calculate the original field size, compression ratio and ! - ! bits per datapoint and print the miscellaneous compres- ! - ! sion information to the standard output. ! - \*--------------------------------------------------------*/ - csSize = get_size(file->codestream.data->size); - fdSize = get_size(size); - - /*--------------------------------------------------------*\ - ! Calculate the original field size, compression ratio and ! - ! bits per datapoint and print the miscellaneous compres- ! - ! sion information to the standard output. ! - \*--------------------------------------------------------*/ - printf(" Compression Time: %*.2f s\n", 25, field->meter.time.ttl); - printf(" - Wavelet transformation: %*.2f s\n", 25, field->meter.time.wav); - printf(" - Entropy encoding: %*.2f s\n", 25, field->meter.time.ent); - printf(" - Codestream assembly: %*.2f s\n", 25, field->meter.time.ass); - printf("\n"); - printf(" Compression Ratio: %*.2f\n", 27, comp_ratio); - printf(" - Codestream size: %*s\n", 25, csSize); - printf(" - Field size: %*s\n", 25, fdSize); - printf(" - Average bpd: %*.2f\n", 27, bpd); - printf("==============================================================\n"); - - /*--------------------------------------------------------*\ - ! Calculate the original field size, compression ratio and ! - ! bits per datapoint and print the miscellaneous compres- ! - ! sion information to the standard output. ! - \*--------------------------------------------------------*/ - free(csSize); - free(fdSize); } } /*--------------------------------------------------------*\ @@ -3152,21 +3101,6 @@ main(int argc, goto OUT; } } - - /*--------------------------------------------------------*\ - ! If the verbose flag is set by the function caller, print ! - ! the miscellaneous decompression information to the stan- ! - ! dard output. ! - \*--------------------------------------------------------*/ - temp = retrieve_arg(args, "verbose"); - if(temp != NULL) - { - printf("==============================================================\n"); - printf(" Decompression Time: %*.2f s\n", 24, field->meter.time.ttl); - printf(" - Wavelet transformation: %*.2f s\n", 24, field->meter.time.wav); - printf(" - Entropy encoding: %*.2f s\n", 24, field->meter.time.ent); - printf("==============================================================\n"); - } } /*--------------------------------------------------------*\ ! !