react-native-update 10.34.2 → 10.34.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (908) hide show
  1. package/.gitmodules +4 -4
  2. package/harmony/pushy/src/main/cpp/HDiffPatch/CHANGELOG.md +291 -0
  3. package/harmony/pushy/src/main/cpp/HDiffPatch/LICENSE +48 -0
  4. package/harmony/pushy/src/main/cpp/HDiffPatch/Makefile +473 -0
  5. package/harmony/pushy/src/main/cpp/HDiffPatch/README.md +552 -0
  6. package/harmony/pushy/src/main/cpp/HDiffPatch/README_cn.md +547 -0
  7. package/harmony/pushy/src/main/cpp/HDiffPatch/_atosize.h +127 -0
  8. package/harmony/pushy/src/main/cpp/HDiffPatch/_clock_for_demo.h +59 -0
  9. package/harmony/pushy/src/main/cpp/HDiffPatch/_dir_ignore.h +191 -0
  10. package/harmony/pushy/src/main/cpp/HDiffPatch/_hextobytes.h +112 -0
  11. package/harmony/pushy/src/main/cpp/HDiffPatch/bsdiff_wrapper/bsdiff_wrapper.cpp +389 -0
  12. package/harmony/pushy/src/main/cpp/HDiffPatch/bsdiff_wrapper/bsdiff_wrapper.h +73 -0
  13. package/harmony/pushy/src/main/cpp/HDiffPatch/bsdiff_wrapper/bspatch_wrapper.c +266 -0
  14. package/harmony/pushy/src/main/cpp/HDiffPatch/bsdiff_wrapper/bspatch_wrapper.h +58 -0
  15. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Android.mk +190 -0
  16. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Application.mk +8 -0
  17. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs.bat +1 -0
  18. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs.sh +1 -0
  19. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs_patchers.bat +1 -0
  20. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs_patchers.sh +1 -0
  21. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.c +49 -0
  22. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.h +31 -0
  23. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch_jni.c +38 -0
  24. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.java +26 -0
  25. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffPatch.sln +155 -0
  26. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffZ.vcxproj +364 -0
  27. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HPatchZ.vcxproj +348 -0
  28. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/bzip2.vcxproj +228 -0
  29. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/hpatchz_test.vcxproj +215 -0
  30. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/libdeflate.vcxproj +256 -0
  31. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/longPathAware.exe.manifest +7 -0
  32. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/lzma.vcxproj +271 -0
  33. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/testHashClash.vcxproj +228 -0
  34. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/unitTest.vcxproj +296 -0
  35. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/zlib.vcxproj +242 -0
  36. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/zstd.vcxproj +287 -0
  37. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/contents.xcworkspacedata +39 -0
  38. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  39. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  40. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/bestParams.xcodeproj/project.pbxproj +447 -0
  41. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.pbxproj +703 -0
  42. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/hpatchz.xcodeproj/project.pbxproj +463 -0
  43. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/libdeflate.xcodeproj/project.pbxproj +286 -0
  44. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/lz4.xcodeproj/project.pbxproj +268 -0
  45. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/lzma.xcodeproj/project.pbxproj +585 -0
  46. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.pbxproj +301 -0
  47. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/unitTest.xcodeproj/project.pbxproj +591 -0
  48. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/zlib.xcodeproj/project.pbxproj +308 -0
  49. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/zstd.xcodeproj/project.pbxproj +524 -0
  50. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode_iOS_hpatchz/hpatch_objc/hpatch_objc.h +33 -0
  51. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode_iOS_hpatchz/hpatch_objc/hpatch_objc.m +33 -0
  52. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode_iOS_hpatchz/hpatchz.xcodeproj/project.pbxproj +774 -0
  53. package/harmony/pushy/src/main/cpp/HDiffPatch/checksum_plugin_demo.h +799 -0
  54. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_parallel.cpp +201 -0
  55. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_parallel.h +59 -0
  56. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_plugin_demo.h +1526 -0
  57. package/harmony/pushy/src/main/cpp/HDiffPatch/decompress_plugin_demo.h +1637 -0
  58. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.cpp +846 -0
  59. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.h +79 -0
  60. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.cpp +339 -0
  61. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.h +190 -0
  62. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.cpp +339 -0
  63. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.h +87 -0
  64. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/file_for_dirDiff.h +43 -0
  65. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.c +836 -0
  66. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.h +246 -0
  67. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_private.h +47 -0
  68. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.c +112 -0
  69. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.h +69 -0
  70. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_types.h +65 -0
  71. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.c +346 -0
  72. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.h +149 -0
  73. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.c +176 -0
  74. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.h +84 -0
  75. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.c +146 -0
  76. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.h +61 -0
  77. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.c +152 -0
  78. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.h +76 -0
  79. package/harmony/pushy/src/main/cpp/HDiffPatch/file_for_patch.c +735 -0
  80. package/harmony/pushy/src/main/cpp/HDiffPatch/file_for_patch.h +240 -0
  81. package/harmony/pushy/src/main/cpp/HDiffPatch/hdiffz.cpp +1971 -0
  82. package/harmony/pushy/src/main/cpp/HDiffPatch/hdiffz_import_patch.c +31 -0
  83. package/harmony/pushy/src/main/cpp/HDiffPatch/hdiffz_import_patch.h +42 -0
  84. package/harmony/pushy/src/main/cpp/HDiffPatch/hpatch_dir_listener.h +307 -0
  85. package/harmony/pushy/src/main/cpp/HDiffPatch/hpatchz.c +1786 -0
  86. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.cpp +1746 -0
  87. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.h +201 -0
  88. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff_for_hpatch_lite.h +74 -0
  89. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff_types.h +187 -0
  90. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/match_block.cpp +478 -0
  91. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/match_block.h +222 -0
  92. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.cpp +383 -0
  93. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.h +73 -0
  94. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.cpp +184 -0
  95. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.h +88 -0
  96. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/config.h +89 -0
  97. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c.inc.h +325 -0
  98. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.cpp +10 -0
  99. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.h +97 -0
  100. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.cpp +14 -0
  101. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.h +108 -0
  102. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort_private.h +186 -0
  103. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/sssort.c.inc.h +780 -0
  104. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/trsort.c.inc.h +579 -0
  105. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c +415 -0
  106. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.h +144 -0
  107. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/bloom_filter.h +164 -0
  108. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/covers.h +148 -0
  109. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp +769 -0
  110. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.h +97 -0
  111. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp +954 -0
  112. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.h +299 -0
  113. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/match_inplace.cpp +168 -0
  114. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/match_inplace.h +44 -0
  115. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/mem_buf.h +72 -0
  116. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/pack_uint.h +130 -0
  117. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/qsort_parallel.h +125 -0
  118. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.cpp +428 -0
  119. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.h +133 -0
  120. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/checksum_plugin.h +52 -0
  121. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hcache_old_mt.c +243 -0
  122. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hcache_old_mt.h +51 -0
  123. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hinput_mt.c +153 -0
  124. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hinput_mt.h +54 -0
  125. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_houtput_mt.c +158 -0
  126. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_houtput_mt.h +49 -0
  127. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hpatch_mt.c +294 -0
  128. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_hpatch_mt.h +59 -0
  129. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/_patch_private_mt.h +217 -0
  130. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/hpatch_mt.c +349 -0
  131. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/hpatch_mt.h +110 -0
  132. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.c +2643 -0
  133. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.h +253 -0
  134. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_private.h +245 -0
  135. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_types.h +361 -0
  136. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite.c +366 -0
  137. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite.h +91 -0
  138. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite_input_cache.h +31 -0
  139. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite_types.h +106 -0
  140. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_channel.cpp +170 -0
  141. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_channel.h +250 -0
  142. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import.h +67 -0
  143. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import_c.c +497 -0
  144. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import_c.h +106 -0
  145. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/_match_in_old_sign.cpp +254 -0
  146. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/_match_in_old_sign.h +39 -0
  147. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/_sign_diff_type.h +37 -0
  148. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/sign_diff.cpp +62 -0
  149. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sign_diff/sign_diff.h +44 -0
  150. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/dict_decompress_plugin.h +156 -0
  151. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/dir_sync_client.cpp +440 -0
  152. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/dir_sync_client.h +88 -0
  153. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/match_in_old.cpp +332 -0
  154. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/match_in_old.h +48 -0
  155. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/match_in_types.h +198 -0
  156. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client.cpp +697 -0
  157. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client.h +74 -0
  158. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client_private.h +262 -0
  159. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client_type.h +174 -0
  160. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_client_type_private.h +174 -0
  161. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_diff_data.cpp +252 -0
  162. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_diff_data.h +67 -0
  163. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_info_client.cpp +680 -0
  164. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_client/sync_info_client.h +137 -0
  165. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/dict_compress_plugin.h +83 -0
  166. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/dir_sync_make.cpp +125 -0
  167. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/dir_sync_make.h +56 -0
  168. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/hsynz_plugin.h +55 -0
  169. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/match_in_new.cpp +147 -0
  170. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/match_in_new.h +38 -0
  171. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_info_make.cpp +354 -0
  172. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_info_make.h +76 -0
  173. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_make.cpp +521 -0
  174. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_make.h +69 -0
  175. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_make_hash_clash.h +122 -0
  176. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/sync_make/sync_make_private.h +66 -0
  177. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_client_type.h +36 -0
  178. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_client_type_private.h +81 -0
  179. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_client_wrapper.cpp +247 -0
  180. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_client_wrapper.h +71 -0
  181. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_info_client.cpp +351 -0
  182. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_info_client.h +42 -0
  183. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_match_in_old.cpp +124 -0
  184. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_client_wrapper/zsync_match_in_old.h +38 -0
  185. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_make_wrapper/zsync_info_make.cpp +203 -0
  186. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_make_wrapper/zsync_info_make.h +55 -0
  187. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_make_wrapper/zsync_make_wrapper.cpp +79 -0
  188. package/harmony/pushy/src/main/cpp/HDiffPatch/libhsync/zsync_make_wrapper/zsync_make_wrapper.h +66 -0
  189. package/harmony/pushy/src/main/cpp/HDiffPatch/test/_private_searchBestParams.cpp +301 -0
  190. package/harmony/pushy/src/main/cpp/HDiffPatch/test/hpatchz_test.cpp +291 -0
  191. package/harmony/pushy/src/main/cpp/HDiffPatch/test/testHashClash.cpp +630 -0
  192. package/harmony/pushy/src/main/cpp/HDiffPatch/test/unit_test.cpp +889 -0
  193. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcdiff_wrapper.cpp +628 -0
  194. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcdiff_wrapper.h +95 -0
  195. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcpatch_code_table.h +78 -0
  196. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcpatch_wrapper.c +950 -0
  197. package/harmony/pushy/src/main/cpp/HDiffPatch/vcdiff_wrapper/vcpatch_wrapper.h +72 -0
  198. package/harmony/pushy/src/main/cpp/lzma/Asm/arm/7zCrcOpt.asm +100 -0
  199. package/harmony/pushy/src/main/cpp/lzma/Asm/arm64/7zAsm.S +181 -0
  200. package/harmony/pushy/src/main/cpp/lzma/Asm/arm64/LzmaDecOpt.S +1487 -0
  201. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/7zAsm.asm +341 -0
  202. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/7zCrcOpt.asm +258 -0
  203. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/AesOpt.asm +742 -0
  204. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/LzFindOpt.asm +540 -0
  205. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/LzmaDecOpt.asm +1339 -0
  206. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/Sha256Opt.asm +275 -0
  207. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/Sort.asm +860 -0
  208. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/XzCrc64Opt.asm +523 -0
  209. package/harmony/pushy/src/main/cpp/lzma/C/7z.h +204 -0
  210. package/harmony/pushy/src/main/cpp/lzma/C/7zAlloc.c +89 -0
  211. package/harmony/pushy/src/main/cpp/lzma/C/7zAlloc.h +19 -0
  212. package/harmony/pushy/src/main/cpp/lzma/C/7zArcIn.c +1786 -0
  213. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf.c +36 -0
  214. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf.h +35 -0
  215. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf2.c +52 -0
  216. package/harmony/pushy/src/main/cpp/lzma/C/7zCrc.c +464 -0
  217. package/harmony/pushy/src/main/cpp/lzma/C/7zCrc.h +28 -0
  218. package/harmony/pushy/src/main/cpp/lzma/C/7zCrcOpt.c +199 -0
  219. package/harmony/pushy/src/main/cpp/lzma/C/7zDec.c +673 -0
  220. package/harmony/pushy/src/main/cpp/lzma/C/7zFile.c +443 -0
  221. package/harmony/pushy/src/main/cpp/lzma/C/7zFile.h +92 -0
  222. package/harmony/pushy/src/main/cpp/lzma/C/7zStream.c +199 -0
  223. package/harmony/pushy/src/main/cpp/lzma/C/7zTypes.h +597 -0
  224. package/harmony/pushy/src/main/cpp/lzma/C/7zVersion.h +27 -0
  225. package/harmony/pushy/src/main/cpp/lzma/C/7zVersion.rc +55 -0
  226. package/harmony/pushy/src/main/cpp/lzma/C/7zWindows.h +101 -0
  227. package/harmony/pushy/src/main/cpp/lzma/C/7zip_gcc_c.mak +360 -0
  228. package/harmony/pushy/src/main/cpp/lzma/C/Aes.c +429 -0
  229. package/harmony/pushy/src/main/cpp/lzma/C/Aes.h +60 -0
  230. package/harmony/pushy/src/main/cpp/lzma/C/AesOpt.c +1002 -0
  231. package/harmony/pushy/src/main/cpp/lzma/C/Alloc.c +605 -0
  232. package/harmony/pushy/src/main/cpp/lzma/C/Alloc.h +76 -0
  233. package/harmony/pushy/src/main/cpp/lzma/C/Asm_c.mak +12 -0
  234. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2.c +290 -0
  235. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2.h +332 -0
  236. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2Enc.c +506 -0
  237. package/harmony/pushy/src/main/cpp/lzma/C/Bra.c +709 -0
  238. package/harmony/pushy/src/main/cpp/lzma/C/Bra.h +105 -0
  239. package/harmony/pushy/src/main/cpp/lzma/C/Bra86.c +187 -0
  240. package/harmony/pushy/src/main/cpp/lzma/C/BraIA64.c +14 -0
  241. package/harmony/pushy/src/main/cpp/lzma/C/Compiler.h +246 -0
  242. package/harmony/pushy/src/main/cpp/lzma/C/CpuArch.c +970 -0
  243. package/harmony/pushy/src/main/cpp/lzma/C/CpuArch.h +686 -0
  244. package/harmony/pushy/src/main/cpp/lzma/C/Delta.c +169 -0
  245. package/harmony/pushy/src/main/cpp/lzma/C/Delta.h +19 -0
  246. package/harmony/pushy/src/main/cpp/lzma/C/DllSecur.c +99 -0
  247. package/harmony/pushy/src/main/cpp/lzma/C/DllSecur.h +20 -0
  248. package/harmony/pushy/src/main/cpp/lzma/C/LzFind.c +1746 -0
  249. package/harmony/pushy/src/main/cpp/lzma/C/LzFind.h +160 -0
  250. package/harmony/pushy/src/main/cpp/lzma/C/LzFindMt.c +1422 -0
  251. package/harmony/pushy/src/main/cpp/lzma/C/LzFindMt.h +114 -0
  252. package/harmony/pushy/src/main/cpp/lzma/C/LzFindOpt.c +578 -0
  253. package/harmony/pushy/src/main/cpp/lzma/C/LzHash.h +34 -0
  254. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Dec.c +493 -0
  255. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Dec.h +121 -0
  256. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2DecMt.c +1095 -0
  257. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2DecMt.h +81 -0
  258. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Enc.c +807 -0
  259. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Enc.h +58 -0
  260. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86.h +111 -0
  261. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86Dec.c +53 -0
  262. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86Enc.c +103 -0
  263. package/harmony/pushy/src/main/cpp/lzma/C/LzmaDec.c +1363 -0
  264. package/harmony/pushy/src/main/cpp/lzma/C/LzmaDec.h +237 -0
  265. package/harmony/pushy/src/main/cpp/lzma/C/LzmaEnc.c +3150 -0
  266. package/harmony/pushy/src/main/cpp/lzma/C/LzmaEnc.h +85 -0
  267. package/harmony/pushy/src/main/cpp/lzma/C/LzmaLib.c +42 -0
  268. package/harmony/pushy/src/main/cpp/lzma/C/LzmaLib.h +138 -0
  269. package/harmony/pushy/src/main/cpp/lzma/C/MtCoder.c +604 -0
  270. package/harmony/pushy/src/main/cpp/lzma/C/MtCoder.h +144 -0
  271. package/harmony/pushy/src/main/cpp/lzma/C/MtDec.c +1124 -0
  272. package/harmony/pushy/src/main/cpp/lzma/C/MtDec.h +202 -0
  273. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd.h +169 -0
  274. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7.c +1131 -0
  275. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7.h +181 -0
  276. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7Dec.c +312 -0
  277. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7Enc.c +337 -0
  278. package/harmony/pushy/src/main/cpp/lzma/C/Precomp.h +127 -0
  279. package/harmony/pushy/src/main/cpp/lzma/C/RotateDefs.h +50 -0
  280. package/harmony/pushy/src/main/cpp/lzma/C/Sha256.c +492 -0
  281. package/harmony/pushy/src/main/cpp/lzma/C/Sha256.h +86 -0
  282. package/harmony/pushy/src/main/cpp/lzma/C/Sha256Opt.c +451 -0
  283. package/harmony/pushy/src/main/cpp/lzma/C/Sort.c +268 -0
  284. package/harmony/pushy/src/main/cpp/lzma/C/Sort.h +15 -0
  285. package/harmony/pushy/src/main/cpp/lzma/C/SwapBytes.c +835 -0
  286. package/harmony/pushy/src/main/cpp/lzma/C/SwapBytes.h +17 -0
  287. package/harmony/pushy/src/main/cpp/lzma/C/Threads.c +812 -0
  288. package/harmony/pushy/src/main/cpp/lzma/C/Threads.h +260 -0
  289. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7z.dsp +249 -0
  290. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7z.dsw +29 -0
  291. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7zMain.c +889 -0
  292. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/Precomp.c +4 -0
  293. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/Precomp.h +13 -0
  294. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/makefile +44 -0
  295. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/makefile.gcc +32 -0
  296. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.c +313 -0
  297. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.dsp +192 -0
  298. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.dsw +29 -0
  299. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/Precomp.h +13 -0
  300. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/makefile +30 -0
  301. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/makefile.gcc +21 -0
  302. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.def +4 -0
  303. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.dsp +206 -0
  304. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.dsw +29 -0
  305. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLibExports.c +15 -0
  306. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/Precomp.c +4 -0
  307. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/Precomp.h +13 -0
  308. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/makefile +59 -0
  309. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/resource.rc +3 -0
  310. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/Precomp.c +4 -0
  311. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/Precomp.h +13 -0
  312. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.c +657 -0
  313. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.dsp +231 -0
  314. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.dsw +29 -0
  315. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/makefile +44 -0
  316. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/makefile_con +40 -0
  317. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/resource.rc +5 -0
  318. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/setup.ico +0 -0
  319. package/harmony/pushy/src/main/cpp/lzma/C/Xz.c +92 -0
  320. package/harmony/pushy/src/main/cpp/lzma/C/Xz.h +542 -0
  321. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64.c +140 -0
  322. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64.h +26 -0
  323. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64Opt.c +261 -0
  324. package/harmony/pushy/src/main/cpp/lzma/C/XzDec.c +2876 -0
  325. package/harmony/pushy/src/main/cpp/lzma/C/XzEnc.c +1384 -0
  326. package/harmony/pushy/src/main/cpp/lzma/C/XzEnc.h +64 -0
  327. package/harmony/pushy/src/main/cpp/lzma/C/XzIn.c +385 -0
  328. package/harmony/pushy/src/main/cpp/lzma/C/var_clang.mak +11 -0
  329. package/harmony/pushy/src/main/cpp/lzma/C/var_clang_arm64.mak +12 -0
  330. package/harmony/pushy/src/main/cpp/lzma/C/var_clang_x64.mak +11 -0
  331. package/harmony/pushy/src/main/cpp/lzma/C/var_clang_x86.mak +11 -0
  332. package/harmony/pushy/src/main/cpp/lzma/C/var_gcc.mak +12 -0
  333. package/harmony/pushy/src/main/cpp/lzma/C/var_gcc_arm64.mak +12 -0
  334. package/harmony/pushy/src/main/cpp/lzma/C/var_gcc_x64.mak +10 -0
  335. package/harmony/pushy/src/main/cpp/lzma/C/var_gcc_x86.mak +10 -0
  336. package/harmony/pushy/src/main/cpp/lzma/C/var_mac_arm64.mak +11 -0
  337. package/harmony/pushy/src/main/cpp/lzma/C/var_mac_x64.mak +11 -0
  338. package/harmony/pushy/src/main/cpp/lzma/C/warn_clang.mak +1 -0
  339. package/harmony/pushy/src/main/cpp/lzma/C/warn_clang_mac.mak +1 -0
  340. package/harmony/pushy/src/main/cpp/lzma/C/warn_gcc.mak +51 -0
  341. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/7zip.mak +240 -0
  342. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/7zip_gcc.mak +1370 -0
  343. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Aes.mak +10 -0
  344. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zCompressionMode.cpp +3 -0
  345. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zCompressionMode.h +92 -0
  346. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.cpp +599 -0
  347. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.h +73 -0
  348. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.cpp +721 -0
  349. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.h +95 -0
  350. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zExtract.cpp +444 -0
  351. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.cpp +264 -0
  352. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.h +101 -0
  353. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.cpp +795 -0
  354. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.h +178 -0
  355. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp +1162 -0
  356. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.cpp +19 -0
  357. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.h +156 -0
  358. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.cpp +1764 -0
  359. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.h +454 -0
  360. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zItem.h +207 -0
  361. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.cpp +1026 -0
  362. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.h +346 -0
  363. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.cpp +182 -0
  364. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.h +26 -0
  365. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zRegister.cpp +27 -0
  366. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.cpp +31 -0
  367. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.h +49 -0
  368. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp +3088 -0
  369. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.h +167 -0
  370. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/StdAfx.cpp +3 -0
  371. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/StdAfx.h +11 -0
  372. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Archive.def +14 -0
  373. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Archive2.def +21 -0
  374. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/ArchiveExports.cpp +158 -0
  375. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.cpp +1144 -0
  376. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.h +447 -0
  377. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.cpp +17 -0
  378. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.h +23 -0
  379. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp +315 -0
  380. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.h +169 -0
  381. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +57 -0
  382. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.h +64 -0
  383. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.cpp +140 -0
  384. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.h +33 -0
  385. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.cpp +193 -0
  386. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.h +86 -0
  387. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +18 -0
  388. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.h +35 -0
  389. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ParseProperties.cpp +3 -0
  390. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ParseProperties.h +6 -0
  391. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/StdAfx.h +11 -0
  392. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/DllExports2.cpp +175 -0
  393. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/IArchive.h +754 -0
  394. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Icons/7z.ico +0 -0
  395. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/LzmaHandler.cpp +608 -0
  396. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/SplitHandler.cpp +353 -0
  397. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/StdAfx.h +11 -0
  398. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.cpp +1452 -0
  399. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.h +11 -0
  400. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Asm.mak +12 -0
  401. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsp +2090 -0
  402. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsw +29 -0
  403. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.cpp +3 -0
  404. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.h +11 -0
  405. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/makefile +168 -0
  406. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/makefile.gcc +279 -0
  407. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/resource.rc +7 -0
  408. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp +3 -0
  409. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h +11 -0
  410. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/makefile +98 -0
  411. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/resource.rc +5 -0
  412. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.cpp +3 -0
  413. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.h +11 -0
  414. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/makefile +121 -0
  415. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/resource.rc +5 -0
  416. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +817 -0
  417. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp +540 -0
  418. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsw +29 -0
  419. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.cpp +3 -0
  420. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.h +11 -0
  421. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile +68 -0
  422. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile.gcc +131 -0
  423. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/resource.rc +3 -0
  424. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaSpec/LzmaSpec.cpp +715 -0
  425. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/7z.ico +0 -0
  426. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +1017 -0
  427. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsw +29 -0
  428. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp +521 -0
  429. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.cpp +3 -0
  430. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.h +11 -0
  431. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/makefile +137 -0
  432. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/makefile.gcc +215 -0
  433. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/resource.rc +9 -0
  434. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.cpp +246 -0
  435. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.h +83 -0
  436. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +135 -0
  437. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h +11 -0
  438. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp +872 -0
  439. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsw +29 -0
  440. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp +371 -0
  441. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.cpp +3 -0
  442. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.h +6 -0
  443. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/makefile +121 -0
  444. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/resource.h +6 -0
  445. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/resource.rc +16 -0
  446. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/setup.ico +0 -0
  447. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/7z.ico +0 -0
  448. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp +1074 -0
  449. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsw +29 -0
  450. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp +268 -0
  451. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.cpp +3 -0
  452. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.h +6 -0
  453. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/makefile +159 -0
  454. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/resource.h +1 -0
  455. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/resource.rc +55 -0
  456. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.cpp +358 -0
  457. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.h +182 -0
  458. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.cpp +548 -0
  459. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.h +200 -0
  460. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.cpp +46 -0
  461. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.h +10 -0
  462. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.cpp +923 -0
  463. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.h +205 -0
  464. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.cpp +577 -0
  465. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.h +201 -0
  466. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.cpp +182 -0
  467. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.h +121 -0
  468. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.cpp +237 -0
  469. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.h +45 -0
  470. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.cpp +393 -0
  471. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.h +221 -0
  472. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LockedStream.cpp +3 -0
  473. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LockedStream.h +6 -0
  474. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodId.cpp +3 -0
  475. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodId.h +10 -0
  476. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.cpp +765 -0
  477. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.h +349 -0
  478. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MultiOutStream.cpp +855 -0
  479. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MultiOutStream.h +160 -0
  480. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.cpp +37 -0
  481. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.h +22 -0
  482. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.cpp +111 -0
  483. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.h +133 -0
  484. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.cpp +51 -0
  485. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.h +33 -0
  486. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/PropId.cpp +117 -0
  487. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/RegisterArc.h +80 -0
  488. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/RegisterCodec.h +106 -0
  489. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StdAfx.h +11 -0
  490. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.cpp +151 -0
  491. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.h +78 -0
  492. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.cpp +290 -0
  493. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.h +146 -0
  494. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.cpp +101 -0
  495. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.h +31 -0
  496. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.cpp +57 -0
  497. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.h +41 -0
  498. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.cpp +47 -0
  499. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.h +24 -0
  500. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.cpp +867 -0
  501. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.h +127 -0
  502. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Register.cpp +24 -0
  503. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.cpp +24 -0
  504. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.h +37 -0
  505. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjRegister.cpp +17 -0
  506. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.cpp +106 -0
  507. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.h +59 -0
  508. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchRegister.cpp +58 -0
  509. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/ByteSwap.cpp +91 -0
  510. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CodecExports.cpp +378 -0
  511. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.cpp +153 -0
  512. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.h +34 -0
  513. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyRegister.cpp +15 -0
  514. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/DeltaFilter.cpp +126 -0
  515. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.cpp +267 -0
  516. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.h +87 -0
  517. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.cpp +134 -0
  518. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.h +30 -0
  519. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Register.cpp +22 -0
  520. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.cpp +350 -0
  521. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.h +113 -0
  522. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.cpp +374 -0
  523. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.h +45 -0
  524. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaRegister.cpp +22 -0
  525. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.cpp +219 -0
  526. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.h +87 -0
  527. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.cpp +193 -0
  528. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.h +49 -0
  529. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdRegister.cpp +22 -0
  530. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/StdAfx.h +11 -0
  531. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.cpp +151 -0
  532. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.h +86 -0
  533. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.cpp +243 -0
  534. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.h +35 -0
  535. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crc.mak +8 -0
  536. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crc64.mak +8 -0
  537. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.cpp +315 -0
  538. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.h +130 -0
  539. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAesRegister.cpp +17 -0
  540. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.cpp +277 -0
  541. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.h +122 -0
  542. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAesReg.cpp +29 -0
  543. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.cpp +241 -0
  544. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.h +41 -0
  545. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/StdAfx.h +11 -0
  546. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/GuiCommon.rc +119 -0
  547. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Guid.txt +243 -0
  548. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/ICoder.h +480 -0
  549. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IDecl.h +76 -0
  550. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IPassword.h +54 -0
  551. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IProgress.h +20 -0
  552. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IStream.h +210 -0
  553. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/LzFindOpt.mak +7 -0
  554. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/LzmaDec.mak +7 -0
  555. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/LzmaDec_gcc.mak +14 -0
  556. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/MyVersion.h +2 -0
  557. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/MyVersionInfo.rc +2 -0
  558. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/PropID.h +178 -0
  559. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Sha256.mak +13 -0
  560. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Sort.mak +6 -0
  561. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/SubBuild.mak +3 -0
  562. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.cpp +1145 -0
  563. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.dsp +331 -0
  564. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.dsw +29 -0
  565. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/StdAfx.cpp +3 -0
  566. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/StdAfx.h +11 -0
  567. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/makefile +29 -0
  568. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/makefile.gcc +72 -0
  569. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/resource.rc +3 -0
  570. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +1799 -0
  571. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.h +170 -0
  572. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +3077 -0
  573. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.h +641 -0
  574. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.cpp +176 -0
  575. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.h +16 -0
  576. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp +398 -0
  577. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.h +182 -0
  578. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.cpp +5026 -0
  579. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.h +121 -0
  580. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.cpp +37 -0
  581. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.h +11 -0
  582. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DirItem.h +407 -0
  583. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.cpp +1637 -0
  584. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.h +38 -0
  585. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExitCode.h +27 -0
  586. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.cpp +575 -0
  587. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.h +107 -0
  588. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractMode.h +44 -0
  589. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.cpp +296 -0
  590. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.h +31 -0
  591. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.cpp +2273 -0
  592. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.h +322 -0
  593. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/IFileExtractCallback.h +112 -0
  594. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.cpp +1337 -0
  595. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.h +482 -0
  596. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.cpp +3702 -0
  597. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.h +469 -0
  598. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.cpp +745 -0
  599. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.h +18 -0
  600. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Property.h +14 -0
  601. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.cpp +88 -0
  602. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.h +10 -0
  603. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SortUtils.cpp +25 -0
  604. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SortUtils.h +10 -0
  605. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/StdAfx.h +11 -0
  606. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.cpp +20 -0
  607. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.h +19 -0
  608. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.cpp +1931 -0
  609. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.h +221 -0
  610. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateAction.cpp +64 -0
  611. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateAction.h +66 -0
  612. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp +1069 -0
  613. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.h +197 -0
  614. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.cpp +302 -0
  615. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.h +27 -0
  616. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.cpp +74 -0
  617. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.h +60 -0
  618. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.cpp +84 -0
  619. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.h +30 -0
  620. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ZipRegistry.h +212 -0
  621. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.cpp +41 -0
  622. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.h +14 -0
  623. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.mak +46 -0
  624. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.manifest +16 -0
  625. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp +98 -0
  626. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.h +39 -0
  627. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp +946 -0
  628. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.h +211 -0
  629. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.cpp +426 -0
  630. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.h +58 -0
  631. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/List.cpp +1417 -0
  632. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/List.h +42 -0
  633. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Main.cpp +1635 -0
  634. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/MainAr.cpp +235 -0
  635. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp +115 -0
  636. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.h +73 -0
  637. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.cpp +186 -0
  638. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.h +66 -0
  639. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/StdAfx.cpp +3 -0
  640. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/StdAfx.h +11 -0
  641. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp +998 -0
  642. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.h +148 -0
  643. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp +118 -0
  644. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.h +27 -0
  645. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/makefile +68 -0
  646. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/makefile.gcc +187 -0
  647. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/resource.rc +7 -0
  648. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.cpp +43 -0
  649. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.h +16 -0
  650. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp +1132 -0
  651. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h +32 -0
  652. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialogRes.h +9 -0
  653. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp +64 -0
  654. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.h +28 -0
  655. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialogRes.h +4 -0
  656. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/DialogSize.h +16 -0
  657. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp +1272 -0
  658. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h +347 -0
  659. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/FormatUtils.cpp +28 -0
  660. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/FormatUtils.h +14 -0
  661. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/LangUtils.h +48 -0
  662. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MemDialog.cpp +218 -0
  663. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MemDialog.h +48 -0
  664. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MemDialogRes.h +13 -0
  665. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h +119 -0
  666. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp +288 -0
  667. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h +89 -0
  668. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.rc +93 -0
  669. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialogRes.h +19 -0
  670. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp +58 -0
  671. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h +28 -0
  672. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.rc +18 -0
  673. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialogRes.h +5 -0
  674. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp +201 -0
  675. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h +171 -0
  676. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.rc +12 -0
  677. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +1483 -0
  678. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h +355 -0
  679. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.rc +40 -0
  680. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h +49 -0
  681. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc +85 -0
  682. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialogRes.h +3 -0
  683. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyName.cpp +23 -0
  684. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyName.h +10 -0
  685. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h +104 -0
  686. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/StdAfx.h +67 -0
  687. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp +351 -0
  688. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h +65 -0
  689. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resource.h +199 -0
  690. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resourceGui.h +25 -0
  691. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/7zG.exe.manifest +23 -0
  692. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/Extract.rc +59 -0
  693. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.cpp +421 -0
  694. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.h +113 -0
  695. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.rc +98 -0
  696. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialogRes.h +24 -0
  697. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.cpp +297 -0
  698. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.h +39 -0
  699. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractRes.h +51 -0
  700. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/HashGUI.h +27 -0
  701. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/resource2.h +2 -0
  702. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_clang.mak +3 -0
  703. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_clang_arm64.mak +3 -0
  704. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_clang_x64.mak +3 -0
  705. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_clang_x86.mak +3 -0
  706. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_gcc.mak +3 -0
  707. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_gcc_arm64.mak +3 -0
  708. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_gcc_x64.mak +3 -0
  709. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_gcc_x86.mak +3 -0
  710. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_mac_arm64.mak +3 -0
  711. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/cmpl_mac_x64.mak +3 -0
  712. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_clang.mak +11 -0
  713. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_clang_arm64.mak +19 -0
  714. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_clang_x64.mak +11 -0
  715. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_clang_x86.mak +11 -0
  716. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_gcc.mak +12 -0
  717. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_gcc_arm64.mak +12 -0
  718. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_gcc_x64.mak +11 -0
  719. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_gcc_x86.mak +10 -0
  720. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_mac_arm64.mak +13 -0
  721. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/var_mac_x64.mak +11 -0
  722. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/warn_clang.mak +3 -0
  723. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/warn_clang_mac.mak +9 -0
  724. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/warn_gcc.mak +55 -0
  725. package/harmony/pushy/src/main/cpp/lzma/CPP/Build.mak +252 -0
  726. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/AutoPtr.h +46 -0
  727. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CRC.cpp +7 -0
  728. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/C_FileIO.cpp +3 -0
  729. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/C_FileIO.h +6 -0
  730. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ComTry.h +21 -0
  731. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CommandLineParser.cpp +231 -0
  732. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CommandLineParser.h +63 -0
  733. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Common.h +28 -0
  734. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Common0.h +330 -0
  735. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CrcReg.cpp +77 -0
  736. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Defs.h +16 -0
  737. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/DynLimBuf.cpp +93 -0
  738. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/DynLimBuf.h +41 -0
  739. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/DynamicBuffer.h +76 -0
  740. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/IntToString.cpp +215 -0
  741. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/IntToString.h +54 -0
  742. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Lang.h +30 -0
  743. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ListFileUtils.cpp +150 -0
  744. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ListFileUtils.h +18 -0
  745. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/LzFindPrepare.cpp +7 -0
  746. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyBuffer.h +297 -0
  747. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyBuffer2.h +185 -0
  748. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyCom.h +693 -0
  749. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyException.h +14 -0
  750. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyGuidDef.h +63 -0
  751. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyInitGuid.h +57 -0
  752. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyLinux.h +75 -0
  753. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyString.cpp +1842 -0
  754. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyString.h +1079 -0
  755. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyTypes.h +38 -0
  756. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyUnknown.h +8 -0
  757. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyVector.cpp +3 -0
  758. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyVector.h +724 -0
  759. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyWindows.cpp +292 -0
  760. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyWindows.h +325 -0
  761. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/NewHandler.cpp +340 -0
  762. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/NewHandler.h +121 -0
  763. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Sha256Prepare.cpp +7 -0
  764. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Sha256Reg.cpp +67 -0
  765. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdAfx.h +8 -0
  766. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdInStream.cpp +98 -0
  767. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdInStream.h +46 -0
  768. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdOutStream.cpp +248 -0
  769. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdOutStream.h +87 -0
  770. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringConvert.cpp +762 -0
  771. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringConvert.h +110 -0
  772. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringToInt.cpp +154 -0
  773. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringToInt.h +38 -0
  774. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/TextConfig.cpp +123 -0
  775. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/TextConfig.h +19 -0
  776. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/UTFConvert.cpp +863 -0
  777. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/UTFConvert.h +384 -0
  778. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Wildcard.cpp +789 -0
  779. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Wildcard.h +231 -0
  780. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/XzCrc64Init.cpp +7 -0
  781. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/XzCrc64Reg.cpp +39 -0
  782. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/COM.h +86 -0
  783. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Clipboard.cpp +130 -0
  784. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Clipboard.h +28 -0
  785. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/CommonDialog.cpp +269 -0
  786. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/CommonDialog.h +43 -0
  787. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.cpp +66 -0
  788. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.h +77 -0
  789. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/CommandBar.h +52 -0
  790. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Dialog.cpp +446 -0
  791. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Dialog.h +213 -0
  792. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Edit.h +19 -0
  793. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ImageList.cpp +10 -0
  794. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ImageList.h +87 -0
  795. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ListView.cpp +162 -0
  796. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ListView.h +156 -0
  797. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ProgressBar.h +35 -0
  798. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.cpp +165 -0
  799. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.h +50 -0
  800. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ReBar.h +34 -0
  801. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Static.h +28 -0
  802. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/StatusBar.h +42 -0
  803. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/StdAfx.h +11 -0
  804. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ToolBar.h +43 -0
  805. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Trackbar.h +27 -0
  806. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Window2.cpp +202 -0
  807. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Window2.h +53 -0
  808. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/DLL.cpp +178 -0
  809. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/DLL.h +103 -0
  810. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Defs.h +17 -0
  811. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ErrorMsg.cpp +133 -0
  812. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ErrorMsg.h +16 -0
  813. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileDir.cpp +1362 -0
  814. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileDir.h +172 -0
  815. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileFind.cpp +1449 -0
  816. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileFind.h +347 -0
  817. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileIO.cpp +954 -0
  818. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileIO.h +467 -0
  819. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileLink.cpp +697 -0
  820. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileMapping.cpp +12 -0
  821. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileMapping.h +66 -0
  822. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileName.cpp +911 -0
  823. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileName.h +142 -0
  824. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileSystem.cpp +187 -0
  825. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileSystem.h +31 -0
  826. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Handle.h +39 -0
  827. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryGlobal.cpp +36 -0
  828. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryGlobal.h +55 -0
  829. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryLock.cpp +127 -0
  830. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryLock.h +40 -0
  831. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/NtCheck.h +58 -0
  832. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariant.cpp +393 -0
  833. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariant.h +173 -0
  834. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariantConv.cpp +274 -0
  835. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariantConv.h +47 -0
  836. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Registry.cpp +474 -0
  837. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Registry.h +96 -0
  838. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ResourceString.cpp +103 -0
  839. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ResourceString.h +17 -0
  840. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SecurityUtils.cpp +186 -0
  841. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SecurityUtils.h +150 -0
  842. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Shell.cpp +839 -0
  843. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Shell.h +129 -0
  844. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/StdAfx.h +11 -0
  845. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Synchronization.cpp +87 -0
  846. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Synchronization.h +386 -0
  847. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/System.cpp +421 -0
  848. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/System.h +189 -0
  849. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SystemInfo.cpp +1251 -0
  850. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SystemInfo.h +19 -0
  851. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Thread.h +46 -0
  852. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/TimeUtils.cpp +467 -0
  853. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/TimeUtils.h +146 -0
  854. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Window.cpp +179 -0
  855. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Window.h +363 -0
  856. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/CRC.cs +55 -0
  857. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/CommandLineParser.cs +274 -0
  858. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/InBuffer.cs +72 -0
  859. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/OutBuffer.cs +47 -0
  860. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/IMatchFinder.cs +24 -0
  861. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzBinTree.cs +367 -0
  862. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzInWindow.cs +132 -0
  863. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzOutWindow.cs +110 -0
  864. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaBase.cs +76 -0
  865. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaDecoder.cs +398 -0
  866. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaEncoder.cs +1480 -0
  867. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.cs +364 -0
  868. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.sln +20 -0
  869. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaBench.cs +340 -0
  870. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/AssemblyInfo.cs +29 -0
  871. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/Resources.cs +70 -0
  872. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/Settings.cs +42 -0
  873. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoder.cs +234 -0
  874. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBit.cs +117 -0
  875. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBitTree.cs +157 -0
  876. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/ICoder.cs +157 -0
  877. package/harmony/pushy/src/main/cpp/lzma/DOC/7zC.txt +187 -0
  878. package/harmony/pushy/src/main/cpp/lzma/DOC/7zFormat.txt +469 -0
  879. package/harmony/pushy/src/main/cpp/lzma/DOC/Methods.txt +177 -0
  880. package/harmony/pushy/src/main/cpp/lzma/DOC/installer.txt +166 -0
  881. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-history.txt +651 -0
  882. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-sdk.txt +437 -0
  883. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-specification.txt +1176 -0
  884. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma.txt +345 -0
  885. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/CRC.java +52 -0
  886. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/BinTree.java +382 -0
  887. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/InWindow.java +131 -0
  888. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/OutWindow.java +85 -0
  889. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Base.java +88 -0
  890. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Decoder.java +329 -0
  891. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Encoder.java +1416 -0
  892. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.java +55 -0
  893. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.java +99 -0
  894. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/Decoder.java +88 -0
  895. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/Encoder.java +151 -0
  896. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/ICodeProgress.java +6 -0
  897. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/LzmaAlone.java +253 -0
  898. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/LzmaBench.java +392 -0
  899. package/harmony/pushy/src/main/cpp/lzma/bin/7zS2.sfx +0 -0
  900. package/harmony/pushy/src/main/cpp/lzma/bin/7zS2con.sfx +0 -0
  901. package/harmony/pushy/src/main/cpp/lzma/bin/7zSD.sfx +0 -0
  902. package/harmony/pushy/src/main/cpp/lzma/bin/7zdec.exe +0 -0
  903. package/harmony/pushy/src/main/cpp/lzma/bin/7zr.exe +0 -0
  904. package/harmony/pushy/src/main/cpp/lzma/bin/installer/config.txt +5 -0
  905. package/harmony/pushy/src/main/cpp/lzma/bin/installer/cr.bat +5 -0
  906. package/harmony/pushy/src/main/cpp/lzma/bin/lzma.exe +0 -0
  907. package/harmony/pushy/src/main/cpp/lzma/bin/x64/7zr.exe +0 -0
  908. package/package.json +1 -1
@@ -0,0 +1,5026 @@
1
+ // Bench.cpp
2
+
3
+ #include "StdAfx.h"
4
+
5
+ // #include <stdio.h>
6
+
7
+ #ifndef _WIN32
8
+ #define USE_POSIX_TIME
9
+ #define USE_POSIX_TIME2
10
+ #endif // _WIN32
11
+
12
+ #ifdef USE_POSIX_TIME
13
+ #include <time.h>
14
+ #include <unistd.h>
15
+ #ifdef USE_POSIX_TIME2
16
+ #include <sys/time.h>
17
+ #include <sys/times.h>
18
+ #endif
19
+ #endif // USE_POSIX_TIME
20
+
21
+ #ifdef _WIN32
22
+ #define USE_ALLOCA
23
+ #endif
24
+
25
+ #ifdef USE_ALLOCA
26
+ #ifdef _WIN32
27
+ #include <malloc.h>
28
+ #else
29
+ #include <stdlib.h>
30
+ #endif
31
+ #define BENCH_ALLOCA_VALUE(index) (((index) * 64 * 21) & 0x7FF)
32
+ #endif
33
+
34
+ #include "../../../../C/7zCrc.h"
35
+ #include "../../../../C/RotateDefs.h"
36
+ #include "../../../../C/CpuArch.h"
37
+
38
+ #ifndef Z7_ST
39
+ #include "../../../Windows/Synchronization.h"
40
+ #include "../../../Windows/Thread.h"
41
+ #endif
42
+
43
+ #include "../../../Windows/FileFind.h"
44
+ #include "../../../Windows/FileIO.h"
45
+ #include "../../../Windows/SystemInfo.h"
46
+
47
+ #include "../../../Common/MyBuffer2.h"
48
+ #include "../../../Common/IntToString.h"
49
+ #include "../../../Common/StringConvert.h"
50
+ #include "../../../Common/StringToInt.h"
51
+ #include "../../../Common/Wildcard.h"
52
+
53
+ #include "../../Common/MethodProps.h"
54
+ #include "../../Common/StreamObjects.h"
55
+ #include "../../Common/StreamUtils.h"
56
+
57
+ #include "Bench.h"
58
+
59
+ using namespace NWindows;
60
+
61
+ #ifndef Z7_ST
62
+ static const UInt32 k_LZMA = 0x030101;
63
+ #endif
64
+
65
+ static const UInt64 kComplexInCommands = (UInt64)1 <<
66
+ #ifdef UNDER_CE
67
+ 31;
68
+ #else
69
+ 34;
70
+ #endif
71
+
72
+ static const UInt32 kComplexInMs = 4000;
73
+
74
+ static void SetComplexCommandsMs(UInt32 complexInMs,
75
+ bool isSpecifiedFreq, UInt64 cpuFreq, UInt64 &complexInCommands)
76
+ {
77
+ complexInCommands = kComplexInCommands;
78
+ const UInt64 kMinFreq = (UInt64)1000000 * 4;
79
+ const UInt64 kMaxFreq = (UInt64)1000000 * 20000;
80
+ if (cpuFreq < kMinFreq && !isSpecifiedFreq)
81
+ cpuFreq = kMinFreq;
82
+ if (cpuFreq < kMaxFreq || isSpecifiedFreq)
83
+ {
84
+ if (complexInMs != 0)
85
+ complexInCommands = complexInMs * cpuFreq / 1000;
86
+ else
87
+ complexInCommands = cpuFreq >> 2;
88
+ }
89
+ }
90
+
91
+ // const UInt64 kBenchmarkUsageMult = 1000000; // for debug
92
+ static const unsigned kBenchmarkUsageMultBits = 16;
93
+ static const UInt64 kBenchmarkUsageMult = 1 << kBenchmarkUsageMultBits;
94
+
95
+ UInt64 Benchmark_GetUsage_Percents(UInt64 usage)
96
+ {
97
+ return (100 * usage + kBenchmarkUsageMult / 2) / kBenchmarkUsageMult;
98
+ }
99
+
100
+ static const unsigned kNumHashDictBits = 17;
101
+ static const UInt32 kFilterUnpackSize = (47 << 10); // + 5; // for test
102
+
103
+ static const unsigned kOldLzmaDictBits = 32;
104
+
105
+ // static const size_t kAdditionalSize = (size_t)1 << 32; // for debug
106
+ static const size_t kAdditionalSize = (size_t)1 << 16;
107
+ static const size_t kCompressedAdditionalSize = 1 << 10;
108
+
109
+ static const UInt32 kMaxMethodPropSize = 1 << 6;
110
+
111
+
112
+ #define ALLOC_WITH_HRESULT(_buffer_, _size_) \
113
+ { (_buffer_)->Alloc(_size_); \
114
+ if (_size_ && !(_buffer_)->IsAllocated()) return E_OUTOFMEMORY; }
115
+
116
+
117
+ class CBaseRandomGenerator
118
+ {
119
+ UInt32 A1;
120
+ UInt32 A2;
121
+ UInt32 Salt;
122
+ public:
123
+ CBaseRandomGenerator(UInt32 salt = 0): Salt(salt) { Init(); }
124
+ void Init() { A1 = 362436069; A2 = 521288629;}
125
+ Z7_FORCE_INLINE
126
+ UInt32 GetRnd()
127
+ {
128
+ #if 0
129
+ // for debug:
130
+ return 0x0c080400;
131
+ // return 0;
132
+ #else
133
+ return Salt ^
134
+ (
135
+ ((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) +
136
+ ((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) )
137
+ );
138
+ #endif
139
+ }
140
+ };
141
+
142
+
143
+ static const size_t k_RandBuf_AlignMask = 4 - 1;
144
+
145
+ Z7_NO_INLINE
146
+ static void RandGen_BufAfterPad(Byte *buf, size_t size)
147
+ {
148
+ CBaseRandomGenerator RG;
149
+ for (size_t i = 0; i < size; i += 4)
150
+ {
151
+ const UInt32 v = RG.GetRnd();
152
+ SetUi32a(buf + i, v)
153
+ }
154
+ /*
155
+ UInt32 v = RG.GetRnd();
156
+ for (; i < size; i++)
157
+ {
158
+ buf[i] = (Byte)v;
159
+ v >>= 8;
160
+ }
161
+ */
162
+ }
163
+
164
+
165
+ class CBenchRandomGenerator: public CMidAlignedBuffer
166
+ {
167
+ static UInt32 GetVal(UInt32 &res, unsigned numBits)
168
+ {
169
+ const UInt32 val = res & (((UInt32)1 << numBits) - 1);
170
+ res >>= numBits;
171
+ return val;
172
+ }
173
+
174
+ static UInt32 GetLen(UInt32 &r)
175
+ {
176
+ const unsigned len = (unsigned)GetVal(r, 2);
177
+ return GetVal(r, 1 + len);
178
+ }
179
+
180
+ public:
181
+
182
+ void GenerateSimpleRandom(UInt32 salt)
183
+ {
184
+ CBaseRandomGenerator rg(salt);
185
+ const size_t bufSize = Size();
186
+ Byte *buf = (Byte *)*this;
187
+ for (size_t i = 0; i < bufSize; i++)
188
+ buf[i] = (Byte)rg.GetRnd();
189
+ }
190
+
191
+ void GenerateLz(unsigned dictBits, UInt32 salt)
192
+ {
193
+ CBaseRandomGenerator rg(salt);
194
+ size_t pos = 0;
195
+ size_t rep0 = 1;
196
+ const size_t bufSize = Size();
197
+ Byte *buf = (Byte *)*this;
198
+ unsigned posBits = 1;
199
+
200
+ // printf("\n dictBits = %d\n", (UInt32)dictBits);
201
+ // printf("\n bufSize = 0x%p\n", (const void *)bufSize);
202
+
203
+ while (pos < bufSize)
204
+ {
205
+ /*
206
+ if (pos >= ((UInt32)1 << 31))
207
+ printf(" %x\n", pos);
208
+ */
209
+ UInt32 r = rg.GetRnd();
210
+ if (GetVal(r, 1) == 0 || pos < 1024)
211
+ buf[pos++] = (Byte)(r & 0xFF);
212
+ else
213
+ {
214
+ UInt32 len;
215
+ len = 1 + GetLen(r);
216
+
217
+ if (GetVal(r, 3) != 0)
218
+ {
219
+ len += GetLen(r);
220
+
221
+ while (((size_t)1 << posBits) < pos)
222
+ posBits++;
223
+
224
+ unsigned numBitsMax = dictBits;
225
+ if (numBitsMax > posBits)
226
+ numBitsMax = posBits;
227
+
228
+ const unsigned kAddBits = 6;
229
+ unsigned numLogBits = 5;
230
+ if (numBitsMax <= (1 << 4) - 1 + kAddBits)
231
+ numLogBits = 4;
232
+
233
+ for (;;)
234
+ {
235
+ const UInt32 ppp = GetVal(r, numLogBits) + kAddBits;
236
+ r = rg.GetRnd();
237
+ if (ppp > numBitsMax)
238
+ continue;
239
+ // rep0 = GetVal(r, ppp);
240
+ rep0 = r & (((size_t)1 << ppp) - 1);
241
+ if (rep0 < pos)
242
+ break;
243
+ r = rg.GetRnd();
244
+ }
245
+ rep0++;
246
+ }
247
+
248
+ // len *= 300; // for debug
249
+ {
250
+ const size_t rem = bufSize - pos;
251
+ if (len > rem)
252
+ len = (UInt32)rem;
253
+ }
254
+ Byte *dest = buf + pos;
255
+ const Byte *src = dest - rep0;
256
+ pos += len;
257
+ for (UInt32 i = 0; i < len; i++)
258
+ *dest++ = *src++;
259
+ }
260
+ }
261
+ // printf("\n CRC = %x\n", CrcCalc(buf, bufSize));
262
+ }
263
+ };
264
+
265
+
266
+ Z7_CLASS_IMP_NOQIB_1(
267
+ CBenchmarkInStream
268
+ , ISequentialInStream
269
+ )
270
+ const Byte *Data;
271
+ size_t Pos;
272
+ size_t Size;
273
+ public:
274
+ void Init(const Byte *data, size_t size)
275
+ {
276
+ Data = data;
277
+ Size = size;
278
+ Pos = 0;
279
+ }
280
+ bool WasFinished() const { return Pos == Size; }
281
+ };
282
+
283
+ Z7_COM7F_IMF(CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize))
284
+ {
285
+ const UInt32 kMaxBlockSize = (1 << 20);
286
+ if (size > kMaxBlockSize)
287
+ size = kMaxBlockSize;
288
+ const size_t remain = Size - Pos;
289
+ if (size > remain)
290
+ size = (UInt32)remain;
291
+
292
+ if (size)
293
+ memcpy(data, Data + Pos, size);
294
+
295
+ Pos += size;
296
+ if (processedSize)
297
+ *processedSize = size;
298
+ return S_OK;
299
+ }
300
+
301
+
302
+ class CBenchmarkOutStream Z7_final:
303
+ public ISequentialOutStream,
304
+ public CMyUnknownImp,
305
+ public CMidAlignedBuffer
306
+ {
307
+ Z7_COM_UNKNOWN_IMP_0
308
+ Z7_IFACE_COM7_IMP(ISequentialOutStream)
309
+ // bool _overflow;
310
+ public:
311
+ size_t Pos;
312
+ bool RealCopy;
313
+ bool CalcCrc;
314
+ UInt32 Crc;
315
+
316
+ // CBenchmarkOutStream(): _overflow(false) {}
317
+ void Init(bool realCopy, bool calcCrc)
318
+ {
319
+ Crc = CRC_INIT_VAL;
320
+ RealCopy = realCopy;
321
+ CalcCrc = calcCrc;
322
+ // _overflow = false;
323
+ Pos = 0;
324
+ }
325
+
326
+ void InitCrc()
327
+ {
328
+ Crc = CRC_INIT_VAL;
329
+ }
330
+
331
+ void Calc(const void *data, size_t size)
332
+ {
333
+ Crc = CrcUpdate(Crc, data, size);
334
+ }
335
+
336
+ size_t GetPos() const { return Pos; }
337
+
338
+ // void Print() { printf("\n%8d %8d\n", (unsigned)BufferSize, (unsigned)Pos); }
339
+ };
340
+
341
+ Z7_COM7F_IMF(CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize))
342
+ {
343
+ size_t curSize = Size() - Pos;
344
+ if (curSize > size)
345
+ curSize = size;
346
+ if (curSize != 0)
347
+ {
348
+ if (RealCopy)
349
+ memcpy(((Byte *)*this) + Pos, data, curSize);
350
+ if (CalcCrc)
351
+ Calc(data, curSize);
352
+ Pos += curSize;
353
+ }
354
+ if (processedSize)
355
+ *processedSize = (UInt32)curSize;
356
+ if (curSize != size)
357
+ {
358
+ // _overflow = true;
359
+ return E_FAIL;
360
+ }
361
+ return S_OK;
362
+ }
363
+
364
+
365
+ Z7_CLASS_IMP_NOQIB_1(
366
+ CCrcOutStream
367
+ , ISequentialOutStream
368
+ )
369
+ public:
370
+ bool CalcCrc;
371
+ UInt32 Crc;
372
+ UInt64 Pos;
373
+
374
+ CCrcOutStream(): CalcCrc(true) {}
375
+ void Init() { Crc = CRC_INIT_VAL; Pos = 0; }
376
+ void Calc(const void *data, size_t size)
377
+ {
378
+ Crc = CrcUpdate(Crc, data, size);
379
+ }
380
+ };
381
+
382
+ Z7_COM7F_IMF(CCrcOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize))
383
+ {
384
+ if (CalcCrc)
385
+ Calc(data, size);
386
+ Pos += size;
387
+ if (processedSize)
388
+ *processedSize = size;
389
+ return S_OK;
390
+ }
391
+
392
+ // #include "../../../../C/My_sys_time.h"
393
+
394
+ static UInt64 GetTimeCount()
395
+ {
396
+ #ifdef USE_POSIX_TIME
397
+ #ifdef USE_POSIX_TIME2
398
+ timeval v;
399
+ if (gettimeofday(&v, NULL) == 0)
400
+ return (UInt64)(v.tv_sec) * 1000000 + (UInt64)v.tv_usec;
401
+ return (UInt64)time(NULL) * 1000000;
402
+ #else
403
+ return time(NULL);
404
+ #endif
405
+ #else
406
+ LARGE_INTEGER value;
407
+ if (::QueryPerformanceCounter(&value))
408
+ return (UInt64)value.QuadPart;
409
+ return GetTickCount();
410
+ #endif
411
+ }
412
+
413
+ static UInt64 GetFreq()
414
+ {
415
+ #ifdef USE_POSIX_TIME
416
+ #ifdef USE_POSIX_TIME2
417
+ return 1000000;
418
+ #else
419
+ return 1;
420
+ #endif
421
+ #else
422
+ LARGE_INTEGER value;
423
+ if (::QueryPerformanceFrequency(&value))
424
+ return (UInt64)value.QuadPart;
425
+ return 1000;
426
+ #endif
427
+ }
428
+
429
+
430
+ #ifdef USE_POSIX_TIME
431
+
432
+ struct CUserTime
433
+ {
434
+ UInt64 Sum;
435
+ clock_t Prev;
436
+
437
+ void Init()
438
+ {
439
+ // Prev = clock();
440
+ Sum = 0;
441
+ Prev = 0;
442
+ Update();
443
+ Sum = 0;
444
+ }
445
+
446
+ void Update()
447
+ {
448
+ tms t;
449
+ /* clock_t res = */ times(&t);
450
+ clock_t newVal = t.tms_utime + t.tms_stime;
451
+ Sum += (UInt64)(newVal - Prev);
452
+ Prev = newVal;
453
+
454
+ /*
455
+ clock_t v = clock();
456
+ if (v != -1)
457
+ {
458
+ Sum += v - Prev;
459
+ Prev = v;
460
+ }
461
+ */
462
+ }
463
+ UInt64 GetUserTime()
464
+ {
465
+ Update();
466
+ return Sum;
467
+ }
468
+ };
469
+
470
+ #else
471
+
472
+
473
+ struct CUserTime
474
+ {
475
+ bool UseTick;
476
+ DWORD Prev_Tick;
477
+ UInt64 Prev;
478
+ UInt64 Sum;
479
+
480
+ void Init()
481
+ {
482
+ UseTick = false;
483
+ Prev_Tick = 0;
484
+ Prev = 0;
485
+ Sum = 0;
486
+ Update();
487
+ Sum = 0;
488
+ }
489
+ UInt64 GetUserTime()
490
+ {
491
+ Update();
492
+ return Sum;
493
+ }
494
+ void Update();
495
+ };
496
+
497
+ static inline UInt64 GetTime64(const FILETIME &t) { return ((UInt64)t.dwHighDateTime << 32) | t.dwLowDateTime; }
498
+
499
+ void CUserTime::Update()
500
+ {
501
+ DWORD new_Tick = GetTickCount();
502
+ FILETIME creationTime, exitTime, kernelTime, userTime;
503
+ if (!UseTick &&
504
+ #ifdef UNDER_CE
505
+ ::GetThreadTimes(::GetCurrentThread()
506
+ #else
507
+ ::GetProcessTimes(::GetCurrentProcess()
508
+ #endif
509
+ , &creationTime, &exitTime, &kernelTime, &userTime))
510
+ {
511
+ UInt64 newVal = GetTime64(userTime) + GetTime64(kernelTime);
512
+ Sum += newVal - Prev;
513
+ Prev = newVal;
514
+ }
515
+ else
516
+ {
517
+ UseTick = true;
518
+ Sum += (UInt64)(new_Tick - (DWORD)Prev_Tick) * 10000;
519
+ }
520
+ Prev_Tick = new_Tick;
521
+ }
522
+
523
+
524
+ #endif
525
+
526
+ static UInt64 GetUserFreq()
527
+ {
528
+ #ifdef USE_POSIX_TIME
529
+ // return CLOCKS_PER_SEC;
530
+ return (UInt64)sysconf(_SC_CLK_TCK);
531
+ #else
532
+ return 10000000;
533
+ #endif
534
+ }
535
+
536
+ class CBenchProgressStatus Z7_final
537
+ {
538
+ #ifndef Z7_ST
539
+ NSynchronization::CCriticalSection CS;
540
+ #endif
541
+ public:
542
+ HRESULT Res;
543
+ bool EncodeMode;
544
+ void SetResult(HRESULT res)
545
+ {
546
+ #ifndef Z7_ST
547
+ NSynchronization::CCriticalSectionLock lock(CS);
548
+ #endif
549
+ Res = res;
550
+ }
551
+ HRESULT GetResult()
552
+ {
553
+ #ifndef Z7_ST
554
+ NSynchronization::CCriticalSectionLock lock(CS);
555
+ #endif
556
+ return Res;
557
+ }
558
+ };
559
+
560
+ struct CBenchInfoCalc
561
+ {
562
+ CBenchInfo BenchInfo;
563
+ CUserTime UserTime;
564
+
565
+ void SetStartTime();
566
+ void SetFinishTime(CBenchInfo &dest);
567
+ };
568
+
569
+ void CBenchInfoCalc::SetStartTime()
570
+ {
571
+ BenchInfo.GlobalFreq = GetFreq();
572
+ BenchInfo.UserFreq = GetUserFreq();
573
+ BenchInfo.GlobalTime = ::GetTimeCount();
574
+ BenchInfo.UserTime = 0;
575
+ UserTime.Init();
576
+ }
577
+
578
+ void CBenchInfoCalc::SetFinishTime(CBenchInfo &dest)
579
+ {
580
+ dest = BenchInfo;
581
+ dest.GlobalTime = ::GetTimeCount() - BenchInfo.GlobalTime;
582
+ dest.UserTime = UserTime.GetUserTime();
583
+ }
584
+
585
+ class CBenchProgressInfo Z7_final:
586
+ public ICompressProgressInfo,
587
+ public CMyUnknownImp,
588
+ public CBenchInfoCalc
589
+ {
590
+ Z7_COM_UNKNOWN_IMP_0
591
+ Z7_IFACE_COM7_IMP(ICompressProgressInfo)
592
+ public:
593
+ CBenchProgressStatus *Status;
594
+ IBenchCallback *Callback;
595
+
596
+ CBenchProgressInfo(): Callback(NULL) {}
597
+ };
598
+
599
+
600
+ Z7_COM7F_IMF(CBenchProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize))
601
+ {
602
+ HRESULT res = Status->GetResult();
603
+ if (res != S_OK)
604
+ return res;
605
+ if (!Callback)
606
+ return res;
607
+
608
+ /*
609
+ static UInt64 inSizePrev = 0;
610
+ static UInt64 outSizePrev = 0;
611
+ UInt64 delta1 = 0, delta2 = 0, val1 = 0, val2 = 0;
612
+ if (inSize) { val1 = *inSize; delta1 = val1 - inSizePrev; inSizePrev = val1; }
613
+ if (outSize) { val2 = *outSize; delta2 = val2 - outSizePrev; outSizePrev = val2; }
614
+ UInt64 percents = delta2 * 1000;
615
+ if (delta1 != 0)
616
+ percents /= delta1;
617
+ printf("=== %7d %7d %7d %7d ratio = %4d\n",
618
+ (unsigned)(val1 >> 10), (unsigned)(delta1 >> 10),
619
+ (unsigned)(val2 >> 10), (unsigned)(delta2 >> 10),
620
+ (unsigned)percents);
621
+ */
622
+
623
+ CBenchInfo info;
624
+ SetFinishTime(info);
625
+ if (Status->EncodeMode)
626
+ {
627
+ info.UnpackSize = BenchInfo.UnpackSize + *inSize;
628
+ info.PackSize = BenchInfo.PackSize + *outSize;
629
+ res = Callback->SetEncodeResult(info, false);
630
+ }
631
+ else
632
+ {
633
+ info.PackSize = BenchInfo.PackSize + *inSize;
634
+ info.UnpackSize = BenchInfo.UnpackSize + *outSize;
635
+ res = Callback->SetDecodeResult(info, false);
636
+ }
637
+ if (res != S_OK)
638
+ Status->SetResult(res);
639
+ return res;
640
+ }
641
+
642
+ static const unsigned kSubBits = 8;
643
+
644
+ static unsigned GetLogSize(UInt64 size)
645
+ {
646
+ unsigned i = 0;
647
+ for (;;)
648
+ {
649
+ i++; size >>= 1; if (size == 0) break;
650
+ }
651
+ return i;
652
+ }
653
+
654
+
655
+ static UInt32 GetLogSize_Sub(UInt64 size)
656
+ {
657
+ if (size <= 1)
658
+ return 0;
659
+ const unsigned i = GetLogSize(size) - 1;
660
+ UInt32 v;
661
+ if (i <= kSubBits)
662
+ v = (UInt32)(size) << (kSubBits - i);
663
+ else
664
+ v = (UInt32)(size >> (i - kSubBits));
665
+ return ((UInt32)i << kSubBits) + (v & (((UInt32)1 << kSubBits) - 1));
666
+ }
667
+
668
+
669
+ static UInt64 Get_UInt64_from_double(double v)
670
+ {
671
+ const UInt64 kMaxVal = (UInt64)1 << 62;
672
+ if (v > (double)(Int64)kMaxVal)
673
+ return kMaxVal;
674
+ return (UInt64)v;
675
+ }
676
+
677
+ static UInt64 MyMultDiv64(UInt64 m1, UInt64 m2, UInt64 d)
678
+ {
679
+ if (d == 0)
680
+ d = 1;
681
+ const double v =
682
+ (double)(Int64)m1 *
683
+ (double)(Int64)m2 /
684
+ (double)(Int64)d;
685
+ return Get_UInt64_from_double(v);
686
+ /*
687
+ unsigned n1 = GetLogSize(m1);
688
+ unsigned n2 = GetLogSize(m2);
689
+ while (n1 + n2 > 64)
690
+ {
691
+ if (n1 >= n2)
692
+ {
693
+ m1 >>= 1;
694
+ n1--;
695
+ }
696
+ else
697
+ {
698
+ m2 >>= 1;
699
+ n2--;
700
+ }
701
+ d >>= 1;
702
+ }
703
+
704
+ if (d == 0)
705
+ d = 1;
706
+ return m1 * m2 / d;
707
+ */
708
+ }
709
+
710
+
711
+ UInt64 CBenchInfo::GetUsage() const
712
+ {
713
+ UInt64 userTime = UserTime;
714
+ UInt64 userFreq = UserFreq;
715
+ UInt64 globalTime = GlobalTime;
716
+ UInt64 globalFreq = GlobalFreq;
717
+
718
+ if (userFreq == 0)
719
+ userFreq = 1;
720
+ if (globalTime == 0)
721
+ globalTime = 1;
722
+
723
+ const double v =
724
+ ((double)(Int64)userTime / (double)(Int64)userFreq)
725
+ * ((double)(Int64)globalFreq / (double)(Int64)globalTime)
726
+ * (double)(Int64)kBenchmarkUsageMult;
727
+ return Get_UInt64_from_double(v);
728
+ /*
729
+ return MyMultDiv64(
730
+ MyMultDiv64(kBenchmarkUsageMult, userTime, userFreq),
731
+ globalFreq, globalTime);
732
+ */
733
+ }
734
+
735
+
736
+ UInt64 CBenchInfo::GetRatingPerUsage(UInt64 rating) const
737
+ {
738
+ if (UserTime == 0)
739
+ {
740
+ return 0;
741
+ // userTime = 1;
742
+ }
743
+ UInt64 globalFreq = GlobalFreq;
744
+ if (globalFreq == 0)
745
+ globalFreq = 1;
746
+
747
+ const double v =
748
+ ((double)(Int64)GlobalTime / (double)(Int64)globalFreq)
749
+ * ((double)(Int64)UserFreq / (double)(Int64)UserTime)
750
+ * (double)(Int64)rating;
751
+ return Get_UInt64_from_double(v);
752
+ /*
753
+ return MyMultDiv64(
754
+ MyMultDiv64(rating, UserFreq, UserTime),
755
+ GlobalTime, globalFreq);
756
+ */
757
+ }
758
+
759
+
760
+ UInt64 CBenchInfo::GetSpeed(UInt64 numUnits) const
761
+ {
762
+ return MyMultDiv64(numUnits, GlobalFreq, GlobalTime);
763
+ }
764
+
765
+ static UInt64 GetNumCommands_from_Size_and_Complexity(UInt64 size, Int32 complexity)
766
+ {
767
+ return complexity >= 0 ?
768
+ size * (UInt32)complexity :
769
+ size / (UInt32)(-complexity);
770
+ }
771
+
772
+ struct CBenchProps
773
+ {
774
+ bool LzmaRatingMode;
775
+
776
+ Int32 EncComplex;
777
+ Int32 DecComplexCompr;
778
+ Int32 DecComplexUnc;
779
+
780
+ unsigned KeySize;
781
+
782
+ CBenchProps():
783
+ LzmaRatingMode(false),
784
+ KeySize(0)
785
+ {}
786
+
787
+ void SetLzmaCompexity();
788
+
789
+ UInt64 GetNumCommands_Enc(UInt64 unpackSize) const
790
+ {
791
+ const UInt32 kMinSize = 100;
792
+ if (unpackSize < kMinSize)
793
+ unpackSize = kMinSize;
794
+ return GetNumCommands_from_Size_and_Complexity(unpackSize, EncComplex);
795
+ }
796
+
797
+ UInt64 GetNumCommands_Dec(UInt64 packSize, UInt64 unpackSize) const
798
+ {
799
+ return
800
+ GetNumCommands_from_Size_and_Complexity(packSize, DecComplexCompr) +
801
+ GetNumCommands_from_Size_and_Complexity(unpackSize, DecComplexUnc);
802
+ }
803
+
804
+ UInt64 GetRating_Enc(UInt64 dictSize, UInt64 elapsedTime, UInt64 freq, UInt64 size) const;
805
+ UInt64 GetRating_Dec(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt64 numIterations) const;
806
+ };
807
+
808
+ void CBenchProps::SetLzmaCompexity()
809
+ {
810
+ EncComplex = 1200;
811
+ DecComplexUnc = 4;
812
+ DecComplexCompr = 190;
813
+ LzmaRatingMode = true;
814
+ }
815
+
816
+ UInt64 CBenchProps::GetRating_Enc(UInt64 dictSize, UInt64 elapsedTime, UInt64 freq, UInt64 size) const
817
+ {
818
+ if (dictSize < (1 << kBenchMinDicLogSize))
819
+ dictSize = (1 << kBenchMinDicLogSize);
820
+ Int32 encComplex = EncComplex;
821
+ if (LzmaRatingMode)
822
+ {
823
+ /*
824
+ for (UInt64 uu = 0; uu < (UInt64)0xf << 60;)
825
+ {
826
+ unsigned rr = GetLogSize_Sub(uu);
827
+ printf("\n%16I64x , log = %4x", uu, rr);
828
+ uu += 1;
829
+ uu += uu / 50;
830
+ }
831
+ */
832
+ // throw 1;
833
+ const UInt32 t = GetLogSize_Sub(dictSize) - (kBenchMinDicLogSize << kSubBits);
834
+ encComplex = 870 + ((t * t * 5) >> (2 * kSubBits));
835
+ }
836
+ const UInt64 numCommands = GetNumCommands_from_Size_and_Complexity(size, encComplex);
837
+ return MyMultDiv64(numCommands, freq, elapsedTime);
838
+ }
839
+
840
+ UInt64 CBenchProps::GetRating_Dec(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt64 numIterations) const
841
+ {
842
+ const UInt64 numCommands = GetNumCommands_Dec(inSize, outSize) * numIterations;
843
+ return MyMultDiv64(numCommands, freq, elapsedTime);
844
+ }
845
+
846
+
847
+
848
+ UInt64 CBenchInfo::GetRating_LzmaEnc(UInt64 dictSize) const
849
+ {
850
+ CBenchProps props;
851
+ props.SetLzmaCompexity();
852
+ return props.GetRating_Enc(dictSize, GlobalTime, GlobalFreq, UnpackSize * NumIterations);
853
+ }
854
+
855
+ UInt64 CBenchInfo::GetRating_LzmaDec() const
856
+ {
857
+ CBenchProps props;
858
+ props.SetLzmaCompexity();
859
+ return props.GetRating_Dec(GlobalTime, GlobalFreq, UnpackSize, PackSize, NumIterations);
860
+ }
861
+
862
+
863
+ #ifndef Z7_ST
864
+
865
+ #define NUM_CPU_LEVELS_MAX 3
866
+
867
+ struct CAffinityMode
868
+ {
869
+ unsigned NumBundleThreads;
870
+ unsigned NumLevels;
871
+ unsigned NumCoreThreads;
872
+ unsigned NumCores;
873
+ // unsigned DivideNum;
874
+
875
+ #ifdef _WIN32
876
+ unsigned NumGroups;
877
+ #endif
878
+
879
+ UInt32 Sizes[NUM_CPU_LEVELS_MAX];
880
+
881
+ void SetLevels(unsigned numCores, unsigned numCoreThreads);
882
+ DWORD_PTR GetAffinityMask(UInt32 bundleIndex, CCpuSet *cpuSet) const;
883
+ bool NeedAffinity() const { return NumBundleThreads != 0; }
884
+
885
+ #ifdef _WIN32
886
+ bool NeedGroupsMode() const { return NumGroups > 1; }
887
+ #endif
888
+
889
+ WRes CreateThread_WithAffinity(NWindows::CThread &thread, THREAD_FUNC_TYPE startAddress, LPVOID parameter, UInt32 bundleIndex) const
890
+ {
891
+ #ifdef _WIN32
892
+ if (NeedGroupsMode()) // we need fix for bundleIndex usage
893
+ return thread.Create_With_Group(startAddress, parameter, bundleIndex % NumGroups);
894
+ #endif
895
+ if (NeedAffinity())
896
+ {
897
+ CCpuSet cpuSet;
898
+ GetAffinityMask(bundleIndex, &cpuSet);
899
+ return thread.Create_With_CpuSet(startAddress, parameter, &cpuSet);
900
+ }
901
+ return thread.Create(startAddress, parameter);
902
+ }
903
+
904
+ CAffinityMode():
905
+ NumBundleThreads(0),
906
+ NumLevels(0),
907
+ NumCoreThreads(1)
908
+ #ifdef _WIN32
909
+ , NumGroups(0)
910
+ #endif
911
+ // DivideNum(1)
912
+ {}
913
+ };
914
+
915
+ void CAffinityMode::SetLevels(unsigned numCores, unsigned numCoreThreads)
916
+ {
917
+ NumCores = numCores;
918
+ NumCoreThreads = numCoreThreads;
919
+ NumLevels = 0;
920
+ if (numCoreThreads == 0 || numCores == 0 || numCores % numCoreThreads != 0)
921
+ return;
922
+ UInt32 c = numCores / numCoreThreads;
923
+ UInt32 c2 = 1;
924
+ while ((c & 1) == 0)
925
+ {
926
+ c >>= 1;
927
+ c2 <<= 1;
928
+ }
929
+ if (c2 != 1)
930
+ Sizes[NumLevels++] = c2;
931
+ if (c != 1)
932
+ Sizes[NumLevels++] = c;
933
+ if (numCoreThreads != 1)
934
+ Sizes[NumLevels++] = numCoreThreads;
935
+ if (NumLevels == 0)
936
+ Sizes[NumLevels++] = 1;
937
+
938
+ /*
939
+ printf("\n Cores:");
940
+ for (unsigned i = 0; i < NumLevels; i++)
941
+ {
942
+ printf(" %d", Sizes[i]);
943
+ }
944
+ printf("\n");
945
+ */
946
+ }
947
+
948
+
949
+ DWORD_PTR CAffinityMode::GetAffinityMask(UInt32 bundleIndex, CCpuSet *cpuSet) const
950
+ {
951
+ CpuSet_Zero(cpuSet);
952
+
953
+ if (NumLevels == 0)
954
+ return 0;
955
+
956
+ // printf("\n%2d", bundleIndex);
957
+
958
+ /*
959
+ UInt32 low = 0;
960
+ if (DivideNum != 1)
961
+ {
962
+ low = bundleIndex % DivideNum;
963
+ bundleIndex /= DivideNum;
964
+ }
965
+ */
966
+
967
+ UInt32 numGroups = NumCores / NumBundleThreads;
968
+ UInt32 m = bundleIndex % numGroups;
969
+ UInt32 v = 0;
970
+ for (unsigned i = 0; i < NumLevels; i++)
971
+ {
972
+ UInt32 size = Sizes[i];
973
+ while ((size & 1) == 0)
974
+ {
975
+ v *= 2;
976
+ v |= (m & 1);
977
+ m >>= 1;
978
+ size >>= 1;
979
+ }
980
+ v *= size;
981
+ v += m % size;
982
+ m /= size;
983
+ }
984
+
985
+ // UInt32 nb = NumBundleThreads / DivideNum;
986
+ UInt32 nb = NumBundleThreads;
987
+
988
+ DWORD_PTR mask = ((DWORD_PTR)1 << nb) - 1;
989
+ // v += low;
990
+ mask <<= v;
991
+
992
+ // printf(" %2d %8x \n ", v, (unsigned)mask);
993
+ #ifdef _WIN32
994
+ *cpuSet = mask;
995
+ #else
996
+ {
997
+ for (unsigned k = 0; k < nb; k++)
998
+ CpuSet_Set(cpuSet, v + k);
999
+ }
1000
+ #endif
1001
+
1002
+ return mask;
1003
+ }
1004
+
1005
+
1006
+ struct CBenchSyncCommon
1007
+ {
1008
+ bool ExitMode;
1009
+ NSynchronization::CManualResetEvent StartEvent;
1010
+
1011
+ CBenchSyncCommon(): ExitMode(false) {}
1012
+ };
1013
+
1014
+ #endif
1015
+
1016
+
1017
+
1018
+ enum E_CheckCrcMode
1019
+ {
1020
+ k_CheckCrcMode_Never = 0,
1021
+ k_CheckCrcMode_Always = 1,
1022
+ k_CheckCrcMode_FirstPass = 2
1023
+ };
1024
+
1025
+ class CEncoderInfo;
1026
+
1027
+ class CEncoderInfo Z7_final
1028
+ {
1029
+ Z7_CLASS_NO_COPY(CEncoderInfo)
1030
+
1031
+ public:
1032
+
1033
+ #ifndef Z7_ST
1034
+ NWindows::CThread thread[2];
1035
+ NSynchronization::CManualResetEvent ReadyEvent;
1036
+ UInt32 NumDecoderSubThreads;
1037
+ CBenchSyncCommon *Common;
1038
+ UInt32 EncoderIndex;
1039
+ UInt32 NumEncoderInternalThreads;
1040
+ CAffinityMode AffinityMode;
1041
+ bool IsGlobalMtMode; // if more than one benchmark encoder threads
1042
+ #endif
1043
+
1044
+ CMyComPtr<ICompressCoder> _encoder;
1045
+ CMyComPtr<ICompressFilter> _encoderFilter;
1046
+ CBenchProgressInfo *progressInfoSpec[2];
1047
+ CMyComPtr<ICompressProgressInfo> progressInfo[2];
1048
+ UInt64 NumIterations;
1049
+
1050
+ UInt32 Salt;
1051
+
1052
+ #ifdef USE_ALLOCA
1053
+ size_t AllocaSize;
1054
+ #endif
1055
+
1056
+ unsigned KeySize;
1057
+ Byte _key[32];
1058
+ Byte _iv[16];
1059
+
1060
+ HRESULT Set_Key_and_IV(ICryptoProperties *cp)
1061
+ {
1062
+ RINOK(cp->SetKey(_key, KeySize))
1063
+ return cp->SetInitVector(_iv, sizeof(_iv));
1064
+ }
1065
+
1066
+ Byte _psw[16];
1067
+
1068
+ bool CheckCrc_Enc; /* = 1, if we want to check packed data crcs after each pass
1069
+ used for filter and usual coders */
1070
+ bool UseRealData_Enc; /* = 1, if we want to use only original data for each pass
1071
+ used only for filter */
1072
+ E_CheckCrcMode CheckCrcMode_Dec;
1073
+
1074
+ struct CDecoderInfo
1075
+ {
1076
+ CEncoderInfo *Encoder;
1077
+ UInt32 DecoderIndex;
1078
+ bool CallbackMode;
1079
+
1080
+ #ifdef USE_ALLOCA
1081
+ size_t AllocaSize;
1082
+ #endif
1083
+ };
1084
+ CDecoderInfo decodersInfo[2];
1085
+
1086
+ CMyComPtr<ICompressCoder> _decoders[2];
1087
+ CMyComPtr<ICompressFilter> _decoderFilter;
1088
+
1089
+ HRESULT Results[2];
1090
+ CBenchmarkOutStream *outStreamSpec;
1091
+ CMyComPtr<ISequentialOutStream> outStream;
1092
+ IBenchCallback *callback;
1093
+ IBenchPrintCallback *printCallback;
1094
+ UInt32 crc;
1095
+ size_t kBufferSize;
1096
+ size_t compressedSize;
1097
+ const Byte *uncompressedDataPtr;
1098
+
1099
+ const Byte *fileData;
1100
+ CBenchRandomGenerator rg;
1101
+
1102
+ CMidAlignedBuffer rgCopy; // it must be 16-byte aligned !!!
1103
+
1104
+ // CBenchmarkOutStream *propStreamSpec;
1105
+ Byte propsData[kMaxMethodPropSize];
1106
+ CBufPtrSeqOutStream *propStreamSpec;
1107
+ CMyComPtr<ISequentialOutStream> propStream;
1108
+
1109
+ unsigned generateDictBits;
1110
+ COneMethodInfo _method;
1111
+
1112
+ // for decode
1113
+ size_t _uncompressedDataSize;
1114
+
1115
+ HRESULT Generate();
1116
+ HRESULT Encode();
1117
+ HRESULT Decode(UInt32 decoderIndex);
1118
+
1119
+ CEncoderInfo():
1120
+ #ifndef Z7_ST
1121
+ Common(NULL),
1122
+ IsGlobalMtMode(true),
1123
+ #endif
1124
+ Salt(0),
1125
+ KeySize(0),
1126
+ CheckCrc_Enc(true),
1127
+ UseRealData_Enc(true),
1128
+ CheckCrcMode_Dec(k_CheckCrcMode_Always),
1129
+ outStreamSpec(NULL),
1130
+ callback(NULL),
1131
+ printCallback(NULL),
1132
+ fileData(NULL),
1133
+ propStreamSpec(NULL)
1134
+ {}
1135
+
1136
+ #ifndef Z7_ST
1137
+
1138
+ static THREAD_FUNC_DECL EncodeThreadFunction(void *param)
1139
+ {
1140
+ HRESULT res;
1141
+ CEncoderInfo *encoder = (CEncoderInfo *)param;
1142
+ try
1143
+ {
1144
+ #ifdef USE_ALLOCA
1145
+ alloca(encoder->AllocaSize);
1146
+ #endif
1147
+
1148
+ res = encoder->Encode();
1149
+ }
1150
+ catch(...)
1151
+ {
1152
+ res = E_FAIL;
1153
+ }
1154
+ encoder->Results[0] = res;
1155
+ if (res != S_OK)
1156
+ encoder->progressInfoSpec[0]->Status->SetResult(res);
1157
+ encoder->ReadyEvent.Set();
1158
+ return THREAD_FUNC_RET_ZERO;
1159
+ }
1160
+
1161
+ static THREAD_FUNC_DECL DecodeThreadFunction(void *param)
1162
+ {
1163
+ CDecoderInfo *decoder = (CDecoderInfo *)param;
1164
+
1165
+ #ifdef USE_ALLOCA
1166
+ alloca(decoder->AllocaSize);
1167
+ // printf("\nalloca=%d\n", (unsigned)decoder->AllocaSize);
1168
+ #endif
1169
+
1170
+ CEncoderInfo *encoder = decoder->Encoder;
1171
+ encoder->Results[decoder->DecoderIndex] = encoder->Decode(decoder->DecoderIndex);
1172
+ return THREAD_FUNC_RET_ZERO;
1173
+ }
1174
+
1175
+ HRESULT CreateEncoderThread()
1176
+ {
1177
+ WRes res = 0;
1178
+ if (!ReadyEvent.IsCreated())
1179
+ res = ReadyEvent.Create();
1180
+ if (res == 0)
1181
+ res = AffinityMode.CreateThread_WithAffinity(thread[0], EncodeThreadFunction, this,
1182
+ EncoderIndex);
1183
+ return HRESULT_FROM_WIN32(res);
1184
+ }
1185
+
1186
+ HRESULT CreateDecoderThread(unsigned index, bool callbackMode
1187
+ #ifdef USE_ALLOCA
1188
+ , size_t allocaSize
1189
+ #endif
1190
+ )
1191
+ {
1192
+ CDecoderInfo &decoder = decodersInfo[index];
1193
+ decoder.DecoderIndex = index;
1194
+ decoder.Encoder = this;
1195
+
1196
+ #ifdef USE_ALLOCA
1197
+ decoder.AllocaSize = allocaSize;
1198
+ #endif
1199
+
1200
+ decoder.CallbackMode = callbackMode;
1201
+
1202
+ WRes res = AffinityMode.CreateThread_WithAffinity(thread[index], DecodeThreadFunction, &decoder,
1203
+ // EncoderIndex * NumEncoderInternalThreads + index
1204
+ EncoderIndex
1205
+ );
1206
+
1207
+ return HRESULT_FROM_WIN32(res);
1208
+ }
1209
+
1210
+ #endif
1211
+ };
1212
+
1213
+
1214
+
1215
+
1216
+ static size_t GetBenchCompressedSize(size_t bufferSize)
1217
+ {
1218
+ return kCompressedAdditionalSize + bufferSize + bufferSize / 16;
1219
+ // kBufferSize / 2;
1220
+ }
1221
+
1222
+
1223
+ HRESULT CEncoderInfo::Generate()
1224
+ {
1225
+ const COneMethodInfo &method = _method;
1226
+
1227
+ // we need extra space, if input data is already compressed
1228
+ const size_t kCompressedBufferSize = _encoderFilter ?
1229
+ kBufferSize :
1230
+ GetBenchCompressedSize(kBufferSize);
1231
+
1232
+ if (kCompressedBufferSize < kBufferSize)
1233
+ return E_FAIL;
1234
+
1235
+ uncompressedDataPtr = fileData;
1236
+ if (fileData)
1237
+ {
1238
+ #if !defined(Z7_ST)
1239
+ if (IsGlobalMtMode)
1240
+ {
1241
+ /* we copy the data to local buffer of thread to eliminate
1242
+ using of shared buffer by different threads */
1243
+ ALLOC_WITH_HRESULT(&rg, kBufferSize)
1244
+ memcpy((Byte *)rg, fileData, kBufferSize);
1245
+ uncompressedDataPtr = (const Byte *)rg;
1246
+ }
1247
+ #endif
1248
+ }
1249
+ else
1250
+ {
1251
+ ALLOC_WITH_HRESULT(&rg, kBufferSize)
1252
+ // DWORD ttt = GetTickCount();
1253
+ if (generateDictBits == 0)
1254
+ rg.GenerateSimpleRandom(Salt);
1255
+ else
1256
+ {
1257
+ if (generateDictBits >= sizeof(size_t) * 8
1258
+ && kBufferSize > ((size_t)1 << (sizeof(size_t) * 8 - 1)))
1259
+ return E_INVALIDARG;
1260
+ rg.GenerateLz(generateDictBits, Salt);
1261
+ // return E_ABORT; // for debug
1262
+ }
1263
+ // printf("\n%d\n ", GetTickCount() - ttt);
1264
+
1265
+ crc = CrcCalc((const Byte *)rg, rg.Size());
1266
+ uncompressedDataPtr = (const Byte *)rg;
1267
+ }
1268
+
1269
+ if (!outStream)
1270
+ {
1271
+ outStreamSpec = new CBenchmarkOutStream;
1272
+ outStream = outStreamSpec;
1273
+ }
1274
+
1275
+ ALLOC_WITH_HRESULT(outStreamSpec, kCompressedBufferSize)
1276
+
1277
+ if (_encoderFilter)
1278
+ {
1279
+ /* we try to reduce the number of memcpy() in main encoding loop.
1280
+ so we copy data to temp buffers here */
1281
+ ALLOC_WITH_HRESULT(&rgCopy, kBufferSize)
1282
+ memcpy((Byte *)*outStreamSpec, uncompressedDataPtr, kBufferSize);
1283
+ memcpy((Byte *)rgCopy, uncompressedDataPtr, kBufferSize);
1284
+ }
1285
+
1286
+ if (!propStream)
1287
+ {
1288
+ propStreamSpec = new CBufPtrSeqOutStream; // CBenchmarkOutStream;
1289
+ propStream = propStreamSpec;
1290
+ }
1291
+ // ALLOC_WITH_HRESULT_2(propStreamSpec, kMaxMethodPropSize);
1292
+ // propStreamSpec->Init(true, false);
1293
+ propStreamSpec->Init(propsData, sizeof(propsData));
1294
+
1295
+
1296
+ CMyComPtr<IUnknown> coder;
1297
+ if (_encoderFilter)
1298
+ coder = _encoderFilter;
1299
+ else
1300
+ coder = _encoder;
1301
+ {
1302
+ CMyComPtr<ICompressSetCoderProperties> scp;
1303
+ coder.QueryInterface(IID_ICompressSetCoderProperties, &scp);
1304
+ if (scp)
1305
+ {
1306
+ const UInt64 reduceSize = kBufferSize;
1307
+ /* in posix : new thread uses same affinity as parent thread,
1308
+ so we don't need to send affinity to coder in posix */
1309
+ UInt64 affMask = 0;
1310
+ UInt32 affinityGroup = (UInt32)(Int32)-1;
1311
+ // UInt64 affinityInGroup = 0;
1312
+ #if !defined(Z7_ST) && defined(_WIN32)
1313
+ {
1314
+ CCpuSet cpuSet;
1315
+ if (AffinityMode.NeedGroupsMode()) // we need fix for affinityInGroup also
1316
+ affinityGroup = EncoderIndex % AffinityMode.NumGroups;
1317
+ else
1318
+ affMask = AffinityMode.GetAffinityMask(EncoderIndex, &cpuSet);
1319
+ }
1320
+ #endif
1321
+ // affMask <<= 3; // debug line: to test no affinity in coder
1322
+ // affMask = 0; // for debug
1323
+ // affinityGroup = 0; // for debug
1324
+ // affinityInGroup = 1; // for debug
1325
+ RINOK(method.SetCoderProps_DSReduce_Aff(scp, &reduceSize,
1326
+ affMask != 0 ? &affMask : NULL,
1327
+ affinityGroup != (UInt32)(Int32)-1 ? &affinityGroup : NULL,
1328
+ /* affinityInGroup != 0 ? &affinityInGroup : */ NULL))
1329
+ }
1330
+ else
1331
+ {
1332
+ if (method.AreThereNonOptionalProps())
1333
+ return E_INVALIDARG;
1334
+ }
1335
+
1336
+ CMyComPtr<ICompressWriteCoderProperties> writeCoderProps;
1337
+ coder.QueryInterface(IID_ICompressWriteCoderProperties, &writeCoderProps);
1338
+ if (writeCoderProps)
1339
+ {
1340
+ RINOK(writeCoderProps->WriteCoderProperties(propStream))
1341
+ }
1342
+
1343
+ {
1344
+ CMyComPtr<ICryptoSetPassword> sp;
1345
+ coder.QueryInterface(IID_ICryptoSetPassword, &sp);
1346
+ if (sp)
1347
+ {
1348
+ RINOK(sp->CryptoSetPassword(_psw, sizeof(_psw)))
1349
+
1350
+ // we must call encoding one time to calculate password key for key cache.
1351
+ // it must be after WriteCoderProperties!
1352
+ Byte temp[16];
1353
+ memset(temp, 0, sizeof(temp));
1354
+
1355
+ if (_encoderFilter)
1356
+ {
1357
+ _encoderFilter->Init();
1358
+ _encoderFilter->Filter(temp, sizeof(temp));
1359
+ }
1360
+ else
1361
+ {
1362
+ CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
1363
+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
1364
+ inStreamSpec->Init(temp, sizeof(temp));
1365
+
1366
+ CCrcOutStream *crcStreamSpec = new CCrcOutStream;
1367
+ CMyComPtr<ISequentialOutStream> crcStream = crcStreamSpec;
1368
+ crcStreamSpec->Init();
1369
+
1370
+ RINOK(_encoder->Code(inStream, crcStream, NULL, NULL, NULL))
1371
+ }
1372
+ }
1373
+ }
1374
+ }
1375
+
1376
+ return S_OK;
1377
+ }
1378
+
1379
+
1380
+ static void My_FilterBench(ICompressFilter *filter, Byte *data, size_t size, UInt32 *crc)
1381
+ {
1382
+ while (size != 0)
1383
+ {
1384
+ UInt32 cur = crc ? 1 << 17 : 1 << 24;
1385
+ if (cur > size)
1386
+ cur = (UInt32)size;
1387
+ UInt32 processed = filter->Filter(data, cur);
1388
+ /* if (processed > size) (in AES filter), we must fill last block with zeros.
1389
+ but it is not important for benchmark. So we just copy that data without filtering.
1390
+ if (processed == 0) then filter can't process more */
1391
+ if (processed > size || processed == 0)
1392
+ processed = (UInt32)size;
1393
+ if (crc)
1394
+ *crc = CrcUpdate(*crc, data, processed);
1395
+ data += processed;
1396
+ size -= processed;
1397
+ }
1398
+ }
1399
+
1400
+
1401
+ HRESULT CEncoderInfo::Encode()
1402
+ {
1403
+ // printf("\nCEncoderInfo::Generate\n");
1404
+
1405
+ RINOK(Generate())
1406
+
1407
+ // printf("\n2222\n");
1408
+
1409
+ #ifndef Z7_ST
1410
+ if (Common)
1411
+ {
1412
+ Results[0] = S_OK;
1413
+ WRes wres = ReadyEvent.Set();
1414
+ if (wres == 0)
1415
+ wres = Common->StartEvent.Lock();
1416
+ if (wres != 0)
1417
+ return HRESULT_FROM_WIN32(wres);
1418
+ if (Common->ExitMode)
1419
+ return S_OK;
1420
+ }
1421
+ else
1422
+ #endif
1423
+ {
1424
+ CBenchProgressInfo *bpi = progressInfoSpec[0];
1425
+ bpi->SetStartTime();
1426
+ }
1427
+
1428
+
1429
+ CBenchInfo &bi = progressInfoSpec[0]->BenchInfo;
1430
+ bi.UnpackSize = 0;
1431
+ bi.PackSize = 0;
1432
+ CMyComPtr<ICryptoProperties> cp;
1433
+ CMyComPtr<IUnknown> coder;
1434
+ if (_encoderFilter)
1435
+ coder = _encoderFilter;
1436
+ else
1437
+ coder = _encoder;
1438
+ coder.QueryInterface(IID_ICryptoProperties, &cp);
1439
+ CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
1440
+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
1441
+
1442
+ if (cp)
1443
+ {
1444
+ RINOK(Set_Key_and_IV(cp))
1445
+ }
1446
+
1447
+ compressedSize = 0;
1448
+ if (_encoderFilter)
1449
+ compressedSize = kBufferSize;
1450
+
1451
+ // CBenchmarkOutStream *outStreamSpec = this->outStreamSpec;
1452
+ UInt64 prev = 0;
1453
+
1454
+ const UInt32 mask = (CheckCrc_Enc ? 0 : 0xFFFF);
1455
+ const bool useCrc = (mask < NumIterations);
1456
+ bool crcPrev_defined = false;
1457
+ UInt32 crcPrev = 0;
1458
+
1459
+ bool useRealData_Enc = UseRealData_Enc;
1460
+ bool data_Was_Changed = false;
1461
+ if (useRealData_Enc)
1462
+ {
1463
+ /* we want memcpy() for each iteration including first iteration.
1464
+ So results will be equal for different number of iterations */
1465
+ data_Was_Changed = true;
1466
+ }
1467
+
1468
+ const UInt64 numIterations = NumIterations;
1469
+ UInt64 i = numIterations;
1470
+ // printCallback->NewLine();
1471
+
1472
+ while (i != 0)
1473
+ {
1474
+ i--;
1475
+ if (printCallback && bi.UnpackSize - prev >= (1 << 26))
1476
+ {
1477
+ prev = bi.UnpackSize;
1478
+ RINOK(printCallback->CheckBreak())
1479
+ }
1480
+
1481
+ /*
1482
+ CBenchInfo info;
1483
+ progressInfoSpec[0]->SetStartTime();
1484
+ */
1485
+
1486
+ bool calcCrc = false;
1487
+ if (useCrc)
1488
+ calcCrc = (((UInt32)i & mask) == 0);
1489
+
1490
+ if (_encoderFilter)
1491
+ {
1492
+ Byte *filterData = rgCopy;
1493
+ if (i == numIterations - 1 || calcCrc || useRealData_Enc)
1494
+ {
1495
+ // printf("\nfilterData = (Byte *)*outStreamSpec;\n");
1496
+ filterData = (Byte *)*outStreamSpec;
1497
+ if (data_Was_Changed)
1498
+ {
1499
+ // printf("\nmemcpy(filterData, uncompressedDataPtr\n");
1500
+ memcpy(filterData, uncompressedDataPtr, kBufferSize);
1501
+ }
1502
+ data_Was_Changed = true;
1503
+ }
1504
+ _encoderFilter->Init();
1505
+ if (calcCrc)
1506
+ {
1507
+ // printf("\nInitCrc\n");
1508
+ outStreamSpec->InitCrc();
1509
+ }
1510
+ // printf("\nMy_FilterBench\n");
1511
+ My_FilterBench(_encoderFilter, filterData, kBufferSize,
1512
+ calcCrc ? &outStreamSpec->Crc : NULL);
1513
+ }
1514
+ else
1515
+ {
1516
+ outStreamSpec->Init(true, calcCrc); // write real data for speed consistency at any number of iterations
1517
+ inStreamSpec->Init(uncompressedDataPtr, kBufferSize);
1518
+ RINOK(_encoder->Code(inStream, outStream, NULL, NULL, progressInfo[0]))
1519
+ if (!inStreamSpec->WasFinished())
1520
+ return E_FAIL;
1521
+ if (compressedSize != outStreamSpec->Pos)
1522
+ {
1523
+ if (compressedSize != 0)
1524
+ return E_FAIL;
1525
+ compressedSize = outStreamSpec->Pos;
1526
+ }
1527
+ }
1528
+
1529
+ // outStreamSpec->Print();
1530
+
1531
+ if (calcCrc)
1532
+ {
1533
+ const UInt32 crc2 = CRC_GET_DIGEST(outStreamSpec->Crc);
1534
+ if (crcPrev_defined && crcPrev != crc2)
1535
+ return E_FAIL;
1536
+ crcPrev = crc2;
1537
+ crcPrev_defined = true;
1538
+ }
1539
+
1540
+ bi.UnpackSize += kBufferSize;
1541
+ bi.PackSize += compressedSize;
1542
+
1543
+ /*
1544
+ {
1545
+ progressInfoSpec[0]->SetFinishTime(info);
1546
+ info.UnpackSize = 0;
1547
+ info.PackSize = 0;
1548
+ info.NumIterations = 1;
1549
+
1550
+ info.UnpackSize = kBufferSize;
1551
+ info.PackSize = compressedSize;
1552
+ // printf("\n%7d\n", encoder.compressedSize);
1553
+
1554
+ RINOK(callback->SetEncodeResult(info, true))
1555
+ printCallback->NewLine();
1556
+ }
1557
+ */
1558
+
1559
+ }
1560
+
1561
+ _encoder.Release();
1562
+ _encoderFilter.Release();
1563
+ return S_OK;
1564
+ }
1565
+
1566
+
1567
+ HRESULT CEncoderInfo::Decode(UInt32 decoderIndex)
1568
+ {
1569
+ CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
1570
+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
1571
+ CMyComPtr<ICompressCoder> &decoder = _decoders[decoderIndex];
1572
+ CMyComPtr<IUnknown> coder;
1573
+ if (_decoderFilter)
1574
+ {
1575
+ if (decoderIndex != 0)
1576
+ return E_FAIL;
1577
+ coder = _decoderFilter;
1578
+ }
1579
+ else
1580
+ coder = decoder;
1581
+
1582
+ // printf("\ndecoderIndex = %d, stack = %p", decoderIndex, &coder);
1583
+
1584
+ CMyComPtr<ICompressSetDecoderProperties2> setDecProps;
1585
+ coder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecProps);
1586
+ if (!setDecProps && propStreamSpec->GetPos() != 0)
1587
+ return E_FAIL;
1588
+
1589
+ CCrcOutStream *crcOutStreamSpec = new CCrcOutStream;
1590
+ CMyComPtr<ISequentialOutStream> crcOutStream = crcOutStreamSpec;
1591
+
1592
+ CBenchProgressInfo *pi = progressInfoSpec[decoderIndex];
1593
+ pi->BenchInfo.UnpackSize = 0;
1594
+ pi->BenchInfo.PackSize = 0;
1595
+
1596
+ #ifndef Z7_ST
1597
+ {
1598
+ CMyComPtr<ICompressSetCoderMt> setCoderMt;
1599
+ coder.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt);
1600
+ if (setCoderMt)
1601
+ {
1602
+ RINOK(setCoderMt->SetNumberOfThreads(NumDecoderSubThreads))
1603
+ }
1604
+ }
1605
+ #endif
1606
+
1607
+ CMyComPtr<ICompressSetCoderProperties> scp;
1608
+ coder.QueryInterface(IID_ICompressSetCoderProperties, &scp);
1609
+ if (scp)
1610
+ {
1611
+ const UInt64 reduceSize = _uncompressedDataSize;
1612
+ RINOK(_method.SetCoderProps(scp, &reduceSize))
1613
+ }
1614
+
1615
+ CMyComPtr<ICryptoProperties> cp;
1616
+ coder.QueryInterface(IID_ICryptoProperties, &cp);
1617
+
1618
+ if (setDecProps)
1619
+ {
1620
+ RINOK(setDecProps->SetDecoderProperties2(
1621
+ /* (const Byte *)*propStreamSpec, */
1622
+ propsData,
1623
+ (UInt32)propStreamSpec->GetPos()))
1624
+ }
1625
+
1626
+ {
1627
+ CMyComPtr<ICryptoSetPassword> sp;
1628
+ coder.QueryInterface(IID_ICryptoSetPassword, &sp);
1629
+ if (sp)
1630
+ {
1631
+ RINOK(sp->CryptoSetPassword(_psw, sizeof(_psw)))
1632
+ }
1633
+ }
1634
+
1635
+ UInt64 prev = 0;
1636
+
1637
+ if (cp)
1638
+ {
1639
+ RINOK(Set_Key_and_IV(cp))
1640
+ }
1641
+
1642
+ CMyComPtr<ICompressSetFinishMode> setFinishMode;
1643
+
1644
+ if (_decoderFilter)
1645
+ {
1646
+ if (compressedSize > rgCopy.Size())
1647
+ return E_FAIL;
1648
+ }
1649
+ else
1650
+ {
1651
+ decoder->QueryInterface(IID_ICompressSetFinishMode, (void **)&setFinishMode);
1652
+ }
1653
+
1654
+ const UInt64 numIterations = NumIterations;
1655
+ const E_CheckCrcMode checkCrcMode = CheckCrcMode_Dec;
1656
+
1657
+ for (UInt64 i = 0; i < numIterations; i++)
1658
+ {
1659
+ if (printCallback && pi->BenchInfo.UnpackSize - prev >= (1 << 26))
1660
+ {
1661
+ RINOK(printCallback->CheckBreak())
1662
+ prev = pi->BenchInfo.UnpackSize;
1663
+ }
1664
+
1665
+ const UInt64 outSize = kBufferSize;
1666
+ bool calcCrc = (checkCrcMode != k_CheckCrcMode_Never);
1667
+
1668
+ crcOutStreamSpec->Init();
1669
+
1670
+ if (_decoderFilter)
1671
+ {
1672
+ Byte *filterData = (Byte *)*outStreamSpec;
1673
+ if (calcCrc)
1674
+ {
1675
+ calcCrc = (i == 0);
1676
+ if (checkCrcMode == k_CheckCrcMode_Always)
1677
+ {
1678
+ calcCrc = true;
1679
+ memcpy((Byte *)rgCopy, (const Byte *)*outStreamSpec, compressedSize);
1680
+ filterData = rgCopy;
1681
+ }
1682
+ }
1683
+ _decoderFilter->Init();
1684
+ My_FilterBench(_decoderFilter, filterData, compressedSize,
1685
+ calcCrc ? &crcOutStreamSpec->Crc : NULL);
1686
+ }
1687
+ else
1688
+ {
1689
+ crcOutStreamSpec->CalcCrc = calcCrc;
1690
+ inStreamSpec->Init((const Byte *)*outStreamSpec, compressedSize);
1691
+
1692
+ if (setFinishMode)
1693
+ {
1694
+ RINOK(setFinishMode->SetFinishMode(BoolToUInt(true)))
1695
+ }
1696
+
1697
+ RINOK(decoder->Code(inStream, crcOutStream, NULL, &outSize, progressInfo[decoderIndex]))
1698
+
1699
+ if (setFinishMode)
1700
+ {
1701
+ if (!inStreamSpec->WasFinished())
1702
+ return S_FALSE;
1703
+
1704
+ CMyComPtr<ICompressGetInStreamProcessedSize> getInStreamProcessedSize;
1705
+ decoder.QueryInterface(IID_ICompressGetInStreamProcessedSize, (void **)&getInStreamProcessedSize);
1706
+
1707
+ if (getInStreamProcessedSize)
1708
+ {
1709
+ UInt64 processed;
1710
+ RINOK(getInStreamProcessedSize->GetInStreamProcessedSize(&processed))
1711
+ if (processed != compressedSize)
1712
+ return S_FALSE;
1713
+ }
1714
+ }
1715
+
1716
+ if (crcOutStreamSpec->Pos != outSize)
1717
+ return S_FALSE;
1718
+ }
1719
+
1720
+ if (calcCrc && CRC_GET_DIGEST(crcOutStreamSpec->Crc) != crc)
1721
+ return S_FALSE;
1722
+
1723
+ pi->BenchInfo.UnpackSize += kBufferSize;
1724
+ pi->BenchInfo.PackSize += compressedSize;
1725
+ }
1726
+
1727
+ decoder.Release();
1728
+ _decoderFilter.Release();
1729
+ return S_OK;
1730
+ }
1731
+
1732
+
1733
+ static const UInt32 kNumThreadsMax = (1 << 12);
1734
+
1735
+ struct CBenchEncoders
1736
+ {
1737
+ CEncoderInfo *encoders;
1738
+ CBenchEncoders(UInt32 num): encoders(NULL) { encoders = new CEncoderInfo[num]; }
1739
+ ~CBenchEncoders() { delete []encoders; }
1740
+ };
1741
+
1742
+
1743
+ static UInt64 GetNumIterations(UInt64 numCommands, UInt64 complexInCommands)
1744
+ {
1745
+ if (numCommands < (1 << 4))
1746
+ numCommands = (1 << 4);
1747
+ UInt64 res = complexInCommands / numCommands;
1748
+ return (res == 0 ? 1 : res);
1749
+ }
1750
+
1751
+
1752
+
1753
+ #ifndef Z7_ST
1754
+
1755
+ // ---------- CBenchThreadsFlusher ----------
1756
+
1757
+ struct CBenchThreadsFlusher
1758
+ {
1759
+ CBenchEncoders *EncodersSpec;
1760
+ CBenchSyncCommon Common;
1761
+ unsigned NumThreads;
1762
+ bool NeedClose;
1763
+
1764
+ CBenchThreadsFlusher(): NumThreads(0), NeedClose(false) {}
1765
+
1766
+ ~CBenchThreadsFlusher()
1767
+ {
1768
+ StartAndWait(true);
1769
+ }
1770
+
1771
+ WRes StartAndWait(bool exitMode = false);
1772
+ };
1773
+
1774
+
1775
+ WRes CBenchThreadsFlusher::StartAndWait(bool exitMode)
1776
+ {
1777
+ if (!NeedClose)
1778
+ return 0;
1779
+
1780
+ Common.ExitMode = exitMode;
1781
+ WRes res = Common.StartEvent.Set();
1782
+
1783
+ for (unsigned i = 0; i < NumThreads; i++)
1784
+ {
1785
+ NWindows::CThread &t = EncodersSpec->encoders[i].thread[0];
1786
+ if (t.IsCreated())
1787
+ {
1788
+ WRes res2 = t.Wait_Close();
1789
+ if (res == 0)
1790
+ res = res2;
1791
+ }
1792
+ }
1793
+ NeedClose = false;
1794
+ return res;
1795
+ }
1796
+
1797
+ #endif // Z7_ST
1798
+
1799
+
1800
+
1801
+ static void SetPseudoRand(Byte *data, size_t size, UInt32 startValue)
1802
+ {
1803
+ for (size_t i = 0; i < size; i++)
1804
+ {
1805
+ data[i] = (Byte)startValue;
1806
+ startValue++;
1807
+ }
1808
+ }
1809
+
1810
+
1811
+
1812
+ static HRESULT MethodBench(
1813
+ DECL_EXTERNAL_CODECS_LOC_VARS
1814
+ UInt64 complexInCommands,
1815
+ #ifndef Z7_ST
1816
+ bool oldLzmaBenchMode,
1817
+ UInt32 numThreads,
1818
+ const CAffinityMode *affinityMode,
1819
+ #endif
1820
+ const COneMethodInfo &method2,
1821
+ size_t uncompressedDataSize,
1822
+ const Byte *fileData,
1823
+ unsigned generateDictBits,
1824
+
1825
+ IBenchPrintCallback *printCallback,
1826
+ IBenchCallback *callback,
1827
+ CBenchProps *benchProps)
1828
+ {
1829
+ COneMethodInfo method = method2;
1830
+ UInt64 methodId;
1831
+ UInt32 numStreams;
1832
+ bool isFilter;
1833
+ const int codecIndex = FindMethod_Index(
1834
+ EXTERNAL_CODECS_LOC_VARS
1835
+ method.MethodName, true,
1836
+ methodId, numStreams, isFilter);
1837
+ if (codecIndex < 0)
1838
+ return E_NOTIMPL;
1839
+ if (numStreams != 1)
1840
+ return E_INVALIDARG;
1841
+
1842
+ UInt32 numEncoderThreads = 1;
1843
+ UInt32 numSubDecoderThreads = 1;
1844
+
1845
+ #ifndef Z7_ST
1846
+ numEncoderThreads = numThreads;
1847
+
1848
+ if (oldLzmaBenchMode)
1849
+ if (methodId == k_LZMA)
1850
+ {
1851
+ if (numThreads == 1 && method.Get_NumThreads() < 0)
1852
+ method.AddProp_NumThreads(1);
1853
+ const UInt32 numLzmaThreads = method.Get_Lzma_NumThreads();
1854
+ if (numThreads > 1 && numLzmaThreads > 1)
1855
+ {
1856
+ numEncoderThreads = (numThreads + 1) / 2; // 20.03
1857
+ numSubDecoderThreads = 2;
1858
+ }
1859
+ }
1860
+
1861
+ const bool mtEncMode = (numEncoderThreads > 1) || affinityMode->NeedAffinity();
1862
+
1863
+ #endif
1864
+
1865
+ CBenchEncoders encodersSpec(numEncoderThreads);
1866
+ CEncoderInfo *encoders = encodersSpec.encoders;
1867
+
1868
+ UInt32 i;
1869
+
1870
+ for (i = 0; i < numEncoderThreads; i++)
1871
+ {
1872
+ CEncoderInfo &encoder = encoders[i];
1873
+ encoder.callback = (i == 0) ? callback : NULL;
1874
+ encoder.printCallback = printCallback;
1875
+
1876
+ #ifndef Z7_ST
1877
+ encoder.EncoderIndex = i;
1878
+ encoder.NumEncoderInternalThreads = numSubDecoderThreads;
1879
+ encoder.AffinityMode = *affinityMode;
1880
+
1881
+ /*
1882
+ if (numSubDecoderThreads > 1)
1883
+ if (encoder.AffinityMode.NeedAffinity()
1884
+ && encoder.AffinityMode.NumBundleThreads == 1)
1885
+ {
1886
+ // if old LZMA benchmark uses two threads in coder, we increase (NumBundleThreads) for old LZMA benchmark uses two threads instead of one
1887
+ if (encoder.AffinityMode.NumBundleThreads * 2 <= encoder.AffinityMode.NumCores)
1888
+ encoder.AffinityMode.NumBundleThreads *= 2;
1889
+ }
1890
+ */
1891
+
1892
+ #endif
1893
+
1894
+ {
1895
+ CCreatedCoder cod;
1896
+ RINOK(CreateCoder_Index(EXTERNAL_CODECS_LOC_VARS (unsigned)codecIndex, true, encoder._encoderFilter, cod))
1897
+ encoder._encoder = cod.Coder;
1898
+ if (!encoder._encoder && !encoder._encoderFilter)
1899
+ return E_NOTIMPL;
1900
+ }
1901
+
1902
+ SetPseudoRand(encoder._iv, sizeof(encoder._iv), 17);
1903
+ SetPseudoRand(encoder._key, sizeof(encoder._key), 51);
1904
+ SetPseudoRand(encoder._psw, sizeof(encoder._psw), 123);
1905
+
1906
+ for (UInt32 j = 0; j < numSubDecoderThreads; j++)
1907
+ {
1908
+ CCreatedCoder cod;
1909
+ CMyComPtr<ICompressCoder> &decoder = encoder._decoders[j];
1910
+ RINOK(CreateCoder_Id(EXTERNAL_CODECS_LOC_VARS methodId, false, encoder._decoderFilter, cod))
1911
+ decoder = cod.Coder;
1912
+ if (!encoder._decoderFilter && !decoder)
1913
+ return E_NOTIMPL;
1914
+ }
1915
+
1916
+ encoder.UseRealData_Enc =
1917
+ encoder.CheckCrc_Enc = (benchProps->EncComplex) > 30;
1918
+
1919
+ encoder.CheckCrcMode_Dec = k_CheckCrcMode_Always;
1920
+ if (benchProps->DecComplexCompr +
1921
+ benchProps->DecComplexUnc <= 30)
1922
+ encoder.CheckCrcMode_Dec =
1923
+ k_CheckCrcMode_FirstPass; // for filters
1924
+ // k_CheckCrcMode_Never; // for debug
1925
+ // k_CheckCrcMode_Always; // for debug
1926
+ if (fileData)
1927
+ {
1928
+ encoder.UseRealData_Enc = true;
1929
+ encoder.CheckCrcMode_Dec = k_CheckCrcMode_Always;
1930
+ }
1931
+ }
1932
+
1933
+ UInt32 crc = 0;
1934
+ if (fileData)
1935
+ crc = CrcCalc(fileData, uncompressedDataSize);
1936
+
1937
+ for (i = 0; i < numEncoderThreads; i++)
1938
+ {
1939
+ CEncoderInfo &encoder = encoders[i];
1940
+ encoder._method = method;
1941
+ encoder.generateDictBits = generateDictBits;
1942
+ encoder._uncompressedDataSize = uncompressedDataSize;
1943
+ encoder.kBufferSize = uncompressedDataSize;
1944
+ encoder.fileData = fileData;
1945
+ encoder.crc = crc;
1946
+ }
1947
+
1948
+ CBenchProgressStatus status;
1949
+ status.Res = S_OK;
1950
+ status.EncodeMode = true;
1951
+
1952
+ #ifndef Z7_ST
1953
+ CBenchThreadsFlusher encoderFlusher;
1954
+ if (mtEncMode)
1955
+ {
1956
+ WRes wres = encoderFlusher.Common.StartEvent.Create();
1957
+ if (wres != 0)
1958
+ return HRESULT_FROM_WIN32(wres);
1959
+ encoderFlusher.NumThreads = numEncoderThreads;
1960
+ encoderFlusher.EncodersSpec = &encodersSpec;
1961
+ encoderFlusher.NeedClose = true;
1962
+ }
1963
+ #endif
1964
+
1965
+ for (i = 0; i < numEncoderThreads; i++)
1966
+ {
1967
+ CEncoderInfo &encoder = encoders[i];
1968
+ encoder.NumIterations = GetNumIterations(benchProps->GetNumCommands_Enc(uncompressedDataSize), complexInCommands);
1969
+ // encoder.NumIterations = 3;
1970
+ {
1971
+ #if 0
1972
+ #define kCrcPoly 0xEDB88320
1973
+ UInt32 r = i;
1974
+ unsigned num = numEncoderThreads < 256 ? 8 : 16;
1975
+ do
1976
+ r = (r >> 1) ^ (kCrcPoly & ((UInt32)0 - (r & 1)));
1977
+ while (--num);
1978
+ encoder.Salt = r;
1979
+ #else
1980
+ UInt32 salt0 = g_CrcTable[(Byte)i];
1981
+ UInt32 salt1 = g_CrcTable[(Byte)(i >> 8)];
1982
+ encoder.Salt = salt0 ^ (salt1 << 3);
1983
+ #endif
1984
+ }
1985
+
1986
+ // (g_CrcTable[0] == 0), and (encoder.Salt == 0) for first thread
1987
+ // printf("\n encoder index = %d, Salt = %8x\n", i, encoder.Salt);
1988
+
1989
+ encoder.KeySize = benchProps->KeySize;
1990
+
1991
+ for (int j = 0; j < 2; j++)
1992
+ {
1993
+ CBenchProgressInfo *spec = new CBenchProgressInfo;
1994
+ encoder.progressInfoSpec[j] = spec;
1995
+ encoder.progressInfo[j] = spec;
1996
+ spec->Status = &status;
1997
+ }
1998
+
1999
+ if (i == 0)
2000
+ {
2001
+ CBenchProgressInfo *bpi = encoder.progressInfoSpec[0];
2002
+ bpi->Callback = callback;
2003
+ bpi->BenchInfo.NumIterations = numEncoderThreads;
2004
+ }
2005
+
2006
+ #ifndef Z7_ST
2007
+ if (mtEncMode)
2008
+ {
2009
+ #ifdef USE_ALLOCA
2010
+ encoder.AllocaSize = BENCH_ALLOCA_VALUE(i);
2011
+ #endif
2012
+
2013
+ encoder.Common = &encoderFlusher.Common;
2014
+ encoder.IsGlobalMtMode = numEncoderThreads > 1;
2015
+ RINOK(encoder.CreateEncoderThread())
2016
+ }
2017
+ #endif
2018
+ }
2019
+
2020
+ if (printCallback)
2021
+ {
2022
+ RINOK(printCallback->CheckBreak())
2023
+ }
2024
+
2025
+ #ifndef Z7_ST
2026
+ if (mtEncMode)
2027
+ {
2028
+ for (i = 0; i < numEncoderThreads; i++)
2029
+ {
2030
+ CEncoderInfo &encoder = encoders[i];
2031
+ const WRes wres = encoder.ReadyEvent.Lock();
2032
+ if (wres != 0)
2033
+ return HRESULT_FROM_WIN32(wres);
2034
+ RINOK(encoder.Results[0])
2035
+ }
2036
+
2037
+ CBenchProgressInfo *bpi = encoders[0].progressInfoSpec[0];
2038
+ bpi->SetStartTime();
2039
+
2040
+ const WRes wres = encoderFlusher.StartAndWait();
2041
+ if (status.Res == 0 && wres != 0)
2042
+ return HRESULT_FROM_WIN32(wres);
2043
+ }
2044
+ else
2045
+ #endif
2046
+ {
2047
+ RINOK(encoders[0].Encode())
2048
+ }
2049
+
2050
+ RINOK(status.Res)
2051
+
2052
+ CBenchInfo info;
2053
+
2054
+ encoders[0].progressInfoSpec[0]->SetFinishTime(info);
2055
+ info.UnpackSize = 0;
2056
+ info.PackSize = 0;
2057
+ info.NumIterations = encoders[0].NumIterations;
2058
+
2059
+ for (i = 0; i < numEncoderThreads; i++)
2060
+ {
2061
+ const CEncoderInfo &encoder = encoders[i];
2062
+ info.UnpackSize += encoder.kBufferSize;
2063
+ info.PackSize += encoder.compressedSize;
2064
+ // printf("\n%7d\n", encoder.compressedSize);
2065
+ }
2066
+
2067
+ RINOK(callback->SetEncodeResult(info, true))
2068
+
2069
+
2070
+
2071
+
2072
+ // ---------- Decode ----------
2073
+
2074
+ status.Res = S_OK;
2075
+ status.EncodeMode = false;
2076
+
2077
+ const UInt32 numDecoderThreads = numEncoderThreads * numSubDecoderThreads;
2078
+ #ifndef Z7_ST
2079
+ const bool mtDecoderMode = (numDecoderThreads > 1) || affinityMode->NeedAffinity();
2080
+ #endif
2081
+
2082
+ for (i = 0; i < numEncoderThreads; i++)
2083
+ {
2084
+ CEncoderInfo &encoder = encoders[i];
2085
+
2086
+ /*
2087
+ #ifndef Z7_ST
2088
+ // encoder.affinityMode = *affinityMode;
2089
+ if (encoder.NumEncoderInternalThreads != 1)
2090
+ encoder.AffinityMode.DivideNum = encoder.NumEncoderInternalThreads;
2091
+ #endif
2092
+ */
2093
+
2094
+
2095
+ if (i == 0)
2096
+ {
2097
+ encoder.NumIterations = GetNumIterations(
2098
+ benchProps->GetNumCommands_Dec(
2099
+ encoder.compressedSize,
2100
+ encoder.kBufferSize),
2101
+ complexInCommands);
2102
+ CBenchProgressInfo *bpi = encoder.progressInfoSpec[0];
2103
+ bpi->Callback = callback;
2104
+ bpi->BenchInfo.NumIterations = numDecoderThreads;
2105
+ bpi->SetStartTime();
2106
+ }
2107
+ else
2108
+ encoder.NumIterations = encoders[0].NumIterations;
2109
+
2110
+ #ifndef Z7_ST
2111
+ {
2112
+ const int numSubThreads = method.Get_NumThreads();
2113
+ encoder.NumDecoderSubThreads = (numSubThreads <= 0) ? 1 : (unsigned)numSubThreads;
2114
+ }
2115
+ if (mtDecoderMode)
2116
+ {
2117
+ for (UInt32 j = 0; j < numSubDecoderThreads; j++)
2118
+ {
2119
+ const HRESULT res = encoder.CreateDecoderThread(j, (i == 0 && j == 0)
2120
+ #ifdef USE_ALLOCA
2121
+ , BENCH_ALLOCA_VALUE(i * numSubDecoderThreads + j)
2122
+ #endif
2123
+ );
2124
+ RINOK(res)
2125
+ }
2126
+ }
2127
+ else
2128
+ #endif
2129
+ {
2130
+ RINOK(encoder.Decode(0))
2131
+ }
2132
+ }
2133
+
2134
+ #ifndef Z7_ST
2135
+ if (mtDecoderMode)
2136
+ {
2137
+ WRes wres = 0;
2138
+ HRESULT res = S_OK;
2139
+ for (i = 0; i < numEncoderThreads; i++)
2140
+ for (UInt32 j = 0; j < numSubDecoderThreads; j++)
2141
+ {
2142
+ CEncoderInfo &encoder = encoders[i];
2143
+ const WRes wres2 = encoder.thread[j].
2144
+ // Wait(); // later we can get thread times from thread in UNDER_CE
2145
+ Wait_Close();
2146
+ if (wres == 0 && wres2 != 0)
2147
+ wres = wres2;
2148
+ const HRESULT res2 = encoder.Results[j];
2149
+ if (res == 0 && res2 != 0)
2150
+ res = res2;
2151
+ }
2152
+ if (wres != 0)
2153
+ return HRESULT_FROM_WIN32(wres);
2154
+ RINOK(res)
2155
+ }
2156
+ #endif // Z7_ST
2157
+
2158
+ RINOK(status.Res)
2159
+ encoders[0].progressInfoSpec[0]->SetFinishTime(info);
2160
+
2161
+ /*
2162
+ #ifndef Z7_ST
2163
+ #ifdef UNDER_CE
2164
+ if (mtDecoderMode)
2165
+ for (i = 0; i < numEncoderThreads; i++)
2166
+ for (UInt32 j = 0; j < numSubDecoderThreads; j++)
2167
+ {
2168
+ FILETIME creationTime, exitTime, kernelTime, userTime;
2169
+ if (::GetThreadTimes(encoders[i].thread[j], &creationTime, &exitTime, &kernelTime, &userTime) != 0)
2170
+ info.UserTime += GetTime64(userTime) + GetTime64(kernelTime);
2171
+ }
2172
+ #endif
2173
+ #endif
2174
+ */
2175
+
2176
+ info.UnpackSize = 0;
2177
+ info.PackSize = 0;
2178
+ info.NumIterations = numSubDecoderThreads * encoders[0].NumIterations;
2179
+
2180
+ for (i = 0; i < numEncoderThreads; i++)
2181
+ {
2182
+ const CEncoderInfo &encoder = encoders[i];
2183
+ info.UnpackSize += encoder.kBufferSize;
2184
+ info.PackSize += encoder.compressedSize;
2185
+ }
2186
+
2187
+ // RINOK(callback->SetDecodeResult(info, false)) // why we called before 21.03 ??
2188
+ RINOK(callback->SetDecodeResult(info, true))
2189
+
2190
+ return S_OK;
2191
+ }
2192
+
2193
+
2194
+
2195
+ static inline UInt64 GetDictSizeFromLog(unsigned dictSizeLog)
2196
+ {
2197
+ /*
2198
+ if (dictSizeLog < 32)
2199
+ return (UInt32)1 << dictSizeLog;
2200
+ else
2201
+ return (UInt32)(Int32)-1;
2202
+ */
2203
+ return (UInt64)1 << dictSizeLog;
2204
+ }
2205
+
2206
+
2207
+ // it's limit of current LZMA implementation that can be changed later
2208
+ #define kLzmaMaxDictSize ((UInt32)15 << 28)
2209
+
2210
+ static inline UInt64 GetLZMAUsage(bool multiThread, int btMode, UInt64 dict)
2211
+ {
2212
+ if (dict == 0)
2213
+ dict = 1;
2214
+ if (dict > kLzmaMaxDictSize)
2215
+ dict = kLzmaMaxDictSize;
2216
+ UInt32 hs = (UInt32)dict - 1;
2217
+ hs |= (hs >> 1);
2218
+ hs |= (hs >> 2);
2219
+ hs |= (hs >> 4);
2220
+ hs |= (hs >> 8);
2221
+ hs >>= 1;
2222
+ hs |= 0xFFFF;
2223
+ if (hs > (1 << 24))
2224
+ hs >>= 1;
2225
+ hs++;
2226
+ hs += (1 << 16);
2227
+
2228
+ const UInt32 kBlockSizeMax = (UInt32)0 - (UInt32)(1 << 16);
2229
+ UInt64 blockSize = (UInt64)dict + (1 << 16)
2230
+ + (multiThread ? (1 << 20) : 0);
2231
+ blockSize += (blockSize >> (blockSize < ((UInt32)1 << 30) ? 1 : 2));
2232
+ if (blockSize >= kBlockSizeMax)
2233
+ blockSize = kBlockSizeMax;
2234
+
2235
+ UInt64 son = (UInt64)dict;
2236
+ if (btMode)
2237
+ son *= 2;
2238
+ const UInt64 v = (hs + son) * 4 + blockSize +
2239
+ (1 << 20) + (multiThread ? (6 << 20) : 0);
2240
+
2241
+ // printf("\nGetLZMAUsage = %d\n", (UInt32)(v >> 20));
2242
+ // printf("\nblockSize = %d\n", (UInt32)(blockSize >> 20));
2243
+ return v;
2244
+ }
2245
+
2246
+
2247
+ UInt64 GetBenchMemoryUsage(UInt32 numThreads, int level, UInt64 dictionary, bool totalBench)
2248
+ {
2249
+ const size_t kBufferSize = (size_t)dictionary + kAdditionalSize;
2250
+ const UInt64 kCompressedBufferSize = GetBenchCompressedSize(kBufferSize); // / 2;
2251
+ if (level < 0)
2252
+ level = 5;
2253
+ const int algo = (level < 5 ? 0 : 1);
2254
+ const int btMode = (algo == 0 ? 0 : 1);
2255
+
2256
+ UInt32 numBigThreads = numThreads;
2257
+ const bool lzmaMt = (totalBench || (numThreads > 1 && btMode));
2258
+ if (btMode)
2259
+ {
2260
+ if (!totalBench && lzmaMt)
2261
+ numBigThreads /= 2;
2262
+ }
2263
+ return ((UInt64)kBufferSize + kCompressedBufferSize +
2264
+ GetLZMAUsage(lzmaMt, btMode, dictionary) + (2 << 20)) * numBigThreads;
2265
+ }
2266
+
2267
+ static UInt64 GetBenchMemoryUsage_Hash(UInt32 numThreads, UInt64 dictionary)
2268
+ {
2269
+ // dictionary += (dictionary >> 9); // for page tables (virtual memory)
2270
+ return (UInt64)(dictionary + (1 << 15)) * numThreads + (2 << 20);
2271
+ }
2272
+
2273
+
2274
+ // ---------- CRC and HASH ----------
2275
+
2276
+ struct CCrcInfo_Base
2277
+ {
2278
+ CMidAlignedBuffer Buffer;
2279
+ const Byte *Data;
2280
+ size_t Size;
2281
+ bool CreateLocalBuf;
2282
+ UInt32 CheckSum_Res;
2283
+
2284
+ CCrcInfo_Base(): CreateLocalBuf(true), CheckSum_Res(0) {}
2285
+
2286
+ HRESULT Generate(const Byte *data, size_t size);
2287
+ HRESULT CrcProcess(UInt64 numIterations,
2288
+ const UInt32 *checkSum, IHasher *hf,
2289
+ IBenchPrintCallback *callback);
2290
+ };
2291
+
2292
+
2293
+ // for debug: define it to test hash calling with unaligned data
2294
+ // #define Z7_BENCH_HASH_ALIGN_BUF_OFFSET 3
2295
+
2296
+ HRESULT CCrcInfo_Base::Generate(const Byte *data, size_t size)
2297
+ {
2298
+ Size = size;
2299
+ Data = data;
2300
+ if (!data || CreateLocalBuf)
2301
+ {
2302
+ Byte *buf;
2303
+ const size_t size2 = (size + k_RandBuf_AlignMask) & ~(size_t)k_RandBuf_AlignMask;
2304
+ if (size2 < size)
2305
+ return E_OUTOFMEMORY;
2306
+ #ifdef Z7_BENCH_HASH_ALIGN_BUF_OFFSET
2307
+ ALLOC_WITH_HRESULT(&Buffer, size2 + Z7_BENCH_HASH_ALIGN_BUF_OFFSET)
2308
+ buf = Buffer + Z7_BENCH_HASH_ALIGN_BUF_OFFSET;
2309
+ #else
2310
+ ALLOC_WITH_HRESULT(&Buffer, size2)
2311
+ buf = Buffer;
2312
+ #endif
2313
+ Data = buf;
2314
+ if (!data)
2315
+ RandGen_BufAfterPad(buf, size);
2316
+ else if (size != 0) // (CreateLocalBuf == true)
2317
+ memcpy(buf, data, size);
2318
+ }
2319
+ return S_OK;
2320
+ }
2321
+
2322
+
2323
+ #if 1
2324
+ #define HashUpdate(hf, data, size) hf->Update(data, size)
2325
+ #else
2326
+ // for debug:
2327
+ static void HashUpdate(IHasher *hf, const void *data, UInt32 size)
2328
+ {
2329
+ for (;;)
2330
+ {
2331
+ if (size == 0)
2332
+ return;
2333
+ UInt32 size2 = (size * 0x85EBCA87) % size / 8;
2334
+ // UInt32 size2 = size / 2;
2335
+ if (size2 == 0)
2336
+ size2 = 1;
2337
+ hf->Update(data, size2);
2338
+ data = (const void *)((const Byte *)data + size2);
2339
+ size -= size2;
2340
+ }
2341
+ }
2342
+ #endif
2343
+
2344
+
2345
+ HRESULT CCrcInfo_Base::CrcProcess(UInt64 numIterations,
2346
+ const UInt32 *checkSum, IHasher *hf,
2347
+ IBenchPrintCallback *callback)
2348
+ {
2349
+ MY_ALIGN(16)
2350
+ UInt32 hash32[64 / 4];
2351
+ memset(hash32, 0, sizeof(hash32));
2352
+
2353
+ CheckSum_Res = 0;
2354
+
2355
+ const UInt32 hashSize = hf->GetDigestSize();
2356
+ if (hashSize > sizeof(hash32))
2357
+ return S_FALSE;
2358
+
2359
+ const Byte *buf = Data;
2360
+ const size_t size = Size;
2361
+ UInt32 checkSum_Prev = 0;
2362
+
2363
+ UInt64 prev = 0;
2364
+ UInt64 cur = 0;
2365
+
2366
+ do
2367
+ {
2368
+ hf->Init();
2369
+ size_t pos = 0;
2370
+ do
2371
+ {
2372
+ const size_t rem = size - pos;
2373
+ const UInt32 kStep = ((UInt32)1 << 31);
2374
+ const UInt32 curSize = (rem < kStep) ? (UInt32)rem : kStep;
2375
+ HashUpdate(hf, buf + pos, curSize);
2376
+ pos += curSize;
2377
+ }
2378
+ while (pos != size);
2379
+
2380
+ hf->Final((Byte *)(void *)hash32);
2381
+ UInt32 sum = 0;
2382
+ for (UInt32 j = 0; j < hashSize; j += 4)
2383
+ {
2384
+ sum = rotlFixed(sum, 11);
2385
+ sum += GetUi32((const Byte *)(const void *)hash32 + j);
2386
+ }
2387
+ if (checkSum)
2388
+ {
2389
+ if (sum != *checkSum)
2390
+ return S_FALSE;
2391
+ }
2392
+ else
2393
+ {
2394
+ checkSum_Prev = sum;
2395
+ checkSum = &checkSum_Prev;
2396
+ }
2397
+ if (callback)
2398
+ {
2399
+ cur += size;
2400
+ if (cur - prev >= ((UInt32)1 << 30))
2401
+ {
2402
+ prev = cur;
2403
+ RINOK(callback->CheckBreak())
2404
+ }
2405
+ }
2406
+ }
2407
+ while (--numIterations);
2408
+
2409
+ CheckSum_Res = checkSum_Prev;
2410
+ return S_OK;
2411
+ }
2412
+
2413
+ extern
2414
+ UInt32 g_BenchCpuFreqTemp; // we need non-static variavble to disable compiler optimization
2415
+ UInt32 g_BenchCpuFreqTemp = 1;
2416
+
2417
+ #define YY1 sum += val; sum ^= val;
2418
+ #define YY3 YY1 YY1 YY1 YY1
2419
+ #define YY5 YY3 YY3 YY3 YY3
2420
+ #define YY7 YY5 YY5 YY5 YY5
2421
+ static const UInt32 kNumFreqCommands = 128;
2422
+
2423
+ EXTERN_C_BEGIN
2424
+
2425
+ static UInt32 CountCpuFreq(UInt32 sum, UInt32 num, UInt32 val)
2426
+ {
2427
+ for (UInt32 i = 0; i < num; i++)
2428
+ {
2429
+ YY7
2430
+ }
2431
+ return sum;
2432
+ }
2433
+
2434
+ EXTERN_C_END
2435
+
2436
+
2437
+ #ifndef Z7_ST
2438
+
2439
+ struct CBaseThreadInfo
2440
+ {
2441
+ NWindows::CThread Thread;
2442
+ IBenchPrintCallback *Callback;
2443
+ HRESULT CallbackRes;
2444
+
2445
+ WRes Wait_If_Created()
2446
+ {
2447
+ if (!Thread.IsCreated())
2448
+ return 0;
2449
+ return Thread.Wait_Close();
2450
+ }
2451
+ };
2452
+
2453
+ struct CFreqInfo: public CBaseThreadInfo
2454
+ {
2455
+ UInt32 ValRes;
2456
+ UInt32 Size;
2457
+ UInt64 NumIterations;
2458
+ };
2459
+
2460
+ static THREAD_FUNC_DECL FreqThreadFunction(void *param)
2461
+ {
2462
+ CFreqInfo *p = (CFreqInfo *)param;
2463
+
2464
+ UInt32 sum = g_BenchCpuFreqTemp;
2465
+ for (UInt64 k = p->NumIterations; k > 0; k--)
2466
+ {
2467
+ if (p->Callback)
2468
+ {
2469
+ p->CallbackRes = p->Callback->CheckBreak();
2470
+ if (p->CallbackRes != S_OK)
2471
+ break;
2472
+ }
2473
+ sum = CountCpuFreq(sum, p->Size, g_BenchCpuFreqTemp);
2474
+ }
2475
+ p->ValRes = sum;
2476
+ return THREAD_FUNC_RET_ZERO;
2477
+ }
2478
+
2479
+ struct CFreqThreads
2480
+ {
2481
+ CFreqInfo *Items;
2482
+ UInt32 NumThreads;
2483
+
2484
+ CFreqThreads(): Items(NULL), NumThreads(0) {}
2485
+
2486
+ WRes WaitAll()
2487
+ {
2488
+ WRes wres = 0;
2489
+ for (UInt32 i = 0; i < NumThreads; i++)
2490
+ {
2491
+ WRes wres2 = Items[i].Wait_If_Created();
2492
+ if (wres == 0 && wres2 != 0)
2493
+ wres = wres2;
2494
+ }
2495
+ NumThreads = 0;
2496
+ return wres;
2497
+ }
2498
+
2499
+ ~CFreqThreads()
2500
+ {
2501
+ WaitAll();
2502
+ delete []Items;
2503
+ }
2504
+ };
2505
+
2506
+
2507
+ static THREAD_FUNC_DECL CrcThreadFunction(void *param);
2508
+
2509
+ struct CCrcInfo: public CBaseThreadInfo
2510
+ {
2511
+ const Byte *Data;
2512
+ size_t Size;
2513
+ UInt64 NumIterations;
2514
+ bool CheckSumDefined;
2515
+ UInt32 CheckSum;
2516
+ CMyComPtr<IHasher> Hasher;
2517
+ HRESULT Res;
2518
+ UInt32 CheckSum_Res;
2519
+
2520
+ #ifndef Z7_ST
2521
+ NSynchronization::CManualResetEvent ReadyEvent;
2522
+ UInt32 ThreadIndex;
2523
+ CBenchSyncCommon *Common;
2524
+ CAffinityMode AffinityMode;
2525
+ #endif
2526
+
2527
+ // we want to call CCrcInfo_Base::Buffer.Free() in main thread.
2528
+ // so we uses non-local CCrcInfo_Base.
2529
+ CCrcInfo_Base crcib;
2530
+
2531
+ HRESULT CreateThread()
2532
+ {
2533
+ WRes res = 0;
2534
+ if (!ReadyEvent.IsCreated())
2535
+ res = ReadyEvent.Create();
2536
+ if (res == 0)
2537
+ res = AffinityMode.CreateThread_WithAffinity(Thread, CrcThreadFunction, this,
2538
+ ThreadIndex);
2539
+ return HRESULT_FROM_WIN32(res);
2540
+ }
2541
+
2542
+ #ifdef USE_ALLOCA
2543
+ size_t AllocaSize;
2544
+ #endif
2545
+
2546
+ void Process();
2547
+
2548
+ CCrcInfo(): Res(E_FAIL) {}
2549
+ };
2550
+
2551
+ static const bool k_Crc_CreateLocalBuf_For_File = true; // for total BW test
2552
+ // static const bool k_Crc_CreateLocalBuf_For_File = false; // for shared memory read test
2553
+
2554
+ void CCrcInfo::Process()
2555
+ {
2556
+ crcib.CreateLocalBuf = k_Crc_CreateLocalBuf_For_File;
2557
+ // we can use additional Generate() passes to reduce some time effects for new page allocation
2558
+ // for (unsigned y = 0; y < 10; y++)
2559
+ Res = crcib.Generate(Data, Size);
2560
+
2561
+ // if (Common)
2562
+ {
2563
+ WRes wres = ReadyEvent.Set();
2564
+ if (wres != 0)
2565
+ {
2566
+ if (Res == 0)
2567
+ Res = HRESULT_FROM_WIN32(wres);
2568
+ return;
2569
+ }
2570
+ if (Res != 0)
2571
+ return;
2572
+
2573
+ wres = Common->StartEvent.Lock();
2574
+
2575
+ if (wres != 0)
2576
+ {
2577
+ Res = HRESULT_FROM_WIN32(wres);
2578
+ return;
2579
+ }
2580
+ if (Common->ExitMode)
2581
+ return;
2582
+ }
2583
+
2584
+ Res = crcib.CrcProcess(NumIterations,
2585
+ CheckSumDefined ? &CheckSum : NULL, Hasher,
2586
+ Callback);
2587
+ CheckSum_Res = crcib.CheckSum_Res;
2588
+ /*
2589
+ We don't want to include the time of slow CCrcInfo_Base::Buffer.Free()
2590
+ to time of benchmark. So we don't free Buffer here
2591
+ */
2592
+ // crcib.Buffer.Free();
2593
+ }
2594
+
2595
+
2596
+ static THREAD_FUNC_DECL CrcThreadFunction(void *param)
2597
+ {
2598
+ CCrcInfo *p = (CCrcInfo *)param;
2599
+
2600
+ #ifdef USE_ALLOCA
2601
+ alloca(p->AllocaSize);
2602
+ #endif
2603
+ p->Process();
2604
+ return THREAD_FUNC_RET_ZERO;
2605
+ }
2606
+
2607
+
2608
+ struct CCrcThreads
2609
+ {
2610
+ CCrcInfo *Items;
2611
+ unsigned NumThreads;
2612
+ CBenchSyncCommon Common;
2613
+ bool NeedClose;
2614
+
2615
+ CCrcThreads(): Items(NULL), NumThreads(0), NeedClose(false) {}
2616
+
2617
+ WRes StartAndWait(bool exitMode = false);
2618
+
2619
+ ~CCrcThreads()
2620
+ {
2621
+ StartAndWait(true);
2622
+ delete []Items;
2623
+ }
2624
+ };
2625
+
2626
+
2627
+ WRes CCrcThreads::StartAndWait(bool exitMode)
2628
+ {
2629
+ if (!NeedClose)
2630
+ return 0;
2631
+
2632
+ Common.ExitMode = exitMode;
2633
+ WRes wres = Common.StartEvent.Set();
2634
+
2635
+ for (unsigned i = 0; i < NumThreads; i++)
2636
+ {
2637
+ WRes wres2 = Items[i].Wait_If_Created();
2638
+ if (wres == 0 && wres2 != 0)
2639
+ wres = wres2;
2640
+ }
2641
+ NumThreads = 0;
2642
+ NeedClose = false;
2643
+ return wres;
2644
+ }
2645
+
2646
+ #endif
2647
+
2648
+
2649
+ /*
2650
+ static UInt32 CrcCalc1(const Byte *buf, size_t size)
2651
+ {
2652
+ UInt32 crc = CRC_INIT_VAL;
2653
+ for (size_t i = 0; i < size; i++)
2654
+ crc = CRC_UPDATE_BYTE(crc, buf[i]);
2655
+ return CRC_GET_DIGEST(crc);
2656
+ }
2657
+ */
2658
+
2659
+ /*
2660
+ static UInt32 RandGenCrc(Byte *buf, size_t size, CBaseRandomGenerator &RG)
2661
+ {
2662
+ RandGen(buf, size, RG);
2663
+ return CrcCalc1(buf, size);
2664
+ }
2665
+ */
2666
+
2667
+ static bool CrcInternalTest()
2668
+ {
2669
+ CAlignedBuffer buffer;
2670
+ const size_t kBufSize = 1 << 11;
2671
+ const size_t kCheckSize = 1 << 6;
2672
+ buffer.Alloc(kBufSize);
2673
+ if (!buffer.IsAllocated())
2674
+ return false;
2675
+ Byte *buf = (Byte *)buffer;
2676
+ RandGen_BufAfterPad(buf, kBufSize);
2677
+ UInt32 sum = 0;
2678
+ for (size_t i = 0; i < kBufSize - kCheckSize * 2; i += kCheckSize - 1)
2679
+ for (size_t j = 0; j < kCheckSize; j++)
2680
+ {
2681
+ sum = rotlFixed(sum, 11);
2682
+ sum += CrcCalc(buf + i + j, j);
2683
+ }
2684
+ return sum == 0x28462c7c;
2685
+ }
2686
+
2687
+ struct CBenchMethod
2688
+ {
2689
+ unsigned Weight;
2690
+ unsigned DictBits;
2691
+ Int32 EncComplex;
2692
+ Int32 DecComplexCompr;
2693
+ Int32 DecComplexUnc;
2694
+ const char *Name;
2695
+ // unsigned KeySize;
2696
+ };
2697
+
2698
+ // #define USE_SW_CMPLX
2699
+
2700
+ #ifdef USE_SW_CMPLX
2701
+ #define CMPLX(x) ((x) * 1000)
2702
+ #else
2703
+ #define CMPLX(x) (x)
2704
+ #endif
2705
+
2706
+ static const CBenchMethod g_Bench[] =
2707
+ {
2708
+ // { 40, 17, 357, 145, 20, "LZMA:x1" },
2709
+ // { 20, 18, 360, 145, 20, "LZMA2:x1:mt2" },
2710
+
2711
+ { 20, 18, 360, 145, 20, "LZMA:x1" },
2712
+ { 20, 22, 600, 145, 20, "LZMA:x3" },
2713
+
2714
+ { 80, 24, 1220, 145, 20, "LZMA:x5:mt1" },
2715
+ { 80, 24, 1220, 145, 20, "LZMA:x5:mt2" },
2716
+
2717
+ { 10, 16, 124, 40, 14, "Deflate:x1" },
2718
+ { 20, 16, 376, 40, 14, "Deflate:x5" },
2719
+ { 10, 16, 1082, 40, 14, "Deflate:x7" },
2720
+ { 10, 17, 422, 40, 14, "Deflate64:x5" },
2721
+
2722
+ { 10, 15, 590, 69, 69, "BZip2:x1" },
2723
+ { 20, 19, 815, 122, 122, "BZip2:x5" },
2724
+ { 10, 19, 815, 122, 122, "BZip2:x5:mt2" },
2725
+ { 10, 19, 2530, 122, 122, "BZip2:x7" },
2726
+
2727
+ // { 10, 18, 1010, 0, 1150, "PPMDZip:x1" },
2728
+ { 10, 18, 1010, 0, 1150, "PPMD:x1" },
2729
+ // { 10, 22, 1655, 0, 1830, "PPMDZip:x5" },
2730
+ { 10, 22, 1655, 0, 1830, "PPMD:x5" },
2731
+
2732
+ // { 2, 0, -16, 0, -16, "Swap2" },
2733
+ { 2, 0, -16, 0, -16, "Swap4" },
2734
+
2735
+ // { 2, 0, 3, 0, 4, "Delta:1" },
2736
+ // { 2, 0, 3, 0, 4, "Delta:2" },
2737
+ // { 2, 0, 3, 0, 4, "Delta:3" },
2738
+ { 2, 0, 3, 0, 4, "Delta:4" },
2739
+ // { 2, 0, 3, 0, 4, "Delta:8" },
2740
+ // { 2, 0, 3, 0, 4, "Delta:32" },
2741
+
2742
+ { 2, 0, 2, 0, 2, "BCJ" },
2743
+ { 2, 0, 1, 0, 1, "ARM64" },
2744
+ { 2, 0, 1, 0, 1, "RISCV" },
2745
+
2746
+ // { 10, 0, 18, 0, 18, "AES128CBC:1" },
2747
+ // { 10, 0, 21, 0, 21, "AES192CBC:1" },
2748
+ { 10, 0, 24, 0, 24, "AES256CBC:1" },
2749
+
2750
+ // { 10, 0, 18, 0, 18, "AES128CTR:1" },
2751
+ // { 10, 0, 21, 0, 21, "AES192CTR:1" },
2752
+ // { 10, 0, 24, 0, 24, "AES256CTR:1" },
2753
+ // { 2, 0, CMPLX(6), 0, CMPLX(1), "AES128CBC:2" },
2754
+ // { 2, 0, CMPLX(7), 0, CMPLX(1), "AES192CBC:2" },
2755
+ { 2, 0, CMPLX(8), 0, CMPLX(1), "AES256CBC:2" },
2756
+
2757
+ // { 2, 0, CMPLX(1), 0, CMPLX(1), "AES128CTR:2" },
2758
+ // { 2, 0, CMPLX(1), 0, CMPLX(1), "AES192CTR:2" },
2759
+ // { 2, 0, CMPLX(1), 0, CMPLX(1), "AES256CTR:2" },
2760
+
2761
+ // { 1, 0, CMPLX(6), 0, -2, "AES128CBC:3" },
2762
+ // { 1, 0, CMPLX(7), 0, -2, "AES192CBC:3" },
2763
+ { 1, 0, CMPLX(8), 0, -2, "AES256CBC:3" }
2764
+
2765
+ // { 1, 0, CMPLX(1), 0, -2, "AES128CTR:3" },
2766
+ // { 1, 0, CMPLX(1), 0, -2, "AES192CTR:3" },
2767
+ // { 1, 0, CMPLX(1), 0, -2, "AES256CTR:3" },
2768
+ };
2769
+
2770
+ struct CBenchHash
2771
+ {
2772
+ unsigned Weight;
2773
+ UInt32 Complex;
2774
+ UInt32 CheckSum;
2775
+ const char *Name;
2776
+ };
2777
+
2778
+ // #define ARM_CRC_MUL 100
2779
+ #define ARM_CRC_MUL 1
2780
+
2781
+ #define k_Hash_Complex_Mult 256
2782
+
2783
+ static const CBenchHash g_Hash[] =
2784
+ {
2785
+ { 20, 256, 0x21e207bb, "CRC32:12" } ,
2786
+ { 2, 128 *ARM_CRC_MUL, 0x21e207bb, "CRC32:32" },
2787
+ { 2, 64 *ARM_CRC_MUL, 0x21e207bb, "CRC32:64" },
2788
+ { 10, 256, 0x41b901d1, "CRC64" },
2789
+ { 5, 64, 0x43eac94f, "XXH64" },
2790
+ { 2, 2340, 0x3398a904, "MD5" },
2791
+ { 10, 2340, 0xff769021, "SHA1:1" },
2792
+ { 2, CMPLX((20 * 6 + 1) * 4 + 4), 0xff769021, "SHA1:2" },
2793
+ { 10, 5100, 0x7913ba03, "SHA256:1" },
2794
+ { 2, CMPLX((32 * 4 + 1) * 4 + 4), 0x7913ba03, "SHA256:2" },
2795
+ { 5, 3200, 0xe7aeb394, "SHA512:1" },
2796
+ { 2, CMPLX((40 * 4 + 1) * 4 + 4), 0xe7aeb394, "SHA512:2" },
2797
+ // { 10, 3428, 0x1cc99b18, "SHAKE128" },
2798
+ // { 10, 4235, 0x74eaddc3, "SHAKE256" },
2799
+ // { 10, 4000, 0xdf3e6863, "SHA3-224" },
2800
+ { 5, 4200, 0xcecac10d, "SHA3-256" },
2801
+ // { 10, 5538, 0x4e5d9163, "SHA3-384" },
2802
+ // { 10, 8000, 0x96a58289, "SHA3-512" },
2803
+ { 2, 4096, 0x85189d02, "BLAKE2sp:1" },
2804
+ { 2, 1024, 0x85189d02, "BLAKE2sp:2" }, // sse2-way4-fast
2805
+ { 2, 512, 0x85189d02, "BLAKE2sp:3" } // avx2-way8-fast
2806
+ #if 0
2807
+ , { 2, 2048, 0x85189d02, "BLAKE2sp:4" } // sse2-way1
2808
+ , { 2, 1024, 0x85189d02, "BLAKE2sp:5" } // sse2-way2
2809
+ , { 2, 1024, 0x85189d02, "BLAKE2sp:6" } // avx2-way2
2810
+ , { 2, 1024, 0x85189d02, "BLAKE2sp:7" } // avx2-way4
2811
+ #endif
2812
+ };
2813
+
2814
+ static void PrintNumber(IBenchPrintCallback &f, UInt64 value, unsigned size)
2815
+ {
2816
+ char s[128];
2817
+ unsigned startPos = (unsigned)sizeof(s) - 32;
2818
+ memset(s, ' ', startPos);
2819
+ ConvertUInt64ToString(value, s + startPos);
2820
+ // if (withSpace)
2821
+ {
2822
+ startPos--;
2823
+ size++;
2824
+ }
2825
+ unsigned len = (unsigned)strlen(s + startPos);
2826
+ if (size > len)
2827
+ {
2828
+ size -= len;
2829
+ if (startPos < size)
2830
+ startPos = 0;
2831
+ else
2832
+ startPos -= size;
2833
+ }
2834
+ f.Print(s + startPos);
2835
+ }
2836
+
2837
+ static const unsigned kFieldSize_Name = 12;
2838
+ static const unsigned kFieldSize_SmallName = 4;
2839
+ static const unsigned kFieldSize_Speed = 9;
2840
+ static const unsigned kFieldSize_Usage = 5;
2841
+ static const unsigned kFieldSize_RU = 6;
2842
+ static const unsigned kFieldSize_Rating = 6;
2843
+ static const unsigned kFieldSize_EU = 5;
2844
+ static const unsigned kFieldSize_Effec = 5;
2845
+ static const unsigned kFieldSize_CrcSpeed = 8;
2846
+
2847
+
2848
+ static const unsigned kFieldSize_TotalSize = 4 + kFieldSize_Speed + kFieldSize_Usage + kFieldSize_RU + kFieldSize_Rating;
2849
+ static const unsigned kFieldSize_EUAndEffec = 2 + kFieldSize_EU + kFieldSize_Effec;
2850
+
2851
+
2852
+ static void PrintRating(IBenchPrintCallback &f, UInt64 rating, unsigned size)
2853
+ {
2854
+ PrintNumber(f, (rating + 500000) / 1000000, size);
2855
+ }
2856
+
2857
+
2858
+ static void PrintPercents(IBenchPrintCallback &f, UInt64 val, UInt64 divider, unsigned size)
2859
+ {
2860
+ UInt64 v = 0;
2861
+ if (divider != 0)
2862
+ v = (val * 100 + divider / 2) / divider;
2863
+ PrintNumber(f, v, size);
2864
+ }
2865
+
2866
+ static void PrintChars(IBenchPrintCallback &f, char c, unsigned size)
2867
+ {
2868
+ char s[256];
2869
+ memset(s, (Byte)c, size);
2870
+ s[size] = 0;
2871
+ f.Print(s);
2872
+ }
2873
+
2874
+ static void PrintSpaces(IBenchPrintCallback &f, unsigned size)
2875
+ {
2876
+ PrintChars(f, ' ', size);
2877
+ }
2878
+
2879
+ static void PrintUsage(IBenchPrintCallback &f, UInt64 usage, unsigned size)
2880
+ {
2881
+ PrintNumber(f, Benchmark_GetUsage_Percents(usage), size);
2882
+ }
2883
+
2884
+ static void PrintResults(IBenchPrintCallback &f, UInt64 usage, UInt64 rpu, UInt64 rating, bool showFreq, UInt64 cpuFreq)
2885
+ {
2886
+ PrintUsage(f, usage, kFieldSize_Usage);
2887
+ PrintRating(f, rpu, kFieldSize_RU);
2888
+ PrintRating(f, rating, kFieldSize_Rating);
2889
+ if (showFreq)
2890
+ {
2891
+ if (cpuFreq == 0)
2892
+ PrintSpaces(f, kFieldSize_EUAndEffec);
2893
+ else
2894
+ {
2895
+ PrintPercents(f, rating, cpuFreq * usage / kBenchmarkUsageMult, kFieldSize_EU);
2896
+ PrintPercents(f, rating, cpuFreq, kFieldSize_Effec);
2897
+ }
2898
+ }
2899
+ }
2900
+
2901
+
2902
+ void CTotalBenchRes::Generate_From_BenchInfo(const CBenchInfo &info)
2903
+ {
2904
+ Speed = info.GetUnpackSizeSpeed();
2905
+ Usage = info.GetUsage();
2906
+ RPU = info.GetRatingPerUsage(Rating);
2907
+ }
2908
+
2909
+ void CTotalBenchRes::Mult_For_Weight(unsigned weight)
2910
+ {
2911
+ NumIterations2 *= weight;
2912
+ RPU *= weight;
2913
+ Rating *= weight;
2914
+ Usage *= weight;
2915
+ Speed *= weight;
2916
+ }
2917
+
2918
+ void CTotalBenchRes::Update_With_Res(const CTotalBenchRes &r)
2919
+ {
2920
+ Rating += r.Rating;
2921
+ Usage += r.Usage;
2922
+ RPU += r.RPU;
2923
+ Speed += r.Speed;
2924
+ // NumIterations1 = (r1.NumIterations1 + r2.NumIterations1);
2925
+ NumIterations2 += r.NumIterations2;
2926
+ }
2927
+
2928
+ static void PrintResults(IBenchPrintCallback *f,
2929
+ const CBenchInfo &info,
2930
+ unsigned weight,
2931
+ UInt64 rating,
2932
+ bool showFreq, UInt64 cpuFreq,
2933
+ CTotalBenchRes *res)
2934
+ {
2935
+ CTotalBenchRes t;
2936
+ t.Rating = rating;
2937
+ t.NumIterations2 = 1;
2938
+ t.Generate_From_BenchInfo(info);
2939
+
2940
+ if (f)
2941
+ {
2942
+ if (t.Speed != 0)
2943
+ PrintNumber(*f, t.Speed / 1024, kFieldSize_Speed);
2944
+ else
2945
+ PrintSpaces(*f, 1 + kFieldSize_Speed);
2946
+ }
2947
+ if (f)
2948
+ {
2949
+ PrintResults(*f, t.Usage, t.RPU, rating, showFreq, cpuFreq);
2950
+ }
2951
+
2952
+ if (res)
2953
+ {
2954
+ // res->NumIterations1++;
2955
+ t.Mult_For_Weight(weight);
2956
+ res->Update_With_Res(t);
2957
+ }
2958
+ }
2959
+
2960
+ static void PrintTotals(IBenchPrintCallback &f,
2961
+ bool showFreq, UInt64 cpuFreq, bool showSpeed, const CTotalBenchRes &res)
2962
+ {
2963
+ const UInt64 numIterations2 = res.NumIterations2 ? res.NumIterations2 : 1;
2964
+ const UInt64 speed = res.Speed / numIterations2;
2965
+ if (showSpeed && speed != 0)
2966
+ PrintNumber(f, speed / 1024, kFieldSize_Speed);
2967
+ else
2968
+ PrintSpaces(f, 1 + kFieldSize_Speed);
2969
+
2970
+ // PrintSpaces(f, 1 + kFieldSize_Speed);
2971
+ // UInt64 numIterations1 = res.NumIterations1; if (numIterations1 == 0) numIterations1 = 1;
2972
+ PrintResults(f, res.Usage / numIterations2, res.RPU / numIterations2, res.Rating / numIterations2, showFreq, cpuFreq);
2973
+ }
2974
+
2975
+
2976
+ static void PrintHex(AString &s, UInt64 v)
2977
+ {
2978
+ char temp[32];
2979
+ ConvertUInt64ToHex(v, temp);
2980
+ s += temp;
2981
+ }
2982
+
2983
+ AString GetProcessThreadsInfo(const NSystem::CProcessAffinity &ti)
2984
+ {
2985
+ AString s;
2986
+ // s.Add_UInt32(ti.numProcessThreads);
2987
+ const unsigned numSysThreads = ti.GetNumSystemThreads();
2988
+ if (ti.GetNumProcessThreads() != numSysThreads)
2989
+ {
2990
+ // if (ti.numProcessThreads != ti.numSysThreads)
2991
+ {
2992
+ s += " / ";
2993
+ s.Add_UInt32(numSysThreads);
2994
+ }
2995
+ s += " : ";
2996
+ #ifdef _WIN32
2997
+ PrintHex(s, ti.processAffinityMask);
2998
+ s += " / ";
2999
+ PrintHex(s, ti.systemAffinityMask);
3000
+ #else
3001
+ unsigned i = (numSysThreads + 3) & ~(unsigned)3;
3002
+ if (i == 0)
3003
+ i = 4;
3004
+ for (; i >= 4; )
3005
+ {
3006
+ i -= 4;
3007
+ unsigned val = 0;
3008
+ for (unsigned k = 0; k < 4; k++)
3009
+ {
3010
+ const unsigned bit = (ti.IsCpuSet(i + k) ? 1 : 0);
3011
+ val += (bit << k);
3012
+ }
3013
+ PrintHex(s, val);
3014
+ }
3015
+ #endif
3016
+ }
3017
+ #ifdef _WIN32
3018
+ if (ti.Groups.GroupSizes.Size() > 1 ||
3019
+ (ti.Groups.GroupSizes.Size() == 1
3020
+ && ti.Groups.NumThreadsTotal != numSysThreads))
3021
+ {
3022
+ s += " : ";
3023
+ s.Add_UInt32(ti.Groups.GroupSizes.Size());
3024
+ s += " groups : ";
3025
+ if (ti.Groups.NumThreadsTotal == numSysThreads)
3026
+ {
3027
+ s.Add_UInt32(ti.Groups.NumThreadsTotal);
3028
+ s += " c : ";
3029
+ }
3030
+ UInt32 minSize, maxSize;
3031
+ ti.Groups.Get_GroupSize_Min_Max(minSize, maxSize);
3032
+ if (minSize == maxSize)
3033
+ {
3034
+ s.Add_UInt32(ti.Groups.GroupSizes[0]);
3035
+ s += " c/g";
3036
+ }
3037
+ else
3038
+ FOR_VECTOR (i, ti.Groups.GroupSizes)
3039
+ {
3040
+ if (i != 0)
3041
+ s.Add_Char(' ');
3042
+ s.Add_UInt32(ti.Groups.GroupSizes[i]);
3043
+ }
3044
+ }
3045
+ #endif
3046
+ return s;
3047
+ }
3048
+
3049
+
3050
+ #ifdef Z7_LARGE_PAGES
3051
+
3052
+ #ifdef _WIN32
3053
+ extern bool g_LargePagesMode;
3054
+ extern "C"
3055
+ {
3056
+ extern SIZE_T g_LargePageSize;
3057
+ }
3058
+ #endif
3059
+
3060
+ void Add_LargePages_String(AString &s)
3061
+ {
3062
+ #ifdef _WIN32
3063
+ if (g_LargePagesMode || g_LargePageSize != 0)
3064
+ {
3065
+ s.Add_OptSpaced("(LP-");
3066
+ PrintSize_KMGT_Or_Hex(s, g_LargePageSize);
3067
+ #ifdef MY_CPU_X86_OR_AMD64
3068
+ if (CPU_IsSupported_PageGB())
3069
+ s += "-1G";
3070
+ #endif
3071
+ if (!g_LargePagesMode)
3072
+ s += "-NA";
3073
+ s += ")";
3074
+ }
3075
+ #else
3076
+ s += "";
3077
+ #endif
3078
+ }
3079
+
3080
+ #endif
3081
+
3082
+
3083
+
3084
+ static void PrintRequirements(IBenchPrintCallback &f, const char *sizeString,
3085
+ bool size_Defined, UInt64 size, const char *threadsString, UInt32 numThreads)
3086
+ {
3087
+ f.Print("RAM ");
3088
+ f.Print(sizeString);
3089
+ if (size_Defined)
3090
+ PrintNumber(f, (size >> 20), 6);
3091
+ else
3092
+ f.Print(" ?");
3093
+ f.Print(" MB");
3094
+
3095
+ #ifdef Z7_LARGE_PAGES
3096
+ {
3097
+ AString s;
3098
+ Add_LargePages_String(s);
3099
+ f.Print(s);
3100
+ }
3101
+ #endif
3102
+
3103
+ f.Print(", # ");
3104
+ f.Print(threadsString);
3105
+ PrintNumber(f, numThreads, 3);
3106
+ }
3107
+
3108
+
3109
+
3110
+ struct CBenchCallbackToPrint Z7_final: public IBenchCallback
3111
+ {
3112
+ bool NeedPrint;
3113
+ bool Use2Columns;
3114
+ bool ShowFreq;
3115
+ unsigned NameFieldSize;
3116
+
3117
+ unsigned EncodeWeight;
3118
+ unsigned DecodeWeight;
3119
+
3120
+ UInt64 CpuFreq;
3121
+ UInt64 DictSize;
3122
+
3123
+ IBenchPrintCallback *_file;
3124
+ CBenchProps BenchProps;
3125
+ CTotalBenchRes EncodeRes;
3126
+ CTotalBenchRes DecodeRes;
3127
+
3128
+ CBenchInfo BenchInfo_Results[2];
3129
+
3130
+ CBenchCallbackToPrint():
3131
+ NeedPrint(true),
3132
+ Use2Columns(false),
3133
+ ShowFreq(false),
3134
+ NameFieldSize(0),
3135
+ EncodeWeight(1),
3136
+ DecodeWeight(1),
3137
+ CpuFreq(0)
3138
+ {}
3139
+
3140
+ void Init() { EncodeRes.Init(); DecodeRes.Init(); }
3141
+ void Print(const char *s);
3142
+ void NewLine();
3143
+
3144
+ HRESULT SetFreq(bool showFreq, UInt64 cpuFreq);
3145
+ HRESULT SetEncodeResult(const CBenchInfo &info, bool final) Z7_override;
3146
+ HRESULT SetDecodeResult(const CBenchInfo &info, bool final) Z7_override;
3147
+ };
3148
+
3149
+ HRESULT CBenchCallbackToPrint::SetFreq(bool showFreq, UInt64 cpuFreq)
3150
+ {
3151
+ ShowFreq = showFreq;
3152
+ CpuFreq = cpuFreq;
3153
+ return S_OK;
3154
+ }
3155
+
3156
+ HRESULT CBenchCallbackToPrint::SetEncodeResult(const CBenchInfo &info, bool final)
3157
+ {
3158
+ RINOK(_file->CheckBreak())
3159
+ if (final)
3160
+ BenchInfo_Results[0] = info;
3161
+ if (final)
3162
+ if (NeedPrint)
3163
+ {
3164
+ const UInt64 rating = BenchProps.GetRating_Enc(DictSize, info.GlobalTime, info.GlobalFreq, info.UnpackSize * info.NumIterations);
3165
+ PrintResults(_file, info,
3166
+ EncodeWeight, rating,
3167
+ ShowFreq, CpuFreq, &EncodeRes);
3168
+ if (!Use2Columns)
3169
+ _file->NewLine();
3170
+ }
3171
+ return S_OK;
3172
+ }
3173
+
3174
+ static const char * const kSep = " | ";
3175
+
3176
+ HRESULT CBenchCallbackToPrint::SetDecodeResult(const CBenchInfo &info, bool final)
3177
+ {
3178
+ RINOK(_file->CheckBreak())
3179
+ if (final)
3180
+ BenchInfo_Results[1] = info;
3181
+ if (final)
3182
+ if (NeedPrint)
3183
+ {
3184
+ const UInt64 rating = BenchProps.GetRating_Dec(info.GlobalTime, info.GlobalFreq, info.UnpackSize, info.PackSize, info.NumIterations);
3185
+ if (Use2Columns)
3186
+ _file->Print(kSep);
3187
+ else
3188
+ PrintSpaces(*_file, NameFieldSize);
3189
+ CBenchInfo info2 = info;
3190
+ info2.UnpackSize *= info2.NumIterations;
3191
+ info2.PackSize *= info2.NumIterations;
3192
+ info2.NumIterations = 1;
3193
+ PrintResults(_file, info2,
3194
+ DecodeWeight, rating,
3195
+ ShowFreq, CpuFreq, &DecodeRes);
3196
+ }
3197
+ return S_OK;
3198
+ }
3199
+
3200
+ void CBenchCallbackToPrint::Print(const char *s)
3201
+ {
3202
+ _file->Print(s);
3203
+ }
3204
+
3205
+ void CBenchCallbackToPrint::NewLine()
3206
+ {
3207
+ _file->NewLine();
3208
+ }
3209
+
3210
+ static void PrintLeft(IBenchPrintCallback &f, const char *s, unsigned size)
3211
+ {
3212
+ f.Print(s);
3213
+ int numSpaces = (int)size - (int)MyStringLen(s);
3214
+ if (numSpaces > 0)
3215
+ PrintSpaces(f, (unsigned)numSpaces);
3216
+ }
3217
+
3218
+ static void PrintRight(IBenchPrintCallback &f, const char *s, unsigned size)
3219
+ {
3220
+ int numSpaces = (int)size - (int)MyStringLen(s);
3221
+ if (numSpaces > 0)
3222
+ PrintSpaces(f, (unsigned)numSpaces);
3223
+ f.Print(s);
3224
+ }
3225
+
3226
+
3227
+ static bool DoesWildcardMatchName_NoCase(const AString &mask, const char *name)
3228
+ {
3229
+ UString wildc = GetUnicodeString(mask);
3230
+ UString bname = GetUnicodeString(name);
3231
+ wildc.MakeLower_Ascii();
3232
+ bname.MakeLower_Ascii();
3233
+ return DoesWildcardMatchName(wildc, bname);
3234
+ }
3235
+
3236
+
3237
+ static HRESULT TotalBench(
3238
+ DECL_EXTERNAL_CODECS_LOC_VARS
3239
+ const COneMethodInfo &methodMask,
3240
+ UInt64 complexInCommands,
3241
+ #ifndef Z7_ST
3242
+ UInt32 numThreads,
3243
+ const CAffinityMode *affinityMode,
3244
+ #endif
3245
+ bool forceUnpackSize,
3246
+ size_t unpackSize,
3247
+ const Byte *fileData,
3248
+ IBenchPrintCallback *printCallback, CBenchCallbackToPrint *callback)
3249
+ {
3250
+ for (unsigned i = 0; i < Z7_ARRAY_SIZE(g_Bench); i++)
3251
+ {
3252
+ const CBenchMethod &bench = g_Bench[i];
3253
+ if (!DoesWildcardMatchName_NoCase(methodMask.MethodName, bench.Name))
3254
+ continue;
3255
+ PrintLeft(*callback->_file, bench.Name, kFieldSize_Name);
3256
+ {
3257
+ unsigned keySize = 32;
3258
+ if (IsString1PrefixedByString2(bench.Name, "AES128")) keySize = 16;
3259
+ else if (IsString1PrefixedByString2(bench.Name, "AES192")) keySize = 24;
3260
+ callback->BenchProps.KeySize = keySize;
3261
+ }
3262
+ callback->BenchProps.DecComplexUnc = bench.DecComplexUnc;
3263
+ callback->BenchProps.DecComplexCompr = bench.DecComplexCompr;
3264
+ callback->BenchProps.EncComplex = bench.EncComplex;
3265
+
3266
+ COneMethodInfo method;
3267
+ NCOM::CPropVariant propVariant;
3268
+ propVariant = bench.Name;
3269
+ RINOK(method.ParseMethodFromPROPVARIANT(UString(), propVariant))
3270
+
3271
+ size_t unpackSize2 = unpackSize;
3272
+ if (!forceUnpackSize && bench.DictBits == 0)
3273
+ unpackSize2 = kFilterUnpackSize;
3274
+
3275
+ callback->EncodeWeight = bench.Weight;
3276
+ callback->DecodeWeight = bench.Weight;
3277
+
3278
+ const HRESULT res = MethodBench(
3279
+ EXTERNAL_CODECS_LOC_VARS
3280
+ complexInCommands,
3281
+ #ifndef Z7_ST
3282
+ false, numThreads, affinityMode,
3283
+ #endif
3284
+ method,
3285
+ unpackSize2, fileData,
3286
+ bench.DictBits,
3287
+ printCallback, callback, &callback->BenchProps);
3288
+
3289
+ if (res == E_NOTIMPL)
3290
+ {
3291
+ // callback->Print(" ---");
3292
+ // we need additional empty line as line for decompression results
3293
+ if (!callback->Use2Columns)
3294
+ callback->NewLine();
3295
+ }
3296
+ else
3297
+ {
3298
+ RINOK(res)
3299
+ }
3300
+
3301
+ callback->NewLine();
3302
+ }
3303
+ return S_OK;
3304
+ }
3305
+
3306
+
3307
+ struct CFreqBench
3308
+ {
3309
+ // in:
3310
+ UInt64 complexInCommands;
3311
+ UInt32 numThreads;
3312
+ bool showFreq;
3313
+ UInt64 specifiedFreq;
3314
+
3315
+ // out:
3316
+ UInt64 CpuFreqRes;
3317
+ UInt64 UsageRes;
3318
+ UInt32 res;
3319
+
3320
+ CFreqBench()
3321
+ {}
3322
+
3323
+ HRESULT FreqBench(IBenchPrintCallback *_file
3324
+ #ifndef Z7_ST
3325
+ , const CAffinityMode *affinityMode
3326
+ #endif
3327
+ );
3328
+ };
3329
+
3330
+
3331
+ HRESULT CFreqBench::FreqBench(IBenchPrintCallback *_file
3332
+ #ifndef Z7_ST
3333
+ , const CAffinityMode *affinityMode
3334
+ #endif
3335
+ )
3336
+ {
3337
+ res = 0;
3338
+ CpuFreqRes = 0;
3339
+ UsageRes = 0;
3340
+
3341
+ if (numThreads == 0)
3342
+ numThreads = 1;
3343
+
3344
+ #ifdef Z7_ST
3345
+ numThreads = 1;
3346
+ #endif
3347
+
3348
+ const UInt32 complexity = kNumFreqCommands;
3349
+ UInt64 numIterations = complexInCommands / complexity;
3350
+ UInt32 numIterations2 = 1 << 30;
3351
+ if (numIterations > numIterations2)
3352
+ numIterations /= numIterations2;
3353
+ else
3354
+ {
3355
+ numIterations2 = (UInt32)numIterations;
3356
+ numIterations = 1;
3357
+ }
3358
+
3359
+ CBenchInfoCalc progressInfoSpec;
3360
+
3361
+ #ifndef Z7_ST
3362
+
3363
+ bool mtMode = (numThreads > 1) || affinityMode->NeedAffinity();
3364
+
3365
+ if (mtMode)
3366
+ {
3367
+ CFreqThreads threads;
3368
+ threads.Items = new CFreqInfo[numThreads];
3369
+ UInt32 i;
3370
+ for (i = 0; i < numThreads; i++)
3371
+ {
3372
+ CFreqInfo &info = threads.Items[i];
3373
+ info.Callback = _file;
3374
+ info.CallbackRes = S_OK;
3375
+ info.NumIterations = numIterations;
3376
+ info.Size = numIterations2;
3377
+ }
3378
+ progressInfoSpec.SetStartTime();
3379
+ for (i = 0; i < numThreads; i++)
3380
+ {
3381
+ // Sleep(10);
3382
+ CFreqInfo &info = threads.Items[i];
3383
+ WRes wres = affinityMode->CreateThread_WithAffinity(info.Thread, FreqThreadFunction, &info, i);
3384
+ if (info.Thread.IsCreated())
3385
+ threads.NumThreads++;
3386
+ if (wres != 0)
3387
+ return HRESULT_FROM_WIN32(wres);
3388
+ }
3389
+ WRes wres = threads.WaitAll();
3390
+ if (wres != 0)
3391
+ return HRESULT_FROM_WIN32(wres);
3392
+ for (i = 0; i < numThreads; i++)
3393
+ {
3394
+ RINOK(threads.Items[i].CallbackRes)
3395
+ }
3396
+ }
3397
+ else
3398
+ #endif
3399
+ {
3400
+ progressInfoSpec.SetStartTime();
3401
+ UInt32 sum = g_BenchCpuFreqTemp;
3402
+ UInt64 k = numIterations;
3403
+ do
3404
+ {
3405
+ sum = CountCpuFreq(sum, numIterations2, g_BenchCpuFreqTemp);
3406
+ if (_file)
3407
+ {
3408
+ RINOK(_file->CheckBreak())
3409
+ }
3410
+ }
3411
+ while (--k);
3412
+ res += sum;
3413
+ }
3414
+
3415
+ if (res == 0x12345678)
3416
+ if (_file)
3417
+ {
3418
+ RINOK(_file->CheckBreak())
3419
+ }
3420
+
3421
+ CBenchInfo info;
3422
+ progressInfoSpec.SetFinishTime(info);
3423
+
3424
+ info.UnpackSize = 0;
3425
+ info.PackSize = 0;
3426
+ info.NumIterations = 1;
3427
+
3428
+ const UInt64 numCommands = (UInt64)numIterations * numIterations2 * numThreads * complexity;
3429
+ const UInt64 rating = info.GetSpeed(numCommands);
3430
+ CpuFreqRes = rating / numThreads;
3431
+ UsageRes = info.GetUsage();
3432
+
3433
+ if (_file)
3434
+ {
3435
+ PrintResults(_file, info,
3436
+ 0, // weight
3437
+ rating,
3438
+ showFreq, showFreq ? (specifiedFreq != 0 ? specifiedFreq : CpuFreqRes) : 0, NULL);
3439
+ RINOK(_file->CheckBreak())
3440
+ }
3441
+
3442
+ return S_OK;
3443
+ }
3444
+
3445
+
3446
+
3447
+ static HRESULT CrcBench(
3448
+ DECL_EXTERNAL_CODECS_LOC_VARS
3449
+ UInt64 complexInCommands,
3450
+ UInt32 numThreads,
3451
+ const size_t bufferSize,
3452
+ const Byte *fileData,
3453
+
3454
+ UInt64 &speed,
3455
+ UInt64 &usage,
3456
+
3457
+ UInt32 complexity, unsigned benchWeight,
3458
+ const UInt32 *checkSum,
3459
+ const COneMethodInfo &method,
3460
+ IBenchPrintCallback *_file,
3461
+ #ifndef Z7_ST
3462
+ const CAffinityMode *affinityMode,
3463
+ #endif
3464
+ bool showRating,
3465
+ CTotalBenchRes *encodeRes,
3466
+ bool showFreq, UInt64 cpuFreq)
3467
+ {
3468
+ if (numThreads == 0)
3469
+ numThreads = 1;
3470
+
3471
+ #ifdef Z7_ST
3472
+ numThreads = 1;
3473
+ #endif
3474
+
3475
+ const AString &methodName = method.MethodName;
3476
+ // methodName.RemoveChar(L'-');
3477
+ CMethodId hashID;
3478
+ if (!FindHashMethod(
3479
+ EXTERNAL_CODECS_LOC_VARS
3480
+ methodName, hashID))
3481
+ return E_NOTIMPL;
3482
+
3483
+ /*
3484
+ // if will generate random data in each thread, instead of global data
3485
+ CMidAlignedBuffer buffer;
3486
+ if (!fileData)
3487
+ {
3488
+ ALLOC_WITH_HRESULT(&buffer, bufferSize)
3489
+ RandGen(buffer, bufferSize);
3490
+ fileData = buffer;
3491
+ }
3492
+ */
3493
+
3494
+ const size_t bsize = (bufferSize == 0 ? 1 : bufferSize);
3495
+ UInt64 numIterations = complexInCommands * k_Hash_Complex_Mult / complexity / bsize;
3496
+ if (numIterations == 0)
3497
+ numIterations = 1;
3498
+
3499
+ CBenchInfoCalc progressInfoSpec;
3500
+ CBenchInfo info;
3501
+
3502
+ #ifndef Z7_ST
3503
+ bool mtEncMode = (numThreads > 1) || affinityMode->NeedAffinity();
3504
+
3505
+ if (mtEncMode)
3506
+ {
3507
+ CCrcThreads threads;
3508
+ threads.Items = new CCrcInfo[numThreads];
3509
+ {
3510
+ WRes wres = threads.Common.StartEvent.Create();
3511
+ if (wres != 0)
3512
+ return HRESULT_FROM_WIN32(wres);
3513
+ threads.NeedClose = true;
3514
+ }
3515
+
3516
+ UInt32 i;
3517
+ for (i = 0; i < numThreads; i++)
3518
+ {
3519
+ CCrcInfo &ci = threads.Items[i];
3520
+ AString name;
3521
+ RINOK(CreateHasher(EXTERNAL_CODECS_LOC_VARS hashID, name, ci.Hasher))
3522
+ if (!ci.Hasher)
3523
+ return E_NOTIMPL;
3524
+ CMyComPtr<ICompressSetCoderProperties> scp;
3525
+ ci.Hasher.QueryInterface(IID_ICompressSetCoderProperties, &scp);
3526
+ if (scp)
3527
+ {
3528
+ RINOK(method.SetCoderProps(scp))
3529
+ }
3530
+
3531
+ ci.Callback = _file;
3532
+ ci.Data = fileData;
3533
+ ci.NumIterations = numIterations;
3534
+ ci.Size = bufferSize;
3535
+ ci.CheckSumDefined = false;
3536
+ if (checkSum)
3537
+ {
3538
+ ci.CheckSum = *checkSum;
3539
+ ci.CheckSumDefined = true;
3540
+ }
3541
+
3542
+ #ifdef USE_ALLOCA
3543
+ ci.AllocaSize = BENCH_ALLOCA_VALUE(i);
3544
+ #endif
3545
+ }
3546
+
3547
+ for (i = 0; i < numThreads; i++)
3548
+ {
3549
+ CCrcInfo &ci = threads.Items[i];
3550
+ ci.ThreadIndex = i;
3551
+ ci.Common = &threads.Common;
3552
+ ci.AffinityMode = *affinityMode;
3553
+ HRESULT hres = ci.CreateThread();
3554
+ if (ci.Thread.IsCreated())
3555
+ threads.NumThreads++;
3556
+ if (hres != 0)
3557
+ return hres;
3558
+ }
3559
+
3560
+ for (i = 0; i < numThreads; i++)
3561
+ {
3562
+ CCrcInfo &ci = threads.Items[i];
3563
+ WRes wres = ci.ReadyEvent.Lock();
3564
+ if (wres != 0)
3565
+ return HRESULT_FROM_WIN32(wres);
3566
+ RINOK(ci.Res)
3567
+ }
3568
+
3569
+ progressInfoSpec.SetStartTime();
3570
+
3571
+ WRes wres = threads.StartAndWait();
3572
+ if (wres != 0)
3573
+ return HRESULT_FROM_WIN32(wres);
3574
+
3575
+ progressInfoSpec.SetFinishTime(info);
3576
+
3577
+ for (i = 0; i < numThreads; i++)
3578
+ {
3579
+ RINOK(threads.Items[i].Res)
3580
+ if (i != 0)
3581
+ if (threads.Items[i].CheckSum_Res !=
3582
+ threads.Items[i - 1].CheckSum_Res)
3583
+ return S_FALSE;
3584
+ }
3585
+ }
3586
+ else
3587
+ #endif
3588
+ {
3589
+ CMyComPtr<IHasher> hasher;
3590
+ AString name;
3591
+ RINOK(CreateHasher(EXTERNAL_CODECS_LOC_VARS hashID, name, hasher))
3592
+ if (!hasher)
3593
+ return E_NOTIMPL;
3594
+ CMyComPtr<ICompressSetCoderProperties> scp;
3595
+ hasher.QueryInterface(IID_ICompressSetCoderProperties, &scp);
3596
+ if (scp)
3597
+ {
3598
+ RINOK(method.SetCoderProps(scp))
3599
+ }
3600
+ CCrcInfo_Base crcib;
3601
+ crcib.CreateLocalBuf = false;
3602
+ RINOK(crcib.Generate(fileData, bufferSize))
3603
+ progressInfoSpec.SetStartTime();
3604
+ RINOK(crcib.CrcProcess(numIterations, checkSum, hasher, _file))
3605
+ progressInfoSpec.SetFinishTime(info);
3606
+ }
3607
+
3608
+
3609
+ UInt64 unpSize = numIterations * bufferSize;
3610
+ UInt64 unpSizeThreads = unpSize * numThreads;
3611
+ info.UnpackSize = unpSizeThreads;
3612
+ info.PackSize = unpSizeThreads;
3613
+ info.NumIterations = 1;
3614
+
3615
+ if (_file)
3616
+ {
3617
+ if (showRating)
3618
+ {
3619
+ UInt64 unpSizeThreads2 = unpSizeThreads;
3620
+ if (unpSizeThreads2 == 0)
3621
+ unpSizeThreads2 = numIterations * 1 * numThreads;
3622
+ const UInt64 numCommands = unpSizeThreads2 * complexity / 256;
3623
+ const UInt64 rating = info.GetSpeed(numCommands);
3624
+ PrintResults(_file, info,
3625
+ benchWeight, rating,
3626
+ showFreq, cpuFreq, encodeRes);
3627
+ }
3628
+ RINOK(_file->CheckBreak())
3629
+ }
3630
+
3631
+ speed = info.GetSpeed(unpSizeThreads);
3632
+ usage = info.GetUsage();
3633
+
3634
+ return S_OK;
3635
+ }
3636
+
3637
+
3638
+
3639
+ static HRESULT TotalBench_Hash(
3640
+ DECL_EXTERNAL_CODECS_LOC_VARS
3641
+ const COneMethodInfo &methodMask,
3642
+ UInt64 complexInCommands,
3643
+ UInt32 numThreads,
3644
+ size_t bufSize,
3645
+ const Byte *fileData,
3646
+ IBenchPrintCallback *printCallback, CBenchCallbackToPrint *callback,
3647
+ #ifndef Z7_ST
3648
+ const CAffinityMode *affinityMode,
3649
+ #endif
3650
+ CTotalBenchRes *encodeRes,
3651
+ bool showFreq, UInt64 cpuFreq)
3652
+ {
3653
+ for (unsigned i = 0; i < Z7_ARRAY_SIZE(g_Hash); i++)
3654
+ {
3655
+ const CBenchHash &bench = g_Hash[i];
3656
+ if (!DoesWildcardMatchName_NoCase(methodMask.MethodName, bench.Name))
3657
+ continue;
3658
+ PrintLeft(*callback->_file, bench.Name, kFieldSize_Name);
3659
+ // callback->BenchProps.DecComplexUnc = bench.DecComplexUnc;
3660
+ // callback->BenchProps.DecComplexCompr = bench.DecComplexCompr;
3661
+ // callback->BenchProps.EncComplex = bench.EncComplex;
3662
+
3663
+ COneMethodInfo method;
3664
+ NCOM::CPropVariant propVariant;
3665
+ propVariant = bench.Name;
3666
+ RINOK(method.ParseMethodFromPROPVARIANT(UString(), propVariant))
3667
+
3668
+ UInt64 speed, usage;
3669
+
3670
+ const HRESULT res = CrcBench(
3671
+ EXTERNAL_CODECS_LOC_VARS
3672
+ complexInCommands,
3673
+ numThreads, bufSize, fileData,
3674
+ speed, usage,
3675
+ bench.Complex, bench.Weight,
3676
+ (!fileData && bufSize == (1 << kNumHashDictBits)) ? &bench.CheckSum : NULL,
3677
+ method,
3678
+ printCallback,
3679
+ #ifndef Z7_ST
3680
+ affinityMode,
3681
+ #endif
3682
+ true, // showRating
3683
+ encodeRes, showFreq, cpuFreq);
3684
+ if (res == E_NOTIMPL)
3685
+ {
3686
+ // callback->Print(" ---");
3687
+ }
3688
+ else
3689
+ {
3690
+ RINOK(res)
3691
+ }
3692
+ callback->NewLine();
3693
+ }
3694
+ return S_OK;
3695
+ }
3696
+
3697
+ struct CTempValues
3698
+ {
3699
+ UInt64 *Values;
3700
+ CTempValues(): Values(NULL) {}
3701
+ void Alloc(UInt32 num) { Values = new UInt64[num]; }
3702
+ ~CTempValues() { delete []Values; }
3703
+ };
3704
+
3705
+ static void ParseNumberString(const UString &s, NCOM::CPropVariant &prop)
3706
+ {
3707
+ const wchar_t *end;
3708
+ UInt64 result = ConvertStringToUInt64(s, &end);
3709
+ if (*end != 0 || s.IsEmpty())
3710
+ prop = s;
3711
+ else if (result <= (UInt32)0xFFFFFFFF)
3712
+ prop = (UInt32)result;
3713
+ else
3714
+ prop = result;
3715
+ }
3716
+
3717
+
3718
+ static bool AreSameMethodNames(const char *fullName, const char *shortName)
3719
+ {
3720
+ return StringsAreEqualNoCase_Ascii(fullName, shortName);
3721
+ }
3722
+
3723
+
3724
+
3725
+
3726
+ static void Print_Usage_and_Threads(IBenchPrintCallback &f, UInt64 usage, UInt32 threads)
3727
+ {
3728
+ PrintRequirements(f, "usage:", true, usage, "Benchmark threads: ", threads);
3729
+ }
3730
+
3731
+
3732
+ static void Print_Delimiter(IBenchPrintCallback &f)
3733
+ {
3734
+ f.Print(" |");
3735
+ }
3736
+
3737
+ static void Print_Pow(IBenchPrintCallback &f, unsigned pow)
3738
+ {
3739
+ char s[16];
3740
+ ConvertUInt32ToString(pow, s);
3741
+ unsigned pos = MyStringLen(s);
3742
+ s[pos++] = ':';
3743
+ s[pos] = 0;
3744
+ PrintLeft(f, s, kFieldSize_SmallName); // 4
3745
+ }
3746
+
3747
+ static void Bench_BW_Print_Usage_Speed(IBenchPrintCallback &f,
3748
+ UInt64 usage, UInt64 speed)
3749
+ {
3750
+ PrintUsage(f, usage, kFieldSize_Usage);
3751
+ PrintNumber(f, speed / 1000000, kFieldSize_CrcSpeed);
3752
+ }
3753
+
3754
+
3755
+ HRESULT Bench(
3756
+ DECL_EXTERNAL_CODECS_LOC_VARS
3757
+ IBenchPrintCallback *printCallback,
3758
+ IBenchCallback *benchCallback,
3759
+ const CObjectVector<CProperty> &props,
3760
+ UInt32 numIterations,
3761
+ bool multiDict,
3762
+ IBenchFreqCallback *freqCallback)
3763
+ {
3764
+ // for (int y = 0; y < 10000; y++)
3765
+ if (!CrcInternalTest())
3766
+ return E_FAIL;
3767
+
3768
+ UInt32 numCPUs = 1;
3769
+ size_t ramSize = (size_t)sizeof(size_t) << 29;
3770
+
3771
+ NSystem::CProcessAffinity threadsInfo;
3772
+ threadsInfo.InitST();
3773
+
3774
+ #ifndef Z7_ST
3775
+
3776
+ if (threadsInfo.Get() && threadsInfo.GetNumProcessThreads() != 0)
3777
+ numCPUs = threadsInfo.GetNumProcessThreads();
3778
+ else
3779
+ numCPUs = NSystem::GetNumberOfProcessors();
3780
+
3781
+ #endif
3782
+
3783
+ // numCPUs = 24;
3784
+ /*
3785
+ {
3786
+ DWORD_PTR mask = (1 << 0);
3787
+ DWORD_PTR old = SetThreadAffinityMask(GetCurrentThread(), mask);
3788
+ old = old;
3789
+ DWORD_PTR old2 = SetThreadAffinityMask(GetCurrentThread(), mask);
3790
+ old2 = old2;
3791
+ return 0;
3792
+ }
3793
+ */
3794
+
3795
+ const bool ramSize_Defined = NSystem::GetRamSize(ramSize);
3796
+
3797
+ UInt32 numThreadsSpecified = numCPUs;
3798
+ bool needSetComplexity = false;
3799
+ UInt32 testTimeMs = kComplexInMs;
3800
+ UInt32 startDicLog = 22;
3801
+ bool startDicLog_Defined = false;
3802
+ UInt64 specifiedFreq = 0;
3803
+ bool multiThreadTests = false;
3804
+ UInt64 complexInCommands = kComplexInCommands;
3805
+ UInt32 numThreads_Start = 1;
3806
+
3807
+ #ifndef Z7_ST
3808
+ CAffinityMode affinityMode;
3809
+ #ifdef _WIN32
3810
+ if (threadsInfo.IsGroupMode && threadsInfo.Groups.GroupSizes.Size() > 1)
3811
+ affinityMode.NumGroups = threadsInfo.Groups.GroupSizes.Size();
3812
+ #endif
3813
+ #endif
3814
+
3815
+
3816
+ COneMethodInfo method;
3817
+
3818
+ CMidAlignedBuffer fileDataBuffer;
3819
+ bool use_fileData = false;
3820
+ bool isFixedDict = false;
3821
+
3822
+ {
3823
+ unsigned i;
3824
+
3825
+ if (printCallback)
3826
+ {
3827
+ for (i = 0; i < props.Size(); i++)
3828
+ {
3829
+ const CProperty &property = props[i];
3830
+ printCallback->Print(" ");
3831
+ printCallback->Print(GetAnsiString(property.Name));
3832
+ if (!property.Value.IsEmpty())
3833
+ {
3834
+ printCallback->Print("=");
3835
+ printCallback->Print(GetAnsiString(property.Value));
3836
+ }
3837
+ }
3838
+ if (!props.IsEmpty())
3839
+ printCallback->NewLine();
3840
+ }
3841
+
3842
+
3843
+ for (i = 0; i < props.Size(); i++)
3844
+ {
3845
+ const CProperty &property = props[i];
3846
+ UString name (property.Name);
3847
+ name.MakeLower_Ascii();
3848
+
3849
+ if (name.IsEqualTo("file"))
3850
+ {
3851
+ if (property.Value.IsEmpty())
3852
+ return E_INVALIDARG;
3853
+
3854
+ NFile::NIO::CInFile file;
3855
+ if (!file.Open(us2fs(property.Value)))
3856
+ return GetLastError_noZero_HRESULT();
3857
+ size_t len;
3858
+ {
3859
+ UInt64 len64;
3860
+ if (!file.GetLength(len64))
3861
+ return GetLastError_noZero_HRESULT();
3862
+ if (printCallback)
3863
+ {
3864
+ printCallback->Print("file size =");
3865
+ PrintNumber(*printCallback, len64, 0);
3866
+ printCallback->NewLine();
3867
+ }
3868
+ len = (size_t)len64;
3869
+ if (len != len64)
3870
+ return E_INVALIDARG;
3871
+ }
3872
+
3873
+ // (len == 0) is allowed. Also it's allowed if Alloc(0) returns NULL here
3874
+
3875
+ ALLOC_WITH_HRESULT(&fileDataBuffer, len)
3876
+ use_fileData = true;
3877
+
3878
+ {
3879
+ size_t processed;
3880
+ if (!file.ReadFull((Byte *)fileDataBuffer, len, processed))
3881
+ return GetLastError_noZero_HRESULT();
3882
+ if (processed != len)
3883
+ return E_FAIL;
3884
+ }
3885
+ continue;
3886
+ }
3887
+
3888
+ NCOM::CPropVariant propVariant;
3889
+ if (!property.Value.IsEmpty())
3890
+ ParseNumberString(property.Value, propVariant);
3891
+
3892
+ if (name.IsEqualTo("time"))
3893
+ {
3894
+ RINOK(ParsePropToUInt32(UString(), propVariant, testTimeMs))
3895
+ needSetComplexity = true;
3896
+ testTimeMs *= 1000;
3897
+ continue;
3898
+ }
3899
+
3900
+ if (name.IsEqualTo("timems"))
3901
+ {
3902
+ RINOK(ParsePropToUInt32(UString(), propVariant, testTimeMs))
3903
+ needSetComplexity = true;
3904
+ continue;
3905
+ }
3906
+
3907
+ if (name.IsEqualTo("tic"))
3908
+ {
3909
+ UInt32 v;
3910
+ RINOK(ParsePropToUInt32(UString(), propVariant, v))
3911
+ if (v >= 64)
3912
+ return E_INVALIDARG;
3913
+ complexInCommands = (UInt64)1 << v;
3914
+ continue;
3915
+ }
3916
+
3917
+ const bool isCurrent_fixedDict = name.IsEqualTo("df");
3918
+ if (isCurrent_fixedDict)
3919
+ isFixedDict = true;
3920
+ if (isCurrent_fixedDict || name.IsEqualTo("ds"))
3921
+ {
3922
+ RINOK(ParsePropToUInt32(UString(), propVariant, startDicLog))
3923
+ if (startDicLog > 32)
3924
+ return E_INVALIDARG;
3925
+ startDicLog_Defined = true;
3926
+ continue;
3927
+ }
3928
+
3929
+ if (name.IsEqualTo("mts"))
3930
+ {
3931
+ RINOK(ParsePropToUInt32(UString(), propVariant, numThreads_Start))
3932
+ continue;
3933
+ }
3934
+
3935
+ if (name.IsEqualTo("af"))
3936
+ {
3937
+ UInt32 bundle;
3938
+ RINOK(ParsePropToUInt32(UString(), propVariant, bundle))
3939
+ if (bundle > 0 && bundle < numCPUs)
3940
+ {
3941
+ #ifndef Z7_ST
3942
+ affinityMode.SetLevels(numCPUs, 2);
3943
+ affinityMode.NumBundleThreads = bundle;
3944
+ #endif
3945
+ }
3946
+ continue;
3947
+ }
3948
+
3949
+ if (name.IsEqualTo("freq"))
3950
+ {
3951
+ UInt32 freq32 = 0;
3952
+ RINOK(ParsePropToUInt32(UString(), propVariant, freq32))
3953
+ if (freq32 == 0)
3954
+ return E_INVALIDARG;
3955
+ specifiedFreq = (UInt64)freq32 * 1000000;
3956
+
3957
+ if (printCallback)
3958
+ {
3959
+ printCallback->Print("freq=");
3960
+ PrintNumber(*printCallback, freq32, 0);
3961
+ printCallback->NewLine();
3962
+ }
3963
+
3964
+ continue;
3965
+ }
3966
+
3967
+ if (name.IsPrefixedBy_Ascii_NoCase("mt"))
3968
+ {
3969
+ const UString s = name.Ptr(2);
3970
+ if (s.IsEqualTo("*")
3971
+ || (s.IsEmpty()
3972
+ && propVariant.vt == VT_BSTR
3973
+ && StringsAreEqual_Ascii(propVariant.bstrVal, "*")))
3974
+ {
3975
+ multiThreadTests = true;
3976
+ continue;
3977
+ }
3978
+ #ifndef Z7_ST
3979
+ RINOK(ParseMtProp(s, propVariant, numCPUs, numThreadsSpecified))
3980
+ #endif
3981
+ continue;
3982
+ }
3983
+
3984
+ RINOK(method.ParseMethodFromPROPVARIANT(name, propVariant))
3985
+ }
3986
+ }
3987
+
3988
+ if (printCallback)
3989
+ {
3990
+ AString s;
3991
+
3992
+ #if 1 || !defined(Z7_MSC_VER_ORIGINAL) || (Z7_MSC_VER_ORIGINAL >= 1900)
3993
+ s += "Compiler: ";
3994
+ GetCompiler(s);
3995
+ printCallback->Print(s);
3996
+ printCallback->NewLine();
3997
+ s.Empty();
3998
+ #endif
3999
+
4000
+ GetSystemInfoText(s);
4001
+ printCallback->Print(s);
4002
+ printCallback->NewLine();
4003
+ }
4004
+
4005
+ if (printCallback)
4006
+ {
4007
+ printCallback->Print("1T CPU Freq (MHz):");
4008
+ }
4009
+
4010
+ if (printCallback || freqCallback)
4011
+ {
4012
+ UInt64 numMilCommands = 1 << 6;
4013
+ if (specifiedFreq != 0)
4014
+ {
4015
+ while (numMilCommands > 1 && specifiedFreq < (numMilCommands * 1000000))
4016
+ numMilCommands >>= 1;
4017
+ }
4018
+
4019
+ for (int jj = 0;; jj++)
4020
+ {
4021
+ if (printCallback)
4022
+ RINOK(printCallback->CheckBreak())
4023
+
4024
+ UInt64 start = ::GetTimeCount();
4025
+ UInt32 sum = (UInt32)start;
4026
+ sum = CountCpuFreq(sum, (UInt32)(numMilCommands * 1000000 / kNumFreqCommands), g_BenchCpuFreqTemp);
4027
+ if (sum == 0xF1541213)
4028
+ if (printCallback)
4029
+ printCallback->Print("");
4030
+ const UInt64 realDelta = ::GetTimeCount() - start;
4031
+ start = realDelta;
4032
+ if (start == 0)
4033
+ start = 1;
4034
+ if (start > (UInt64)1 << 61)
4035
+ start = 1;
4036
+ const UInt64 freq = GetFreq();
4037
+ // mips is constant in some compilers
4038
+ const UInt64 hzVal = MyMultDiv64(numMilCommands * 1000000, freq, start);
4039
+ const UInt64 mipsVal = numMilCommands * freq / start;
4040
+ if (printCallback)
4041
+ {
4042
+ if (realDelta == 0)
4043
+ {
4044
+ printCallback->Print(" -");
4045
+ }
4046
+ else
4047
+ {
4048
+ // PrintNumber(*printCallback, start, 0);
4049
+ PrintNumber(*printCallback, mipsVal, 5);
4050
+ }
4051
+ }
4052
+ if (freqCallback)
4053
+ {
4054
+ RINOK(freqCallback->AddCpuFreq(1, hzVal, kBenchmarkUsageMult))
4055
+ }
4056
+
4057
+ if (jj >= 1)
4058
+ {
4059
+ bool needStop = (numMilCommands >= (1 <<
4060
+ #ifdef _DEBUG
4061
+ 7
4062
+ #else
4063
+ 11
4064
+ #endif
4065
+ ));
4066
+ if (start >= freq * 16)
4067
+ {
4068
+ printCallback->Print(" (Cmplx)");
4069
+ if (!freqCallback) // we don't want complexity change for old gui lzma benchmark
4070
+ {
4071
+ needSetComplexity = true;
4072
+ }
4073
+ needStop = true;
4074
+ }
4075
+ if (needSetComplexity)
4076
+ SetComplexCommandsMs(testTimeMs, false, mipsVal * 1000000, complexInCommands);
4077
+ if (needStop)
4078
+ break;
4079
+ numMilCommands <<= 1;
4080
+ }
4081
+ }
4082
+ if (freqCallback)
4083
+ {
4084
+ RINOK(freqCallback->FreqsFinished(1))
4085
+ }
4086
+ }
4087
+
4088
+ if (printCallback || freqCallback)
4089
+ for (unsigned test = 0; test < 3; test++)
4090
+ {
4091
+ if (numThreadsSpecified < 2)
4092
+ {
4093
+ // if (test == 1)
4094
+ break;
4095
+ }
4096
+ if (test == 2 && numThreadsSpecified <= numCPUs)
4097
+ break;
4098
+ if (printCallback)
4099
+ printCallback->NewLine();
4100
+
4101
+ /* it can show incorrect frequency for HT threads. */
4102
+
4103
+ UInt32 numThreads = numThreadsSpecified;
4104
+ if (test < 2)
4105
+ {
4106
+ if (numThreads >= numCPUs)
4107
+ numThreads = numCPUs;
4108
+ if (test == 0)
4109
+ numThreads /= 2;
4110
+ }
4111
+ if (numThreads < 1)
4112
+ numThreads = 1;
4113
+
4114
+ if (printCallback)
4115
+ {
4116
+ char s[128];
4117
+ ConvertUInt64ToString(numThreads, s);
4118
+ printCallback->Print(s);
4119
+ printCallback->Print("T CPU Freq (MHz):");
4120
+ }
4121
+ UInt64 numMilCommands = 1 <<
4122
+ #ifdef _DEBUG
4123
+ 7;
4124
+ #else
4125
+ 10;
4126
+ #endif
4127
+
4128
+ if (specifiedFreq != 0)
4129
+ {
4130
+ while (numMilCommands > 1 && specifiedFreq < (numMilCommands * 1000000))
4131
+ numMilCommands >>= 1;
4132
+ }
4133
+
4134
+ // for (int jj = 0;; jj++)
4135
+ for (;;)
4136
+ {
4137
+ if (printCallback)
4138
+ RINOK(printCallback->CheckBreak())
4139
+
4140
+ {
4141
+ // PrintLeft(f, "CPU", kFieldSize_Name);
4142
+
4143
+ // UInt32 resVal;
4144
+
4145
+ CFreqBench fb;
4146
+ fb.complexInCommands = numMilCommands * 1000000;
4147
+ fb.numThreads = numThreads;
4148
+ // showFreq;
4149
+ // fb.showFreq = (freqTest == kNumCpuTests - 1 || specifiedFreq != 0);
4150
+ fb.showFreq = true;
4151
+ fb.specifiedFreq = 1;
4152
+
4153
+ const HRESULT res = fb.FreqBench(NULL /* printCallback */
4154
+ #ifndef Z7_ST
4155
+ , &affinityMode
4156
+ #endif
4157
+ );
4158
+ RINOK(res)
4159
+
4160
+ if (freqCallback)
4161
+ {
4162
+ RINOK(freqCallback->AddCpuFreq(numThreads, fb.CpuFreqRes, fb.UsageRes))
4163
+ }
4164
+
4165
+ if (printCallback)
4166
+ {
4167
+ /*
4168
+ if (realDelta == 0)
4169
+ {
4170
+ printCallback->Print(" -");
4171
+ }
4172
+ else
4173
+ */
4174
+ {
4175
+ // PrintNumber(*printCallback, start, 0);
4176
+ PrintUsage(*printCallback, fb.UsageRes, 3);
4177
+ printCallback->Print("%");
4178
+ PrintNumber(*printCallback, fb.CpuFreqRes / 1000000, 0);
4179
+ printCallback->Print(" ");
4180
+
4181
+ // PrintNumber(*printCallback, fb.UsageRes, 5);
4182
+ }
4183
+ }
4184
+ }
4185
+ // if (jj >= 1)
4186
+ {
4187
+ const bool needStop = (numMilCommands >= (1 <<
4188
+ #ifdef _DEBUG
4189
+ 7
4190
+ #else
4191
+ 11
4192
+ #endif
4193
+ ));
4194
+ if (needStop)
4195
+ break;
4196
+ numMilCommands <<= 1;
4197
+ }
4198
+ }
4199
+ if (freqCallback)
4200
+ {
4201
+ RINOK(freqCallback->FreqsFinished(numThreads))
4202
+ }
4203
+ }
4204
+
4205
+
4206
+ if (printCallback)
4207
+ {
4208
+ printCallback->NewLine();
4209
+ printCallback->NewLine();
4210
+ PrintRequirements(*printCallback, "size: ", ramSize_Defined, ramSize, "CPU hardware threads:", numCPUs);
4211
+ printCallback->Print(GetProcessThreadsInfo(threadsInfo));
4212
+ printCallback->NewLine();
4213
+ }
4214
+
4215
+ if (numThreadsSpecified < 1 || numThreadsSpecified > kNumThreadsMax)
4216
+ return E_INVALIDARG;
4217
+
4218
+ UInt64 dict = (UInt64)1 << startDicLog;
4219
+ const bool dictIsDefined = (isFixedDict || method.Get_DicSize(dict));
4220
+
4221
+ const unsigned level = method.GetLevel();
4222
+
4223
+ AString &methodName = method.MethodName;
4224
+ const AString original_MethodName = methodName;
4225
+ if (methodName.IsEmpty())
4226
+ methodName = "LZMA";
4227
+
4228
+ if (benchCallback)
4229
+ {
4230
+ CBenchProps benchProps;
4231
+ benchProps.SetLzmaCompexity();
4232
+ const UInt64 dictSize = method.Get_Lzma_DicSize();
4233
+
4234
+ size_t uncompressedDataSize;
4235
+ if (use_fileData)
4236
+ {
4237
+ uncompressedDataSize = fileDataBuffer.Size();
4238
+ }
4239
+ else
4240
+ {
4241
+ uncompressedDataSize = kAdditionalSize + (size_t)dictSize;
4242
+ if (uncompressedDataSize < dictSize)
4243
+ return E_INVALIDARG;
4244
+ }
4245
+
4246
+ return MethodBench(
4247
+ EXTERNAL_CODECS_LOC_VARS
4248
+ complexInCommands,
4249
+ #ifndef Z7_ST
4250
+ true, numThreadsSpecified,
4251
+ &affinityMode,
4252
+ #endif
4253
+ method,
4254
+ uncompressedDataSize, (const Byte *)fileDataBuffer,
4255
+ kOldLzmaDictBits, printCallback, benchCallback, &benchProps);
4256
+ }
4257
+
4258
+ if (methodName.IsEqualTo_Ascii_NoCase("CRC"))
4259
+ methodName = "crc32";
4260
+
4261
+ CMethodId hashID;
4262
+ const bool isHashMethod = FindHashMethod(EXTERNAL_CODECS_LOC_VARS methodName, hashID);
4263
+ int codecIndex = -1;
4264
+ bool isFilter = false;
4265
+ if (!isHashMethod)
4266
+ {
4267
+ UInt32 numStreams;
4268
+ codecIndex = FindMethod_Index(EXTERNAL_CODECS_LOC_VARS original_MethodName,
4269
+ true, // encode
4270
+ hashID, numStreams, isFilter);
4271
+ // we can allow non filter for BW tests
4272
+ if (!isFilter) codecIndex = -1;
4273
+ }
4274
+
4275
+ CBenchCallbackToPrint callback;
4276
+ callback.Init();
4277
+ callback._file = printCallback;
4278
+
4279
+ if (isHashMethod || codecIndex != -1)
4280
+ {
4281
+ if (!printCallback)
4282
+ return S_FALSE;
4283
+ IBenchPrintCallback &f = *printCallback;
4284
+
4285
+ UInt64 dict64 = dict;
4286
+ if (!dictIsDefined)
4287
+ dict64 = (1 << 27);
4288
+ if (use_fileData)
4289
+ {
4290
+ if (!dictIsDefined)
4291
+ dict64 = fileDataBuffer.Size();
4292
+ else if (dict64 > fileDataBuffer.Size())
4293
+ dict64 = fileDataBuffer.Size();
4294
+ }
4295
+
4296
+ for (;;)
4297
+ {
4298
+ const int index = method.FindProp(NCoderPropID::kDictionarySize);
4299
+ if (index < 0)
4300
+ break;
4301
+ method.Props.Delete((unsigned)index);
4302
+ }
4303
+
4304
+ // methodName.RemoveChar(L'-');
4305
+ Int32 complexity = 16 * k_Hash_Complex_Mult; // for unknown hash method
4306
+ const UInt32 *checkSum = NULL;
4307
+ int benchIndex = -1;
4308
+
4309
+ if (isHashMethod)
4310
+ {
4311
+ for (unsigned i = 0; i < Z7_ARRAY_SIZE(g_Hash); i++)
4312
+ {
4313
+ const CBenchHash &h = g_Hash[i];
4314
+ AString benchMethod (h.Name);
4315
+ AString benchProps;
4316
+ const int propPos = benchMethod.Find(':');
4317
+ if (propPos >= 0)
4318
+ {
4319
+ benchProps = benchMethod.Ptr((unsigned)(propPos + 1));
4320
+ benchMethod.DeleteFrom((unsigned)propPos);
4321
+ }
4322
+
4323
+ if (AreSameMethodNames(benchMethod, methodName))
4324
+ {
4325
+ const bool sameProps = method.PropsString.IsEqualTo_Ascii_NoCase(benchProps);
4326
+ /*
4327
+ bool isMainMethod = method.PropsString.IsEmpty();
4328
+ if (isMainMethod)
4329
+ isMainMethod = !checkSum
4330
+ || (benchMethod.IsEqualTo_Ascii_NoCase("crc32") && benchProps.IsEqualTo_Ascii_NoCase("8"));
4331
+ if (sameProps || isMainMethod)
4332
+ */
4333
+ {
4334
+ complexity = (Int32)h.Complex;
4335
+ checkSum = &h.CheckSum;
4336
+ if (sameProps)
4337
+ break;
4338
+ /*
4339
+ if property. is not specified, we use the complexity
4340
+ for latest fastest method (crc32:64)
4341
+ */
4342
+ }
4343
+ }
4344
+ }
4345
+ // if (!checkSum) return E_NOTIMPL;
4346
+ }
4347
+ else
4348
+ {
4349
+ for (unsigned i = 0; i < Z7_ARRAY_SIZE(g_Bench); i++)
4350
+ {
4351
+ const CBenchMethod &bench = g_Bench[i];
4352
+ AString benchMethod (bench.Name);
4353
+ AString benchProps;
4354
+ const int propPos = benchMethod.Find(':');
4355
+ if (propPos >= 0)
4356
+ {
4357
+ benchProps = benchMethod.Ptr((unsigned)(propPos + 1));
4358
+ benchMethod.DeleteFrom((unsigned)propPos);
4359
+ }
4360
+
4361
+ if (AreSameMethodNames(benchMethod, methodName))
4362
+ {
4363
+ const bool sameProps = method.PropsString.IsEqualTo_Ascii_NoCase(benchProps);
4364
+ // bool isMainMethod = method.PropsString.IsEmpty();
4365
+ // if (sameProps || isMainMethod)
4366
+ {
4367
+ benchIndex = (int)i;
4368
+ if (sameProps)
4369
+ break;
4370
+ }
4371
+ }
4372
+ }
4373
+ // if (benchIndex < 0) return E_NOTIMPL;
4374
+ }
4375
+
4376
+ {
4377
+ /* we count usage only for crc and filter. non-filters are not supported */
4378
+ UInt64 usage = (1 << 20);
4379
+ UInt64 bufSize = dict64;
4380
+ UInt32 numBlocks = isHashMethod ? 1 : 3;
4381
+ if (use_fileData)
4382
+ {
4383
+ usage += fileDataBuffer.Size();
4384
+ if (bufSize > fileDataBuffer.Size())
4385
+ bufSize = fileDataBuffer.Size();
4386
+ if (isHashMethod)
4387
+ {
4388
+ numBlocks = 0;
4389
+ #ifndef Z7_ST
4390
+ if (numThreadsSpecified != 1)
4391
+ numBlocks = (k_Crc_CreateLocalBuf_For_File ? 1 : 0);
4392
+ #endif
4393
+ }
4394
+ }
4395
+ usage += numThreadsSpecified * bufSize * numBlocks;
4396
+ Print_Usage_and_Threads(f, usage, numThreadsSpecified);
4397
+ }
4398
+
4399
+ CUIntVector numThreadsVector;
4400
+ {
4401
+ unsigned nt = numThreads_Start;
4402
+ for (;;)
4403
+ {
4404
+ if (nt > numThreadsSpecified)
4405
+ break;
4406
+ numThreadsVector.Add(nt);
4407
+ const unsigned next = nt * 2;
4408
+ const UInt32 ntHalf= numThreadsSpecified / 2;
4409
+ if (ntHalf > nt && ntHalf < next)
4410
+ numThreadsVector.Add(ntHalf);
4411
+ if (numThreadsSpecified > nt && numThreadsSpecified < next)
4412
+ numThreadsVector.Add(numThreadsSpecified);
4413
+ nt = next;
4414
+ }
4415
+ }
4416
+
4417
+ unsigned numColumns = isHashMethod ? 1 : 2;
4418
+ CTempValues speedTotals;
4419
+ CTempValues usageTotals;
4420
+ {
4421
+ const unsigned numItems = numThreadsVector.Size() * numColumns;
4422
+ speedTotals.Alloc(numItems);
4423
+ usageTotals.Alloc(numItems);
4424
+ for (unsigned i = 0; i < numItems; i++)
4425
+ {
4426
+ speedTotals.Values[i] = 0;
4427
+ usageTotals.Values[i] = 0;
4428
+ }
4429
+ }
4430
+
4431
+ f.NewLine();
4432
+ for (unsigned line = 0; line < 3; line++)
4433
+ {
4434
+ f.NewLine();
4435
+ f.Print(line == 0 ? "THRD" : line == 1 ? " " : "Size");
4436
+ FOR_VECTOR (ti, numThreadsVector)
4437
+ {
4438
+ if (ti != 0)
4439
+ Print_Delimiter(f);
4440
+ if (line == 0)
4441
+ {
4442
+ PrintSpaces(f, (kFieldSize_CrcSpeed + kFieldSize_Usage + 2) * (numColumns - 1));
4443
+ PrintNumber(f, numThreadsVector[ti], 1 + kFieldSize_Usage + kFieldSize_CrcSpeed);
4444
+ }
4445
+ else
4446
+ {
4447
+ for (unsigned c = 0; c < numColumns; c++)
4448
+ {
4449
+ PrintRight(f, line == 1 ? "Usage" : "%", kFieldSize_Usage + 1);
4450
+ PrintRight(f, line == 1 ? "BW" : "MB/s", kFieldSize_CrcSpeed + 1);
4451
+ }
4452
+ }
4453
+ }
4454
+ }
4455
+ f.NewLine();
4456
+
4457
+ UInt64 numSteps = 0;
4458
+
4459
+ // for (UInt32 iter = 0; iter < numIterations; iter++)
4460
+ // {
4461
+ unsigned pow = 10; // kNumHashDictBits
4462
+ if (startDicLog_Defined)
4463
+ pow = startDicLog;
4464
+
4465
+ // #define NUM_SUB_BITS 2
4466
+ // pow <<= NUM_SUB_BITS;
4467
+ for (;; pow++)
4468
+ {
4469
+ const UInt64 bufSize = (UInt64)1 << pow;
4470
+ // UInt64 bufSize = (UInt64)1 << (pow >> NUM_SUB_BITS);
4471
+ // bufSize += ((UInt64)pow & ((1 << NUM_SUB_BITS) - 1)) << ((pow >> NUM_SUB_BITS) - NUM_SUB_BITS);
4472
+
4473
+ size_t dataSize = fileDataBuffer.Size();
4474
+ if (dataSize > bufSize || !use_fileData)
4475
+ dataSize = (size_t)bufSize;
4476
+
4477
+ for (UInt32 iter = 0; iter < numIterations; iter++)
4478
+ {
4479
+ Print_Pow(f, pow);
4480
+ // PrintNumber(f, bufSize >> 10, 4);
4481
+
4482
+ FOR_VECTOR (ti, numThreadsVector)
4483
+ {
4484
+ RINOK(f.CheckBreak())
4485
+ const UInt32 numThreads = numThreadsVector[ti];
4486
+ if (isHashMethod)
4487
+ {
4488
+ UInt64 speed = 0;
4489
+ UInt64 usage = 0;
4490
+ const HRESULT res = CrcBench(EXTERNAL_CODECS_LOC_VARS complexInCommands,
4491
+ numThreads,
4492
+ dataSize, (const Byte *)fileDataBuffer,
4493
+ speed, usage,
4494
+ (UInt32)complexity,
4495
+ 1, // benchWeight,
4496
+ (pow == kNumHashDictBits && !use_fileData) ? checkSum : NULL,
4497
+ method,
4498
+ &f,
4499
+ #ifndef Z7_ST
4500
+ &affinityMode,
4501
+ #endif
4502
+ false, // showRating
4503
+ NULL, false, 0);
4504
+ RINOK(res)
4505
+
4506
+ if (ti != 0)
4507
+ Print_Delimiter(f);
4508
+
4509
+ Bench_BW_Print_Usage_Speed(f, usage, speed);
4510
+ speedTotals.Values[ti] += speed;
4511
+ usageTotals.Values[ti] += usage;
4512
+ }
4513
+ else
4514
+ {
4515
+ {
4516
+ unsigned keySize = 32;
4517
+ if (IsString1PrefixedByString2(methodName, "AES128")) keySize = 16;
4518
+ else if (IsString1PrefixedByString2(methodName, "AES192")) keySize = 24;
4519
+ callback.BenchProps.KeySize = keySize;
4520
+ }
4521
+
4522
+ COneMethodInfo method2 = method;
4523
+ unsigned bench_DictBits;
4524
+
4525
+ if (benchIndex >= 0)
4526
+ {
4527
+ const CBenchMethod &bench = g_Bench[benchIndex];
4528
+ callback.BenchProps.EncComplex = bench.EncComplex;
4529
+ callback.BenchProps.DecComplexUnc = bench.DecComplexUnc;
4530
+ callback.BenchProps.DecComplexCompr = bench.DecComplexCompr;
4531
+ bench_DictBits = bench.DictBits;
4532
+ // bench_DictBits = kOldLzmaDictBits; = 32 default : for debug
4533
+ }
4534
+ else
4535
+ {
4536
+ bench_DictBits = kOldLzmaDictBits; // = 32 default
4537
+ if (isFilter)
4538
+ {
4539
+ const unsigned k_UnknownCoderComplexity = 4;
4540
+ callback.BenchProps.EncComplex = k_UnknownCoderComplexity;
4541
+ callback.BenchProps.DecComplexUnc = k_UnknownCoderComplexity;
4542
+ }
4543
+ else
4544
+ {
4545
+ callback.BenchProps.EncComplex = 1 << 10;
4546
+ callback.BenchProps.DecComplexUnc = 1 << 6;
4547
+ }
4548
+ callback.BenchProps.DecComplexCompr = 0;
4549
+ }
4550
+ callback.NeedPrint = false;
4551
+
4552
+ if (StringsAreEqualNoCase_Ascii(method2.MethodName, "LZMA"))
4553
+ {
4554
+ const NCOM::CPropVariant propVariant = (UInt32)pow;
4555
+ RINOK(method2.ParseMethodFromPROPVARIANT((UString)"d", propVariant))
4556
+ }
4557
+
4558
+ const HRESULT res = MethodBench(
4559
+ EXTERNAL_CODECS_LOC_VARS
4560
+ complexInCommands,
4561
+ #ifndef Z7_ST
4562
+ false, // oldLzmaBenchMode
4563
+ numThreadsVector[ti],
4564
+ &affinityMode,
4565
+ #endif
4566
+ method2,
4567
+ dataSize, (const Byte *)fileDataBuffer,
4568
+ bench_DictBits,
4569
+ printCallback,
4570
+ &callback,
4571
+ &callback.BenchProps);
4572
+ RINOK(res)
4573
+
4574
+ if (ti != 0)
4575
+ Print_Delimiter(f);
4576
+
4577
+ for (unsigned i = 0; i < 2; i++)
4578
+ {
4579
+ const CBenchInfo &bi = callback.BenchInfo_Results[i];
4580
+ const UInt64 usage = bi.GetUsage();
4581
+ const UInt64 speed = bi.GetUnpackSizeSpeed();
4582
+ usageTotals.Values[ti * 2 + i] += usage;
4583
+ speedTotals.Values[ti * 2 + i] += speed;
4584
+ Bench_BW_Print_Usage_Speed(f, usage, speed);
4585
+ }
4586
+ }
4587
+ }
4588
+
4589
+ f.NewLine();
4590
+ numSteps++;
4591
+ }
4592
+ if (dataSize >= dict64)
4593
+ break;
4594
+ }
4595
+
4596
+ if (numSteps != 0)
4597
+ {
4598
+ f.Print("Avg:");
4599
+ for (unsigned ti = 0; ti < numThreadsVector.Size(); ti++)
4600
+ {
4601
+ if (ti != 0)
4602
+ Print_Delimiter(f);
4603
+ for (unsigned i = 0; i < numColumns; i++)
4604
+ Bench_BW_Print_Usage_Speed(f,
4605
+ usageTotals.Values[ti * numColumns + i] / numSteps,
4606
+ speedTotals.Values[ti * numColumns + i] / numSteps);
4607
+ }
4608
+ f.NewLine();
4609
+ }
4610
+
4611
+ return S_OK;
4612
+ }
4613
+
4614
+ bool use2Columns = false;
4615
+
4616
+ bool totalBenchMode = false;
4617
+ bool onlyHashBench = false;
4618
+ if (methodName.IsEqualTo_Ascii_NoCase("hash"))
4619
+ {
4620
+ onlyHashBench = true;
4621
+ methodName = "*";
4622
+ totalBenchMode = true;
4623
+ }
4624
+ else if (methodName.Find('*') >= 0)
4625
+ totalBenchMode = true;
4626
+
4627
+ // ---------- Threads loop ----------
4628
+ for (unsigned threadsPassIndex = 0; threadsPassIndex < 3; threadsPassIndex++)
4629
+ {
4630
+
4631
+ UInt32 numThreads = numThreadsSpecified;
4632
+
4633
+ if (!multiThreadTests)
4634
+ {
4635
+ if (threadsPassIndex != 0)
4636
+ break;
4637
+ }
4638
+ else
4639
+ {
4640
+ numThreads = 1;
4641
+ if (threadsPassIndex != 0)
4642
+ {
4643
+ if (numCPUs < 2)
4644
+ break;
4645
+ numThreads = numCPUs;
4646
+ if (threadsPassIndex == 1)
4647
+ {
4648
+ if (numCPUs >= 4)
4649
+ numThreads = numCPUs / 2;
4650
+ }
4651
+ else if (numCPUs < 4)
4652
+ break;
4653
+ }
4654
+ }
4655
+
4656
+ IBenchPrintCallback &f = *printCallback;
4657
+
4658
+ if (threadsPassIndex > 0)
4659
+ {
4660
+ f.NewLine();
4661
+ f.NewLine();
4662
+ }
4663
+
4664
+ if (!dictIsDefined && !onlyHashBench)
4665
+ {
4666
+ // we use dicSizeLog and dicSizeLog_Main for data size.
4667
+ // also we use it to reduce dictionary size of LZMA encoder via NCoderPropID::kReduceSize.
4668
+ const unsigned dicSizeLog_Main = (totalBenchMode ? 24 : 25);
4669
+ unsigned dicSizeLog = dicSizeLog_Main;
4670
+
4671
+ #ifdef UNDER_CE
4672
+ dicSizeLog = (UInt64)1 << 20;
4673
+ #endif
4674
+
4675
+ if (ramSize_Defined)
4676
+ for (; dicSizeLog > kBenchMinDicLogSize; dicSizeLog--)
4677
+ if (GetBenchMemoryUsage(numThreads, (int)level, ((UInt64)1 << dicSizeLog), totalBenchMode) + (8 << 20) <= ramSize)
4678
+ break;
4679
+
4680
+ dict = (UInt64)1 << dicSizeLog;
4681
+
4682
+ if (totalBenchMode && dicSizeLog != dicSizeLog_Main)
4683
+ {
4684
+ f.Print("Dictionary reduced to: ");
4685
+ PrintNumber(f, dicSizeLog, 1);
4686
+ f.NewLine();
4687
+ }
4688
+ }
4689
+
4690
+ Print_Usage_and_Threads(f,
4691
+ onlyHashBench ?
4692
+ GetBenchMemoryUsage_Hash(numThreads, dict) :
4693
+ GetBenchMemoryUsage(numThreads, (int)level, dict, totalBenchMode),
4694
+ numThreads);
4695
+
4696
+ f.NewLine();
4697
+
4698
+ f.NewLine();
4699
+
4700
+ if (totalBenchMode)
4701
+ {
4702
+ callback.NameFieldSize = kFieldSize_Name;
4703
+ use2Columns = false;
4704
+ }
4705
+ else
4706
+ {
4707
+ callback.NameFieldSize = kFieldSize_SmallName;
4708
+ use2Columns = true;
4709
+ }
4710
+ callback.Use2Columns = use2Columns;
4711
+
4712
+ bool showFreq = false;
4713
+ UInt64 cpuFreq = 0;
4714
+
4715
+ if (totalBenchMode)
4716
+ {
4717
+ showFreq = true;
4718
+ }
4719
+
4720
+ unsigned fileldSize = kFieldSize_TotalSize;
4721
+ if (showFreq)
4722
+ fileldSize += kFieldSize_EUAndEffec;
4723
+
4724
+ if (use2Columns)
4725
+ {
4726
+ PrintSpaces(f, callback.NameFieldSize);
4727
+ PrintRight(f, "Compressing", fileldSize);
4728
+ f.Print(kSep);
4729
+ PrintRight(f, "Decompressing", fileldSize);
4730
+ }
4731
+ f.NewLine();
4732
+ PrintLeft(f, totalBenchMode ? "Method" : "Dict", callback.NameFieldSize);
4733
+
4734
+ int j;
4735
+
4736
+ for (j = 0; j < 2; j++)
4737
+ {
4738
+ PrintRight(f, "Speed", kFieldSize_Speed + 1);
4739
+ PrintRight(f, "Usage", kFieldSize_Usage + 1);
4740
+ PrintRight(f, "R/U", kFieldSize_RU + 1);
4741
+ PrintRight(f, "Rating", kFieldSize_Rating + 1);
4742
+ if (showFreq)
4743
+ {
4744
+ PrintRight(f, "E/U", kFieldSize_EU + 1);
4745
+ PrintRight(f, "Effec", kFieldSize_Effec + 1);
4746
+ }
4747
+ if (!use2Columns)
4748
+ break;
4749
+ if (j == 0)
4750
+ f.Print(kSep);
4751
+ }
4752
+
4753
+ f.NewLine();
4754
+ PrintSpaces(f, callback.NameFieldSize);
4755
+
4756
+ for (j = 0; j < 2; j++)
4757
+ {
4758
+ PrintRight(f, "KiB/s", kFieldSize_Speed + 1);
4759
+ PrintRight(f, "%", kFieldSize_Usage + 1);
4760
+ PrintRight(f, "MIPS", kFieldSize_RU + 1);
4761
+ PrintRight(f, "MIPS", kFieldSize_Rating + 1);
4762
+ if (showFreq)
4763
+ {
4764
+ PrintRight(f, "%", kFieldSize_EU + 1);
4765
+ PrintRight(f, "%", kFieldSize_Effec + 1);
4766
+ }
4767
+ if (!use2Columns)
4768
+ break;
4769
+ if (j == 0)
4770
+ f.Print(kSep);
4771
+ }
4772
+
4773
+ f.NewLine();
4774
+ f.NewLine();
4775
+
4776
+ if (specifiedFreq != 0)
4777
+ cpuFreq = specifiedFreq;
4778
+
4779
+ // bool showTotalSpeed = false;
4780
+
4781
+ if (totalBenchMode)
4782
+ {
4783
+ for (UInt32 i = 0; i < numIterations; i++)
4784
+ {
4785
+ if (i != 0)
4786
+ printCallback->NewLine();
4787
+
4788
+ const unsigned kNumCpuTests = 3;
4789
+ for (unsigned freqTest = 0; freqTest < kNumCpuTests; freqTest++)
4790
+ {
4791
+ PrintLeft(f, "CPU", kFieldSize_Name);
4792
+
4793
+ // UInt32 resVal;
4794
+
4795
+ CFreqBench fb;
4796
+ fb.complexInCommands = complexInCommands;
4797
+ fb.numThreads = numThreads;
4798
+ // showFreq;
4799
+ fb.showFreq = (freqTest == kNumCpuTests - 1 || specifiedFreq != 0);
4800
+ fb.specifiedFreq = specifiedFreq;
4801
+
4802
+ const HRESULT res = fb.FreqBench(printCallback
4803
+ #ifndef Z7_ST
4804
+ , &affinityMode
4805
+ #endif
4806
+ );
4807
+ RINOK(res)
4808
+
4809
+ cpuFreq = fb.CpuFreqRes;
4810
+ callback.NewLine();
4811
+
4812
+ if (specifiedFreq != 0)
4813
+ cpuFreq = specifiedFreq;
4814
+
4815
+ if (testTimeMs >= 1000)
4816
+ if (freqTest == kNumCpuTests - 1)
4817
+ {
4818
+ // SetComplexCommandsMs(testTimeMs, specifiedFreq != 0, cpuFreq, complexInCommands);
4819
+ }
4820
+ }
4821
+ callback.NewLine();
4822
+
4823
+ // return S_OK; // change it
4824
+
4825
+ callback.SetFreq(true, cpuFreq);
4826
+
4827
+ if (!onlyHashBench)
4828
+ {
4829
+ size_t dataSize = (size_t)dict;
4830
+ if (use_fileData)
4831
+ {
4832
+ dataSize = fileDataBuffer.Size();
4833
+ if (dictIsDefined && dataSize > dict)
4834
+ dataSize = (size_t)dict;
4835
+ }
4836
+
4837
+ const HRESULT res = TotalBench(EXTERNAL_CODECS_LOC_VARS
4838
+ method, complexInCommands,
4839
+ #ifndef Z7_ST
4840
+ numThreads,
4841
+ &affinityMode,
4842
+ #endif
4843
+ dictIsDefined || use_fileData, // forceUnpackSize
4844
+ dataSize,
4845
+ (const Byte *)fileDataBuffer,
4846
+ printCallback, &callback);
4847
+ RINOK(res)
4848
+ }
4849
+
4850
+ {
4851
+ size_t dataSize = (size_t)1 << kNumHashDictBits;
4852
+ if (dictIsDefined)
4853
+ {
4854
+ dataSize = (size_t)dict;
4855
+ if (dataSize != dict)
4856
+ return E_OUTOFMEMORY;
4857
+ }
4858
+ if (use_fileData)
4859
+ {
4860
+ dataSize = fileDataBuffer.Size();
4861
+ if (dictIsDefined && dataSize > dict)
4862
+ dataSize = (size_t)dict;
4863
+ }
4864
+
4865
+ const HRESULT res = TotalBench_Hash(EXTERNAL_CODECS_LOC_VARS
4866
+ method, complexInCommands,
4867
+ numThreads,
4868
+ dataSize, (const Byte *)fileDataBuffer,
4869
+ printCallback, &callback,
4870
+ #ifndef Z7_ST
4871
+ &affinityMode,
4872
+ #endif
4873
+ &callback.EncodeRes, true, cpuFreq);
4874
+ RINOK(res)
4875
+ }
4876
+
4877
+ callback.NewLine();
4878
+ {
4879
+ PrintLeft(f, "CPU", kFieldSize_Name);
4880
+
4881
+ CFreqBench fb;
4882
+ fb.complexInCommands = complexInCommands;
4883
+ fb.numThreads = numThreads;
4884
+ // showFreq;
4885
+ fb.showFreq = (specifiedFreq != 0);
4886
+ fb.specifiedFreq = specifiedFreq;
4887
+
4888
+ const HRESULT res = fb.FreqBench(printCallback
4889
+ #ifndef Z7_ST
4890
+ , &affinityMode
4891
+ #endif
4892
+ );
4893
+ RINOK(res)
4894
+ callback.NewLine();
4895
+ }
4896
+ }
4897
+ }
4898
+ else
4899
+ {
4900
+ needSetComplexity = true;
4901
+ if (!methodName.IsEqualTo_Ascii_NoCase("LZMA"))
4902
+ {
4903
+ unsigned i;
4904
+ for (i = 0; i < Z7_ARRAY_SIZE(g_Bench); i++)
4905
+ {
4906
+ const CBenchMethod &h = g_Bench[i];
4907
+ AString benchMethod (h.Name);
4908
+ AString benchProps;
4909
+ const int propPos = benchMethod.Find(':');
4910
+ if (propPos >= 0)
4911
+ {
4912
+ benchProps = benchMethod.Ptr((unsigned)(propPos + 1));
4913
+ benchMethod.DeleteFrom((unsigned)propPos);
4914
+ }
4915
+
4916
+ if (AreSameMethodNames(benchMethod, methodName))
4917
+ {
4918
+ if (benchProps.IsEmpty()
4919
+ || (benchProps.IsEqualTo("x5") && method.PropsString.IsEmpty())
4920
+ || method.PropsString.IsPrefixedBy_Ascii_NoCase(benchProps))
4921
+ {
4922
+ callback.BenchProps.EncComplex = h.EncComplex;
4923
+ callback.BenchProps.DecComplexCompr = h.DecComplexCompr;
4924
+ callback.BenchProps.DecComplexUnc = h.DecComplexUnc;
4925
+ needSetComplexity = false;
4926
+ break;
4927
+ }
4928
+ }
4929
+ }
4930
+ /*
4931
+ if (i == Z7_ARRAY_SIZE(g_Bench))
4932
+ return E_NOTIMPL;
4933
+ */
4934
+ }
4935
+ if (needSetComplexity)
4936
+ callback.BenchProps.SetLzmaCompexity();
4937
+
4938
+ if (startDicLog < kBenchMinDicLogSize)
4939
+ startDicLog = kBenchMinDicLogSize;
4940
+
4941
+ for (unsigned i = 0; i < numIterations; i++)
4942
+ {
4943
+ unsigned pow = (dict < GetDictSizeFromLog(startDicLog)) ? kBenchMinDicLogSize : (unsigned)startDicLog;
4944
+ if (!multiDict)
4945
+ pow = 32;
4946
+ while (GetDictSizeFromLog(pow) > dict && pow > 0)
4947
+ pow--;
4948
+ for (; GetDictSizeFromLog(pow) <= dict; pow++)
4949
+ {
4950
+ Print_Pow(f, pow);
4951
+ callback.DictSize = (UInt64)1 << pow;
4952
+
4953
+ COneMethodInfo method2 = method;
4954
+
4955
+ if (StringsAreEqualNoCase_Ascii(method2.MethodName, "LZMA"))
4956
+ {
4957
+ // We add dictionary size property.
4958
+ // method2 can have two different dictionary size properties.
4959
+ // And last property is main.
4960
+ NCOM::CPropVariant propVariant = (UInt32)pow;
4961
+ RINOK(method2.ParseMethodFromPROPVARIANT((UString)"d", propVariant))
4962
+ }
4963
+
4964
+ size_t uncompressedDataSize;
4965
+ if (use_fileData)
4966
+ {
4967
+ uncompressedDataSize = fileDataBuffer.Size();
4968
+ }
4969
+ else
4970
+ {
4971
+ uncompressedDataSize = (size_t)callback.DictSize;
4972
+ if (uncompressedDataSize != callback.DictSize)
4973
+ return E_OUTOFMEMORY;
4974
+ if (uncompressedDataSize >= (1 << 18))
4975
+ uncompressedDataSize += kAdditionalSize;
4976
+ }
4977
+
4978
+ const HRESULT res = MethodBench(
4979
+ EXTERNAL_CODECS_LOC_VARS
4980
+ complexInCommands,
4981
+ #ifndef Z7_ST
4982
+ true, numThreads,
4983
+ &affinityMode,
4984
+ #endif
4985
+ method2,
4986
+ uncompressedDataSize, (const Byte *)fileDataBuffer,
4987
+ kOldLzmaDictBits, printCallback, &callback, &callback.BenchProps);
4988
+ f.NewLine();
4989
+ RINOK(res)
4990
+ if (!multiDict)
4991
+ break;
4992
+ }
4993
+ }
4994
+ }
4995
+
4996
+ PrintChars(f, '-', callback.NameFieldSize + fileldSize);
4997
+
4998
+ if (use2Columns)
4999
+ {
5000
+ f.Print(kSep);
5001
+ PrintChars(f, '-', fileldSize);
5002
+ }
5003
+
5004
+ f.NewLine();
5005
+
5006
+ if (use2Columns)
5007
+ {
5008
+ PrintLeft(f, "Avr:", callback.NameFieldSize);
5009
+ PrintTotals(f, showFreq, cpuFreq, !totalBenchMode, callback.EncodeRes);
5010
+ f.Print(kSep);
5011
+ PrintTotals(f, showFreq, cpuFreq, !totalBenchMode, callback.DecodeRes);
5012
+ f.NewLine();
5013
+ }
5014
+
5015
+ PrintLeft(f, "Tot:", callback.NameFieldSize);
5016
+ CTotalBenchRes midRes;
5017
+ midRes = callback.EncodeRes;
5018
+ midRes.Update_With_Res(callback.DecodeRes);
5019
+
5020
+ // midRes.SetSum(callback.EncodeRes, callback.DecodeRes);
5021
+ PrintTotals(f, showFreq, cpuFreq, false, midRes);
5022
+ f.NewLine();
5023
+
5024
+ }
5025
+ return S_OK;
5026
+ }