#!/usr/bin/python import sys import pstats import cProfile as profile sys.path.insert(0, 'build/lib.linux-i686-2.6') import pyrabinf_mod def main(): #with open('test-input', 'r') as file_: with open('/boot/initrd.img-2.6.35-22-generic', 'r') as file_: for chunk in pyrabinf_mod.Chunker(file_, size_exponent=20): print len(chunk) main() profile.runctx("main()", globals(), locals(), "Profile.prof") stats = pstats.Stats("Profile.prof") stats.strip_dirs().sort_stats("time").print_stats()