Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
batsim
batsim
Commits
a002068e
Commit
a002068e
authored
Aug 19, 2017
by
Steffen Lackner
Browse files
[code] Send host properties to scheduler on simulation begin
parent
2ddf263b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/machines.cpp
View file @
a002068e
...
...
@@ -84,6 +84,14 @@ void Machines::create_machines(xbt_dynar_t hosts,
machine
->
host
=
host
;
machine
->
jobs_being_computed
=
{};
auto
properties_dict
=
MSG_host_get_properties
(
machine
->
host
);
xbt_dict_cursor_t
cursor
=
nullptr
;
char
*
prop_key
=
nullptr
;
char
*
prop_value
=
nullptr
;
xbt_dict_foreach
(
properties_dict
,
cursor
,
prop_key
,
prop_value
)
{
machine
->
properties
[
string
(
prop_key
)]
=
string
(
prop_value
);
}
if
(
context
->
energy_used
)
{
int
nb_pstates
=
MSG_host_get_nb_pstates
(
machine
->
host
);
...
...
src/machines.hpp
View file @
a002068e
...
...
@@ -62,6 +62,8 @@ struct Machine
Rational
last_state_change_date
=
0
;
//!< The time at which the last state change has been done
std
::
map
<
MachineState
,
Rational
>
time_spent_in_each_state
;
//!< The cumulated time of the machine in each MachineState
std
::
map
<
std
::
string
,
std
::
string
>
properties
;
//!< Properties defined in the platform file
/**
* @brief Returns whether the Machine has the given power state
...
...
src/protocol.cpp
View file @
a002068e
...
...
@@ -74,7 +74,7 @@ void JsonProtocolWriter::append_simulation_begins(Machines & machines,
data
.
AddMember
(
"resources_data"
,
Value
().
CopyFrom
(
resources
,
_alloc
),
_alloc
);
if
(
machines
.
has_hpst_machine
())
{
data
.
AddMember
(
"
lc
st_host"
,
machine_to_json_value
(
*
machines
.
hpst_machine
()),
_alloc
);
data
.
AddMember
(
"
hp
st_host"
,
machine_to_json_value
(
*
machines
.
hpst_machine
()),
_alloc
);
}
if
(
machines
.
has_pfs_machine
())
{
...
...
@@ -96,6 +96,14 @@ Value JsonProtocolWriter::machine_to_json_value(const Machine & machine)
machine_doc
.
AddMember
(
"name"
,
Value
().
SetString
(
machine
.
name
.
c_str
(),
_alloc
),
_alloc
);
machine_doc
.
AddMember
(
"state"
,
Value
().
SetString
(
machine_state_to_string
(
machine
.
state
).
c_str
(),
_alloc
),
_alloc
);
Value
properties
(
rapidjson
::
kObjectType
);
for
(
auto
const
&
entry
:
machine
.
properties
)
{
rapidjson
::
Value
key
(
entry
.
first
.
c_str
(),
_alloc
);
rapidjson
::
Value
value
(
entry
.
second
.
c_str
(),
_alloc
);
properties
.
AddMember
(
key
,
value
,
_alloc
);
}
machine_doc
.
AddMember
(
"properties"
,
properties
,
_alloc
);
return
machine_doc
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment