Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
batsim
batsim
Commits
11df8f4d
Commit
11df8f4d
authored
May 10, 2017
by
Millian Poquet
Browse files
[code] out_energy: add wattmin from SG info
parent
3c14d01c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/export.cpp
View file @
11df8f4d
...
...
@@ -969,7 +969,7 @@ void EnergyConsumptionTracer::set_filename(const string &filename)
xbt_assert
(
_wbuf
==
nullptr
,
"Double call of EnergyConsumptionTracer::set_filename"
);
_wbuf
=
new
WriteBuffer
(
filename
);
_wbuf
->
append_text
(
"time,energy,event_type,epower
\n
"
);
_wbuf
->
append_text
(
"time,energy,event_type,
wattmin,
epower
\n
"
);
}
void
EnergyConsumptionTracer
::
add_job_start
(
double
date
,
int
job_id
)
...
...
@@ -1011,6 +1011,7 @@ long double EnergyConsumptionTracer::add_entry(double date, char event_type)
xbt_assert
(
_wbuf
!=
nullptr
);
long
double
energy
=
_context
->
machines
.
total_consumed_energy
(
_context
);
long
double
wattmin
=
_context
->
machines
.
total_wattmin
(
_context
);
Rational
time_diff
=
(
Rational
)
date
-
_last_entry_date
;
Rational
energy_diff
=
Rational
(
energy
)
-
_last_entry_energy
;
...
...
@@ -1026,11 +1027,11 @@ long double EnergyConsumptionTracer::add_entry(double date, char event_type)
xbt_assert
(
buf
!=
0
,
"Couldn't allocate memory"
);
if
(
epower
!=
-
1
)
nb_printed
=
snprintf
(
buf
,
buf_size
,
"%g,%Lg,%c,%g
\n
"
,
date
,
energy
,
event_type
,
(
double
)
epower
);
nb_printed
=
snprintf
(
buf
,
buf_size
,
"%g,%Lg,%c,%
Lg,%
g
\n
"
,
date
,
energy
,
event_type
,
wattmin
,
(
double
)
epower
);
else
nb_printed
=
snprintf
(
buf
,
buf_size
,
"%g,%Lg,%c,NA
\n
"
,
date
,
energy
,
event_type
);
nb_printed
=
snprintf
(
buf
,
buf_size
,
"%g,%Lg,%c,
%Lg,
NA
\n
"
,
date
,
energy
,
event_type
,
wattmin
);
xbt_assert
(
nb_printed
<
buf_size
-
1
,
"Writing error: buffer has been completely filled, some information might "
"have been lost. Please increase Batsim's output temporary buffers' size"
);
...
...
src/machines.cpp
View file @
11df8f4d
...
...
@@ -313,6 +313,21 @@ long double Machines::total_consumed_energy(const BatsimContext *context) const
return
total_consumed_energy
;
}
long
double
Machines
::
total_wattmin
(
const
BatsimContext
*
context
)
const
{
long
double
total_wattmin
=
0
;
if
(
context
->
energy_used
)
{
for
(
const
Machine
*
m
:
_machines
)
total_wattmin
+=
sg_host_get_wattmin_at
(
m
->
host
,
sg_host_get_pstate
(
m
->
host
));
}
else
total_wattmin
=
-
1
;
return
total_wattmin
;
}
int
Machines
::
nb_machines
()
const
{
return
_machines
.
size
();
...
...
src/machines.hpp
View file @
11df8f4d
...
...
@@ -220,6 +220,13 @@ public:
*/
long
double
total_consumed_energy
(
const
BatsimContext
*
context
)
const
;
/**
* @brief total_wattmin Computes and returns the total wattmin (minimum power) of all the computing machines
* @param[in] context The BatsimContext
* @return The total wattmin (minimum power) of all the computing machines
*/
long
double
total_wattmin
(
const
BatsimContext
*
context
)
const
;
/**
* @brief Returns the number of computing machines
* @return The number of computing machines
...
...
Write
Preview
Supports
Markdown
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