def run(args):
_profile = False
if _profile:
import pstats, cProfile
fh_in = open(args.file, "rb")
fh_out = open(args.output, "wb")
if args.compress:
if _profile:
cProfile.runctx("stream_compress(fh_in, fh_out, args.framing, args.bytesize)", globals(), locals(), "Profile.prof")
else:
stream_compress(fh_in, fh_out, args.framing, args.bytesize)
else:
if _profile:
cProfile.runctx("stream_decompress(fh_in, fh_out, args.framing, args.bytesize)", globals(), locals(), "Profile.prof")
else:
stream_decompress(fh_in, fh_out, args.framing, args.bytesize)
if _profile:
s = pstats.Stats("Profile.prof")
s.strip_dirs().sort_stats("time").print_stats()
fh_in.close()
fh_out.close()
评论列表
文章目录