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
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git]
/
src
/
surf
/
cpu_ti.cpp
diff --git
a/src/surf/cpu_ti.cpp
b/src/surf/cpu_ti.cpp
index
1b3cec3
..
fc07dd5
100644
(file)
--- a/
src/surf/cpu_ti.cpp
+++ b/
src/surf/cpu_ti.cpp
@@
-1,3
+1,9
@@
+/* Copyright (c) 2013-2014. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include "cpu_ti.hpp"
#include "trace_mgr_private.h"
#include "xbt/heap.h"
#include "cpu_ti.hpp"
#include "trace_mgr_private.h"
#include "xbt/heap.h"
@@
-312,7
+318,7
@@
CpuTiTgmr::CpuTiTgmr(tmgr_trace_t power_trace, double value)
if (!power_trace) {
m_type = TRACE_FIXED;
m_value = value;
if (!power_trace) {
m_type = TRACE_FIXED;
m_value = value;
- XBT_DEBUG("No availability trace. Constant value = %
l
f", value);
+ XBT_DEBUG("No availability trace. Constant value = %f", value);
return;
}
return;
}
@@
-335,7
+341,7
@@
CpuTiTgmr::CpuTiTgmr(tmgr_trace_t power_trace, double value)
m_lastTime = total_time;
m_total = p_trace->integrateSimple(0, total_time);
m_lastTime = total_time;
m_total = p_trace->integrateSimple(0, total_time);
- XBT_DEBUG("Total integral %
lf, last_time %l
f ",
+ XBT_DEBUG("Total integral %
f, last_time %
f ",
m_total, m_lastTime);
}
m_total, m_lastTime);
}
@@
-462,11
+468,6
@@
CpuTiPtr CpuTiModel::createResource(const char *name,
return cpu;
}
return cpu;
}
-CpuTiActionPtr CpuTiModel::createAction(double /*cost*/, bool /*failed*/)
-{
- return NULL;//new CpuTiAction(this, cost, failed);
-}
-
double CpuTiModel::shareResources(double now)
{
void *_cpu, *_cpu_next;
double CpuTiModel::shareResources(double now)
{
void *_cpu, *_cpu_next;
@@
-567,13
+568,13
@@
CpuTi::CpuTi(CpuTiModelPtr model, const char *name, xbt_dynar_t powerPeak,
: Cpu(model, name, properties, core, 0, powerScale)
{
p_powerEvent = NULL;
: Cpu(model, name, properties, core, 0, powerScale)
{
p_powerEvent = NULL;
-
m_stateCurrent = stateInitial
;
+
setState(stateInitial)
;
m_powerScale = powerScale;
m_core = core;
tmgr_trace_t empty_trace;
s_tmgr_event_t val;
xbt_assert(core==1,"Multi-core not handled with this model yet");
m_powerScale = powerScale;
m_core = core;
tmgr_trace_t empty_trace;
s_tmgr_event_t val;
xbt_assert(core==1,"Multi-core not handled with this model yet");
- XBT_DEBUG("power scale %
l
f", powerScale);
+ XBT_DEBUG("power scale %f", powerScale);
p_availTrace = new CpuTiTgmr(powerTrace, powerScale);
CpuTiActionPtr action = NULL;
p_availTrace = new CpuTiTgmr(powerTrace, powerScale);
CpuTiActionPtr action = NULL;
@@
-620,7
+621,7
@@
void CpuTi::updateState(tmgr_trace_event_t event_type,
CpuTiTgmrPtr trace;
s_tmgr_event_t val;
CpuTiTgmrPtr trace;
s_tmgr_event_t val;
- XBT_DEBUG("Finish trace date: %f value %
l
f date %f", surf_get_clock(),
+ XBT_DEBUG("Finish trace date: %f value %f date %f", surf_get_clock(),
value, date);
/* update remaining of actions and put in modified cpu swag */
updateRemainingAmount(date);
value, date);
/* update remaining of actions and put in modified cpu swag */
updateRemainingAmount(date);
@@
-643,11
+644,11
@@
void CpuTi::updateState(tmgr_trace_event_t event_type,
} else if (event_type == p_stateEvent) {
if (value > 0) {
} else if (event_type == p_stateEvent) {
if (value > 0) {
- if(
m_stateCurrent
== SURF_RESOURCE_OFF)
+ if(
getState()
== SURF_RESOURCE_OFF)
xbt_dynar_push_as(host_that_restart, char*, (char *)getName());
xbt_dynar_push_as(host_that_restart, char*, (char *)getName());
-
m_stateCurrent = SURF_RESOURCE_ON
;
+
setState(SURF_RESOURCE_ON)
;
} else {
} else {
-
m_stateCurrent = SURF_RESOURCE_OFF
;
+
setState(SURF_RESOURCE_OFF)
;
/* put all action running on cpu to failed */
xbt_swag_foreach(_action, p_actionSet) {
/* put all action running on cpu to failed */
xbt_swag_foreach(_action, p_actionSet) {
@@
-822,7
+823,7
@@
void CpuTi::updateRemainingAmount(double now)
CpuActionPtr CpuTi::execute(double size)
{
XBT_IN("(%s,%g)", getName(), size);
CpuActionPtr CpuTi::execute(double size)
{
XBT_IN("(%s,%g)", getName(), size);
- CpuTiActionPtr action = new CpuTiAction(static_cast<CpuTiModelPtr>(getModel()), size,
m_stateCurrent
!= SURF_RESOURCE_ON, this);
+ CpuTiActionPtr action = new CpuTiAction(static_cast<CpuTiModelPtr>(getModel()), size,
getState()
!= SURF_RESOURCE_ON, this);
xbt_swag_insert(action, p_actionSet);
xbt_swag_insert(action, p_actionSet);
@@
-837,7
+838,7
@@
CpuActionPtr CpuTi::sleep(double duration)
duration = MAX(duration, MAXMIN_PRECISION);
XBT_IN("(%s,%g)", getName(), duration);
duration = MAX(duration, MAXMIN_PRECISION);
XBT_IN("(%s,%g)", getName(), duration);
- CpuTiActionPtr action = new CpuTiAction(static_cast<CpuTiModelPtr>(getModel()), 1.0,
m_stateCurrent
!= SURF_RESOURCE_ON, this);
+ CpuTiActionPtr action = new CpuTiAction(static_cast<CpuTiModelPtr>(getModel()), 1.0,
getState()
!= SURF_RESOURCE_ON, this);
action->m_maxDuration = duration;
action->m_suspended = 2;
action->m_maxDuration = duration;
action->m_suspended = 2;