Skip to content

Instantly share code, notes, and snippets.

@aerodame
Last active August 29, 2015 14:19
Show Gist options
  • Save aerodame/c1dc6c7a1b6b28815361 to your computer and use it in GitHub Desktop.
Save aerodame/c1dc6c7a1b6b28815361 to your computer and use it in GitHub Desktop.
ThreadOS Single Queue debugger
// ----------------------- Start Debugger Method ---------------------------
// Provide a simple debugger of the TCBs in queue
// Format of output is = Q[]-> { [p,t] [p,t] [p,t] ... }
// Where p = Process ID
// t = Thread ID
// -------------------------------------------------------------------------
private void dumpQueue(int time) {
if (DEBUG) {
System.out.print("\nT("+time+"): ");
// how many TCBs are in queue
int N = queue.size();
System.out.print("Q[]-> {");
// print out TCBs in addition to Scheduler TCB
for(int j=0; j < N; j++) {
TCB t = (TCB)queue.get(j);
//if(t.getTid() != 0)
// System.out.print(" ["+t.getPid()+","+t.getTid()+":"+t.getThread());
System.out.print(" ["+t.getPid()+","+t.getTid()+"]");
}
System.out.print(" } ");
// }
}
}
// ----------------------- End Debugger Method -----------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment