Skip to content

Commit

Permalink
ENH: If a test data file is downloaded, then print the bandwidth in b…
Browse files Browse the repository at this point in the history
…ytes/sec (#762)

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson authored Nov 8, 2023
1 parent 3ac4757 commit 202f73f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cmake/FetchDataFile.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}'")

# --------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 202f73f

Please sign in to comment.