void __top(){ DisableInts(); TaskQueue * queue = &ready_q; int iterations = queue->iterations; Task * itr; float top = 0; printf("CPU Resources \n"); printf("Priority\tCPU\tPID\tName\t\t\tState\n"); printf("--------\t---\t---\t----\t\t\t-----\n"); for ( itr = queue->head ; itr != NULL && queue->tail ; itr = itr->next ){ printf("%d \t\t %d \t %d \t %s \t\t\tREADY\n", (int)itr->priority, (int)((100*itr->count) / ((float)iterations)), itr->pid, itr->name); top += (100*itr->count) / ((float)iterations); } queue = &blocked_q; for ( itr = queue->head ; itr != NULL && queue->tail ; itr = itr->next ){ printf("%d \t\t %d \t %d \t %s \t\t\tBLOCKED\n",(int)itr->priority, (int)((100*itr->count) / ((float)iterations)), itr->pid, itr->name); top += (100*itr->count) / ((float)iterations); } // Current task printf("%d \t\t %d \t %d \t %s \t\t\tCURRENT\n",(int)mt_curr_task->priority, (int)((100*mt_curr_task->count) / ((float)iterations)), mt_curr_task->pid, mt_curr_task->name); top += (100*mt_curr_task->count) / ((float)iterations); printf("\t\t _____\n"); printf("\t\t %d\n", (int)top); RestoreInts(); }
// Este procedimiento deshabilita las interrupciones del temporizador void DeshabilitarIntTemp() { //Para ello primero se deshabilitan todas las interrupciones DisableInts(); //Escribir un 0 en los bits correspondientes a los temporizadores 1 y 2 del REG_IE IE = IE & ~(3 << 3); //Para acabar, se habilitan todas las interrupciones EnableInts(); }
void i8080_hal_iff(int on) { if (on) EnableInts(); else DisableInts(); }