A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[xbt/surf] Change the costly heapremove+heapinsert used in share resource lazy algorithm.
[simgrid.git]
/
src
/
surf
/
surf_interface.cpp
diff --git
a/src/surf/surf_interface.cpp
b/src/surf/surf_interface.cpp
index
a20ea1b
..
6de2b62
100644
(file)
--- a/
src/surf/surf_interface.cpp
+++ b/
src/surf/surf_interface.cpp
@@
-583,8
+583,7
@@
double Model::shareResourcesLazy(double now)
action->getMaxDuration());
if (min != -1) {
action->getMaxDuration());
if (min != -1) {
- action->heapRemove(p_actionHeap);
- action->heapInsert(p_actionHeap, min, max_dur_flag ? MAX_DURATION : NORMAL);
+ action->heapUpdate(p_actionHeap, min, max_dur_flag ? MAX_DURATION : NORMAL);
XBT_DEBUG("Insert at heap action(%p) min %f now %f", action, min,
now);
} else DIE_IMPOSSIBLE;
XBT_DEBUG("Insert at heap action(%p) min %f now %f", action, min,
now);
} else DIE_IMPOSSIBLE;
@@
-1008,6
+1007,16
@@
void Action::heapRemove(xbt_heap_t heap)
}
}
}
}
+void Action::heapUpdate(xbt_heap_t heap, double key, enum heap_action_type hat)
+{
+ m_hat = hat;
+ if (m_indexHeap >= 0) {
+ xbt_heap_update(heap, m_indexHeap, key);
+ }else{
+ xbt_heap_push(heap, this, key);
+ }
+}
+
/* added to manage the communication action's heap */
void surf_action_lmm_update_index_heap(void *action, int i) {
((ActionPtr)action)->updateIndexHeap(i);
/* added to manage the communication action's heap */
void surf_action_lmm_update_index_heap(void *action, int i) {
((ActionPtr)action)->updateIndexHeap(i);