From 202f73f05324cbfca51658ad6d8dad3b93bee298 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Wed, 8 Nov 2023 16:55:28 -0500 Subject: [PATCH] ENH: If a test data file is downloaded, then print the bandwidth in bytes/sec (#762) Signed-off-by: Michael Jackson --- cmake/FetchDataFile.cmake.in | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cmake/FetchDataFile.cmake.in b/cmake/FetchDataFile.cmake.in index 310e8f9d5c..e781f72a5e 100644 --- a/cmake/FetchDataFile.cmake.in +++ b/cmake/FetchDataFile.cmake.in @@ -4,15 +4,27 @@ # Download, Decompress, and possibly copy data archive # message(STATUS "[DATA DOWNLOAD] @ARGS_ARCHIVE_NAME@") # -------------------------------------------------------------------------------------------------- +string(TIMESTAMP time_stamp_start %s) file(DOWNLOAD https://github.com/BlueQuartzSoftware/complex/releases/download/Data_Archive/@ARGS_ARCHIVE_NAME@ "@ARGS_DREAM3D_DATA_DIR@/TestFiles/@ARGS_ARCHIVE_NAME@" EXPECTED_HASH SHA512=@ARGS_SHA512@ - SHOW_PROGRESS + # SHOW_PROGRESS STATUS result ) -# message(STATUS "result: '${result}'") +string(TIMESTAMP time_stamp_end %s) list(GET result 1 status) string(REPLACE "\"" "" status "${status}") + +if("${status}" STREQUAL "No error") + math(EXPR time_diff "${time_stamp_end} - ${time_stamp_start}" OUTPUT_FORMAT DECIMAL) # value is set to "1000" + file(SIZE "@ARGS_DREAM3D_DATA_DIR@/TestFiles/@ARGS_ARCHIVE_NAME@" file_size) + if(NOT "${time_diff}" STREQUAL "0") + math(EXPR bandwidth "${file_size} / ${time_diff}" OUTPUT_FORMAT DECIMAL) # value is set to "1000" + message(STATUS "@ARGS_ARCHIVE_NAME@ Download Complete: ${bandwidth} bytes/sec") + else() + message(STATUS "@ARGS_ARCHIVE_NAME@ Download Complete") + endif() +endif() # message(STATUS "status: '${status}'") # --------------------------------------------------------------------------------------------------