Package mars.tools

Class InstructionCounter

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, Memory.Listener, MarsTool

public class InstructionCounter extends AbstractMarsTool
Instruction counter tool. Can be used to know how many instructions were executed to complete a given program.

Code slightly based on MemoryReferenceVisualization.

Author:
Felipe Lessa (felipe.lessa@gmail.com)
See Also:
  • Field Details

    • counter

      protected int counter
      Number of instructions executed until now.
    • counterR

      protected int counterR
      Number of instructions of type R.
    • counterI

      protected int counterI
      Number of instructions of type I.
    • counterJ

      protected int counterJ
      Number of instructions of type J.
    • lastAddress

      protected int lastAddress
      The last address we saw. We ignore it because the only way for a program to execute twice the same instruction is to enter an infinite loop, which is not insteresting in the POV of counting instructions.
  • Constructor Details

    • InstructionCounter

      public InstructionCounter()
      Construct an instance of this tool. This will be used by the ToolManager.
  • Method Details