Skip to content

Commit

Permalink
Setting hashmap only on measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneTR committed Jun 13, 2024
1 parent 46a59a2 commit d4efecb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
3 changes: 0 additions & 3 deletions scripts/display_results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ function display_results {
MEASUREMENT_COUNT=${MEASUREMENT_COUNT:-}
WORKFLOW_ID=${WORKFLOW_ID:-}
DASHBOARD_API_BASE=${DASHBOARD_API_BASE:-}
MACHINE_POWER_HASHMAP=${MACHINE_POWER_HASHMAP:-}
MACHINE_POWER_DATA=${MACHINE_POWER_DATA:-}


output="/tmp/eco-ci/output.txt"
output_pr="/tmp/eco-ci/output-pr.txt"
Expand Down
7 changes: 4 additions & 3 deletions scripts/make_measurement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function make_measurement() {
MEASUREMENT_COUNT=${MEASUREMENT_COUNT:-}
WORKFLOW_ID=${WORKFLOW_ID:-}
DASHBOARD_API_BASE=${DASHBOARD_API_BASE:-}
MACHINE_POWER_HASHMAP=${MACHINE_POWER_HASHMAP:-}
MACHINE_POWER_DATA=${MACHINE_POWER_DATA:-}


Expand All @@ -32,10 +31,12 @@ function make_measurement() {
# check wc -l of cpu-util is greater than 0
if [[ $(wc -l < /tmp/eco-ci/cpu-util-temp.txt) -gt 0 ]]; then

if [[ $MACHINE_POWER_HASHMAP == "" ]]; then
if [[ -n "$BASH_VERSION" ]] && (( ${BASH_VERSION:0:1} >= 4 )); then
echo "Using bash mode inference"
source "$(dirname "$0")/../machine-power-data/${MACHINE_POWER_DATA}" # will set cloud_energy_hashmap

while read -r time util; do
echo "$time * ${MACHINE_POWER_HASHMAP[$util]}" | bc -l >> /tmp/eco-ci/energy-step.txt
echo "$time * ${cloud_energy_hashmap[$util]}" | bc -l >> /tmp/eco-ci/energy-step.txt
done < /tmp/eco-ci/cpu-util-temp.txt
else
echo "Using legacy mode inference"
Expand Down
5 changes: 0 additions & 5 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ function initialize {
# call init_variables
source "$(dirname "$0")/vars.sh" cpu_vars
source "$(dirname "$0")/vars.sh" add_var DASHBOARD_API_BASE "https://api.green-coding.io"

if [[ -n "$BASH_VERSION" ]] && (( ${BASH_VERSION:0:1} >= 4 )); then
source "$(dirname "$0")/../machine-power-data/${MACHINE_POWER_DATA}"
source "$(dirname "$0")/vars.sh" add_var MACHINE_POWER_HASHMAP $cloud_energy_hashmap
fi
}


Expand Down

0 comments on commit d4efecb

Please sign in to comment.