Skip to content

Instantly share code, notes, and snippets.

@aerodame
Created October 27, 2014 02:26
Show Gist options
  • Save aerodame/6fe841a986b25eb73263 to your computer and use it in GitHub Desktop.
Save aerodame/6fe841a986b25eb73263 to your computer and use it in GitHub Desktop.
// Provide a quick debugger of the TCBs in queue
// Format of output is = Q[i]-> { [p,t] [p,t] [p,t] ... }
private void dumpQueue(int time) {
int N;
if (DEBUG) {
System.out.print("T("+time+"): ");
// scan through each multilevel queue
for (int i=0; i < 3; i++) {
// how many TCBs are in queue
N = queue[i].size();
// Scheduler counts as one (don't print it)
System.out.print("Q["+ i +"]-> {");
// print out TCBs in addition to Scheduler TCB
for(int j=0; j < N; j++) {
TCB t = queue[i].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(" } ");
}
System.out.println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment