本文整理匯總了Python中pyeclib.ec_iface.ECDriver.reconstruct方法的典型用法代碼示例。如果您正苦於以下問題:Python ECDriver.reconstruct方法的具體用法?Python ECDriver.reconstruct怎麽用?Python ECDriver.reconstruct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyeclib.ec_iface.ECDriver
的用法示例。
在下文中一共展示了ECDriver.reconstruct方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: len
# 需要導入模塊: from pyeclib.ec_iface import ECDriver [as 別名]
# 或者: from pyeclib.ec_iface.ECDriver import reconstruct [as 別名]
if __name__ == "__main__":
if len(sys.argv) != 2:
print_usage()
sys.exit(0)
SIZE = int(sys.argv[1])
EC_K = int(os.environ.get("EC_K", 10))
EC_M = int(os.environ.get("EC_M", 4))
EC_TYPE = os.environ.get("EC_TYPE", "liberasurecode_rs_vand")
DRIVER = ECDriver(k=EC_K, m=EC_M, ec_type=EC_TYPE)
DATA = os.urandom(SIZE)
STRIPS = DRIVER.encode(DATA)
LENGTH = EC_K + EC_M
SUPPORTED_DISTANCE = LENGTH - EC_K + 1
print "About to reconstruct ", REQUESTS, " times a payload of size ", SIZE, " bytes (", \
(DRIVER.ec_type if hasattr(DRIVER, "ec_type") else EC_TYPE), ", k =", DRIVER.k, \
", m =", DRIVER.m, ") from 0 to", SUPPORTED_DISTANCE, "missing blocks"
random.seed(0)
for missing_blocks in range(SUPPORTED_DISTANCE):
for i in range(REQUESTS):
missing_indices = range(missing_blocks)
start = time.clock()
DRIVER.reconstruct(STRIPS[missing_blocks:], missing_indices)
end = time.clock()
elapsed_in_milliseconds = (end - start) * 1000
print elapsed_in_milliseconds