本文整理汇总了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