Refactored instruction stats code so it can be used as a module

    * analysis/instruction_stats.py: Refactored code