projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2005-04-28 21:31:45 by simonmar]
[ghc-hetmet.git]
/
ghc
/
rts
/
Task.c
diff --git
a/ghc/rts/Task.c
b/ghc/rts/Task.c
index
76ea891
..
46cfa26
100644
(file)
--- a/
ghc/rts/Task.c
+++ b/
ghc/rts/Task.c
@@
-28,7
+28,8
@@
TaskInfo* taskTable;
static nat taskTableSize;
TaskInfo* taskTable;
static nat taskTableSize;
-HashTable *taskHash; // maps OSThreadID to TaskInfo*
+// maps OSThreadID to TaskInfo*
+HashTable *taskHash;
nat taskCount;
static nat tasksRunning;
nat taskCount;
static nat tasksRunning;
@@
-43,7
+44,12
@@
initTaskManager (void)
static int initialized = 0;
if (!initialized) {
static int initialized = 0;
if (!initialized) {
+#if defined(SMP)
+ taskTableSize = stg_max(INIT_TASK_TABLE_SIZE,
+ RtsFlags.ParFlags.nNodes * 2);
+#else
taskTableSize = INIT_TASK_TABLE_SIZE;
taskTableSize = INIT_TASK_TABLE_SIZE;
+#endif
taskTable = stgMallocBytes( taskTableSize * sizeof(TaskInfo),
"initTaskManager");
taskTable = stgMallocBytes( taskTableSize * sizeof(TaskInfo),
"initTaskManager");
@@
-62,9
+68,17
@@
initTaskManager (void)
static void
expandTaskTable (void)
{
static void
expandTaskTable (void)
{
+ nat i;
+
taskTableSize *= 2;
taskTable = stgReallocBytes(taskTable, taskTableSize * sizeof(TaskInfo),
"expandTaskTable");
taskTableSize *= 2;
taskTable = stgReallocBytes(taskTable, taskTableSize * sizeof(TaskInfo),
"expandTaskTable");
+
+ /* Have to update the hash table now... */
+ for (i = 0; i < taskCount; i++) {
+ removeHashTable( taskHash, taskTable[i].id, NULL );
+ insertHashTable( taskHash, taskTable[i].id, &taskTable[i] );
+ }
}
void
}
void
@@
-78,6
+92,7
@@
stopTaskManager (void)
IF_DEBUG(scheduler, sched_belch("all tasks stopped"));
return;
}
IF_DEBUG(scheduler, sched_belch("all tasks stopped"));
return;
}
+ IF_DEBUG(scheduler, sched_belch("yielding"));
prodWorker();
yieldThread();
}
prodWorker();
yieldThread();
}
@@
-200,9
+215,6
@@
taskStop (void)
}
ASSERT(task_info->id == id);
}
ASSERT(task_info->id == id);
- task_info->stopped = rtsTrue;
- tasksRunning--;
-
stat_getTimes(¤tElapsedTime, ¤tUserTime, &elapsedGCTime);
task_info->mut_time =
stat_getTimes(¤tElapsedTime, ¤tUserTime, &elapsedGCTime);
task_info->mut_time =
@@
-212,6
+224,9
@@
taskStop (void)
if (task_info->mut_time < 0.0) { task_info->mut_time = 0.0; }
if (task_info->mut_etime < 0.0) { task_info->mut_etime = 0.0; }
if (task_info->mut_time < 0.0) { task_info->mut_time = 0.0; }
if (task_info->mut_etime < 0.0) { task_info->mut_etime = 0.0; }
+
+ task_info->stopped = rtsTrue;
+ tasksRunning--;
}
void
}
void