Skip to content

Instantly share code, notes, and snippets.

@dezgeg
Last active December 16, 2015 11:48
Show Gist options
  • Save dezgeg/5429651 to your computer and use it in GitHub Desktop.
Save dezgeg/5429651 to your computer and use it in GitHub Desktop.
diff --git a/src/main/java/fi/helsinki/cs/titokone/GUIBrain.java b/src/main/java/fi/helsinki/cs/titokone/GUIBrain.java
index fbaec9b..b123da7 100644
--- a/src/main/java/fi/helsinki/cs/titokone/GUIBrain.java
+++ b/src/main/java/fi/helsinki/cs/titokone/GUIBrain.java
@@ -338,6 +338,8 @@ public class GUIBrain {
* This method corresponds to the menu option File -> Run. It does
* its work by calling runInstruction().
*/
+ private long lastMillis;
+ private int lastCycles;
public void menuRun() {
synchronized (lock) {
threadRunning = true;
@@ -498,6 +500,12 @@ public class GUIBrain {
*/
if (runinfo.whatOUT()[0] == Processor.CRT) {
gui.addOutputData(runinfo.whatOUT()[1]);
+ int cycles = ((Processor)control.getCpu()).giveCommAmount();
+ long millis = System.currentTimeMillis();
+ System.out.printf("Delta: %d cycles / %d ms, %f cycles/ms\n", cycles - lastCycles, millis - lastMillis,
+ (double)(cycles - lastCycles) / (millis - lastMillis));
+ lastCycles = cycles;
+ lastMillis = millis;
}
}
} while (interruptSent == false); // End of do-while -loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment