David 10 år sedan
förälder
incheckning
dae086b2fa
2 ändrade filer med 14 tillägg och 0 borttagningar
  1. 13 0
      sched_mfq.cpp
  2. 1 0
      sched_mfq.h

+ 13 - 0
sched_mfq.cpp

@@ -42,6 +42,9 @@ uint SchedMFQ::pid_queue(uint pid){
 		if ( v_cola[i].count(pid) == 1) //Solo hay 0/1 key en un map
 			return i;
 
+	cout << "WHAT THE FUCK " << pid << endl;
+	for( uint i = 0; i < n_colas; i++ )
+		cout << "size cola " << i << " = " << v_cola[i].size() << endl;
 	return 65535; // ??
 }
 
@@ -70,10 +73,16 @@ uint SchedMFQ::next_pid(){
 	return IDLE_TASK;
 }
 
+void SchedMFQ::mostrar_estados(){
+	for( uint q = 0; q < n_colas; q++ ){
+		cout << "Cola " << q << ", size: " << v_cola[q].size() << endl;
+	}
+}
 int SchedMFQ::tick(int core, const enum Motivo m) {
 	uint switch_process = 0;
 	int cur_pid = current_pid(core);
 
+	cout << "PID at core " << core << " = " << cur_pid << endl;
 	if (cur_pid == IDLE_TASK)
 		return next_pid();
 
@@ -99,9 +108,13 @@ int SchedMFQ::tick(int core, const enum Motivo m) {
 		break;
 	case EXIT:
 		switch_process = 1;
+		//cout << v_cola[p_q].size() << endl;
+		//cout << "borro pid: " << cur_pid << endl;
 		v_cola[p_q].erase(cur_pid);
+		//cout << v_cola[p_q].size() << endl;
 		break;
 	}
+	mostrar_estados();
 
 	if (switch_process)
 		return next_pid();

+ 1 - 0
sched_mfq.h

@@ -24,6 +24,7 @@ class SchedMFQ : public SchedBase {
 		};
 
 		int ready_at(uint);
+		void mostrar_estados();
 		uint next_pid();
 		uint pid_queue(uint);
 		uint n_colas;