A chaque commuation de tâche, j'ai créé un hook afin de sauvegarder quelques informations concernant les x dernières taches dans un buffer circulaire.

En terme de rapidité d'éxécution (pour rester le moins de temps possible dans ce hook), vaut il mieux faire cela:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
void PRF_SaveRegSwitchHook(WIND_TCB *oldTcbPtr, WIND_TCB *newTcbPtr)
{
  	REG_SET regSet;			/*Task registers*/
	TASK_DESC taskDesc;		/*information structure */
	newTaskInfo newtaskInfo;
	tracePostMortem *TaskInfoTemp = NULL;
 
   	/*Critical section: temporay storage pointer to optimize the speed.*/
   	TaskInfoTemp = &TaskInfoBuf[indexBuf];
 
   	TaskInfoTemp->taskId = taskNameToId(oldTcbPtr->name);
   	if (taskRegsGet (TaskInfoBuf[indexBuf].taskId, &regSet) != ERROR){
   		TaskInfoTemp->registers = regSet;
   		TaskInfoTemp->TaskSP = (int)GetSP();
		TaskInfoTemp->TaskFP = (int)GetFP(); 
   	}
 
	TaskInfoTemp->stackBase = (UInt32) oldTcbPtr->pStackBase;
	TaskInfoTemp->stackLimit = (UInt32) oldTcbPtr->pStackLimit;
	TaskInfoTemp->stackEnd = (UInt32) oldTcbPtr->pStackEnd;
}
à ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
void PRF_SaveRegSwitchHook(WIND_TCB *oldTcbPtr, WIND_TCB *newTcbPtr)
{
  	REG_SET regSet;			/*Task registers*/
	TASK_DESC taskDesc;		/*information structure */
	newTaskInfo newtaskInfo;
 
   	TaskInfoBuf[indexBuf].taskId = taskNameToId(oldTcbPtr->name);
   	if (taskRegsGet (TaskInfoBuf[indexBuf].taskId, &regSet) != ERROR){
   		TaskInfoBuf[indexBuf].registers = regSet;
   		TaskInfoBuf[indexBuf].TaskSP = (int)GetSP();
		TaskInfoBuf[indexBuf].TaskFP = (int)GetFP(); 
   	}
 
	TaskInfoBuf[indexBuf].stackBase = (UInt32) oldTcbPtr->pStackBase;
	TaskInfoBuf[indexBuf].stackLimit = (UInt32) oldTcbPtr->pStackLimit;
	TaskInfoBuf[indexBuf].stackEnd = (UInt32) oldTcbPtr->pStackEnd;
}
Si c'est bien le cas, pourrait on m'expliquer le pourquoi?

Remarque: indexBuf est une variable globale au module déclaré comme suit:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
static UInt16 indexBuf = 0;
Merci