Skip to content

Commit db562b5

Browse files
committed
update: stats calculation account for intra-ecc
Signed-off-by: Stephen L. <lrq3000@gmail.com>
1 parent 022929d commit db562b5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

header_ecc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,8 @@ def main(argv=None):
514514
header_size_add = header_size
515515
else: # else for size smaller than the defined header size, it will just be the size of the file
516516
header_size_add = size
517-
# Size of the ecc entry for this file will be: marker-bytes (\xFF bytes) + length-filepath-string + length-size-string + size of the ecc per block for all blocks in file header + size of the hash per block for all blocks in file header.
518-
sizeheaders = sizeheaders + replication_rate * (len(entrymarker) + len(field_delim)*2 + len(relfilepath) + len(str(size)) + (int(math.ceil(float(header_size_add) / ecc_params["message_size"])) * (ecc_params["ecc_size"]+ecc_params["hash_size"])) ) # Compute the total number of bytes we will add with ecc + hash (accounting for the padding of the remaining characters at the end of the sequence in case it doesn't fit with the message_size, by using ceil() )
517+
# Size of the ecc entry for this file will be: entrymarker-bytes + field_delim-bytes*occurrence + length-filepath-string + length-size-string + length-filepath-ecc + size of the ecc per block for all blocks in file header + size of the hash per block for all blocks in file header.
518+
sizeheaders = sizeheaders + replication_rate * (len(entrymarker) + len(field_delim)*3 + len(relfilepath) + len(str(size)) + int(float(len(relfilepath))*resilience_rate_intra) + (int(math.ceil(float(header_size_add) / ecc_params["message_size"])) * (ecc_params["ecc_size"]+ecc_params["hash_size"])) ) # Compute the total number of bytes we will add with ecc + hash (accounting for the padding of the remaining characters at the end of the sequence in case it doesn't fit with the message_size, by using ceil() )
519519
ptee.write("Precomputing done.")
520520
# TODO: add the size of the ecc format header? (arguments string + PYHEADERECC identifier)
521521
total_pred_percentage = sizeheaders * 100 / sizetotal

structural_adaptive_ecc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ def main(argv=None):
557557
else: # else for size smaller than the defined header size, it will just be the size of the file
558558
filesize_header = size
559559
filesize_content = 0
560-
# Size of the ecc entry for this file will be: marker-bytes (\xFF bytes) + length-filepath-string + length-size-string + size of the ecc per block for all blocks in file header + size of the hash per block for all blocks in file header.
561-
sizeecc += replication_rate * (len(entrymarker) + len(field_delim)*2 + len(relfilepath) + len(str(size)) + (int(math.ceil(float(filesize_header) / ecc_params_header["message_size"])) * (ecc_params_header["ecc_size"]+ecc_params_header["hash_size"])) + (int(math.ceil(float(filesize_content) / ecc_params_variable_average["message_size"])) * (ecc_params_variable_average["ecc_size"]+ecc_params_variable_average["hash_size"])) ) # Compute the total number of bytes we will add with ecc + hash (accounting for the padding of the remaining characters at the end of the sequence in case it doesn't fit with the message_size, by using ceil() )
560+
# Size of the ecc entry for this file will be: entrymarker-bytes + field_delim-bytes*occurrence + length-filepath-string + length-size-string + length-filepath-ecc + size of the ecc per block for all blocks in file header + size of the hash per block for all blocks in file header.
561+
sizeecc += replication_rate * (len(entrymarker) + len(field_delim)*3 + len(relfilepath) + len(str(size)) + int(float(len(relfilepath))*resilience_rate_intra) + (int(math.ceil(float(filesize_header) / ecc_params_header["message_size"])) * (ecc_params_header["ecc_size"]+ecc_params_header["hash_size"])) + (int(math.ceil(float(filesize_content) / ecc_params_variable_average["message_size"])) * (ecc_params_variable_average["ecc_size"]+ecc_params_variable_average["hash_size"])) ) # Compute the total number of bytes we will add with ecc + hash (accounting for the padding of the remaining characters at the end of the sequence in case it doesn't fit with the message_size, by using ceil() )
562562
ptee.write("Precomputing done.")
563563
if generate: # show statistics only if generating an ecc file
564564
# TODO: add the size of the ecc format header? (arguments string + PYHEADERECC identifier)

0 commit comments

Comments
 (0)