From cb120df663a28c81ff7faab0e53abce14bb745d8 Mon Sep 17 00:00:00 2001 From: dan-mm Date: Thu, 27 Jul 2023 16:35:47 +0200 Subject: [PATCH 01/11] fixed for broken gitlab output --- scripts/display_results.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/display_results.sh b/scripts/display_results.sh index b28a3624..2bf06d09 100755 --- a/scripts/display_results.sh +++ b/scripts/display_results.sh @@ -51,6 +51,7 @@ function display_results { max_measurement_number=$measurement_number done + ## Used for display in the PR comment body echo "Eco-Ci Output:

" >> $output_multiline echo "Total Energy [Joules]: $total_energy
" >> $output_multiline echo "Total Avg. CPU Utilization: $cpu_avg
" >> $output_multiline @@ -67,6 +68,7 @@ function display_results { echo "--------------------------------
" >> $output_multiline done + ## Used for the main output display for github (step summary) / gitlab (artifacts) if [[ $source == 'github' ]]; then echo "|Label|🖥 avg. CPU utilization [%]|🔋 Total Energy [Joules]|🔌 avg. Power [Watts]|Duration [Seconds]|" >> $output echo "|---|---|---|---|---|" >> $output @@ -80,7 +82,20 @@ function display_results { # echo -e "$final_line" >> $output echo '' >> $output elif [[ $source == 'gitlab' ]]; then - echo $(cat "/tmp/eco-ci/output-short.txt") >> $output + echo "Total Energy [Joules]: $total_energy" >> $output + echo "Total Avg. CPU Utilization: $cpu_avg" >> $output + echo "Total Avg. Power [Watts]: $power_avg" >> $output + echo "Total Duration [seconds]: $time" >> $output + echo "----------------" >> $output + + for (( i=1; i<=$max_measurement_number; i++ )); do + echo "Label $i: $(eval echo \$label_$i)" >> $output + echo "Energy Used [Joules]: $(eval echo \$total_energy_$i)" >> $output + echo "Avg. CPU Utilization: $(eval echo \$cpu_avg_$i)" >> $output + echo "Avg. Power [Watts]: $(eval echo \$power_avg_$i)" >> $output + echo "Duration [seconds]: $(eval echo \$time_$i)" >> $output + echo "----------------" >> $output + done fi From ac2061a1a23ade3d1bde72f9f57129a864bd1c94 Mon Sep 17 00:00:00 2001 From: dan-mm Date: Mon, 31 Jul 2023 21:58:08 +0200 Subject: [PATCH 02/11] gitlab version will now output metrics artifacts; refactor for readability --- eco-ci-gitlab.yml | 21 ++++++- scripts/display_results.sh | 109 ++++++++++++++++++------------------- 2 files changed, 71 insertions(+), 59 deletions(-) diff --git a/eco-ci-gitlab.yml b/eco-ci-gitlab.yml index f04402d8..e50197ef 100644 --- a/eco-ci-gitlab.yml +++ b/eco-ci-gitlab.yml @@ -36,14 +36,29 @@ cache: - echo 'running eco-ci measure script' - | repo=$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME - /tmp/eco-ci/main/scripts/make_measurement.sh -l "$ECO_CI_LABEL" -r $CI_PIPELINE_ID -b $CI_COMMIT_REF_NAME -R $repo -c $CI_COMMIT_SHA -sd $ECO_CI_SEND_DATA -s "gitlab" + /tmp/eco-ci/main/scripts/make_measurement.sh \ + -l "$ECO_CI_LABEL" \ + -r $CI_PIPELINE_ID \ + -b $CI_COMMIT_REF_NAME \ + -R $repo -c $CI_COMMIT_SHA \ + -sd $ECO_CI_SEND_DATA \ + -s "gitlab" \ .display_results: script: - echo 'running eco-ci display script' - | + set -x FORMAT_CLR="\e[44m" && TXT_CLEAR="\e[0m" repo=$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME - /tmp/eco-ci/main/scripts/display_results.sh -b $CI_COMMIT_REF_NAME -db $ECO_CI_DISPLAY_BADGE -r $CI_PIPELINE_ID -R $repo -dt $ECO_CI_DISPLAY_TABLE -dg $ECO_CI_DISPLAY_GRAPH -sd $ECO_CI_SEND_DATA -s "gitlab" + /tmp/eco-ci/main/scripts/display_results.sh \ + -b $CI_COMMIT_REF_NAME \ + -db $ECO_CI_DISPLAY_BADGE \ + -r $CI_PIPELINE_ID \ + -R $repo \ + -dt $ECO_CI_DISPLAY_TABLE \ + -dg $ECO_CI_DISPLAY_GRAPH \ + -sd $ECO_CI_SEND_DATA \ + -s "gitlab" \ - echo -e "$FORMAT_CLR$(cat /tmp/eco-ci/output.txt)$TXT_CLEAR" - - cp /tmp/eco-ci/output.txt ./eco-ci-output.txt + - cp /tmp/eco-ci/output.txt ./eco-ci-output.txt \ No newline at end of file diff --git a/scripts/display_results.sh b/scripts/display_results.sh index 2bf06d09..18448875 100755 --- a/scripts/display_results.sh +++ b/scripts/display_results.sh @@ -28,46 +28,63 @@ function display_results { fi fi - if [[ ${display_table} == 'true' ]]; then - cpu_avg=$(awk '{ total += $1; count++ } END { print total/count }' /tmp/eco-ci/cpu-util-total.txt) - total_energy=$(awk '{sum+=$1} END {print sum}' /tmp/eco-ci/energy-total.txt) - power_avg=$(awk '{ total += $1; count++ } END { print total/count }' /tmp/eco-ci/energy-total.txt) - time=$(($(date +%s) - $(cat /tmp/eco-ci/timer-total.txt))) - - # get series of measurement values - for varname in ${!measurement_@}; do - # Extract the measurement number from the variable name - measurement_number="${varname#*_}" - # Extract the value of the current measurement variable - measurement_value="${!varname}" - - # Use eval to assign individual variables based on the measurement value - eval "label_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $2}')" - eval "cpu_avg_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $4}')" - eval "total_energy_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $6}')" - eval "power_avg_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $8}')" - eval "time_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $10}')" - - max_measurement_number=$measurement_number - done - - ## Used for display in the PR comment body - echo "Eco-Ci Output:

" >> $output_multiline - echo "Total Energy [Joules]: $total_energy
" >> $output_multiline - echo "Total Avg. CPU Utilization: $cpu_avg
" >> $output_multiline - echo "Total Avg. Power [Watts]: $power_avg
" >> $output_multiline - echo "Total Duration [seconds]: $time
" >> $output_multiline + cpu_avg=$(awk '{ total += $1; count++ } END { print total/count }' /tmp/eco-ci/cpu-util-total.txt) + total_energy=$(awk '{sum+=$1} END {print sum}' /tmp/eco-ci/energy-total.txt) + power_avg=$(awk '{ total += $1; count++ } END { print total/count }' /tmp/eco-ci/energy-total.txt) + time=$(($(date +%s) - $(cat /tmp/eco-ci/timer-total.txt))) + + # Get series of measurement values + for varname in ${!measurement_@}; do + # Extract the measurement number from the variable name + measurement_number="${varname#*_}" + # Extract the value of the current measurement variable + measurement_value="${!varname}" + + # Use eval to assign individual variables based on the measurement value + eval "label_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $2}')" + eval "cpu_avg_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $4}')" + eval "total_energy_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $6}')" + eval "power_avg_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $8}')" + eval "time_${measurement_number}=$(echo $measurement_value | awk -F'[,:]' '{print $10}')" + + max_measurement_number=$measurement_number + done + + ## Used for display in the PR comment body + echo "Eco-Ci Output:

" >> $output_multiline + echo "Total Energy [Joules]: $total_energy
" >> $output_multiline + echo "Total Avg. CPU Utilization: $cpu_avg
" >> $output_multiline + echo "Total Avg. Power [Watts]: $power_avg
" >> $output_multiline + echo "Total Duration [seconds]: $time
" >> $output_multiline + echo "--------------------------------
" >> $output_multiline + + for (( i=1; i<=$max_measurement_number; i++ )); do + echo "Label $i: $(eval echo \$label_$i)
" >> $output_multiline + echo "Energy Used [Joules]: $(eval echo \$total_energy_$i)
" >> $output_multiline + echo "Avg. CPU Utilization: $(eval echo \$cpu_avg_$i)
" >> $output_multiline + echo "Avg. Power [Watts]: $(eval echo \$power_avg_$i)
" >> $output_multiline + echo "Duration [seconds]: $(eval echo \$time_$i)
" >> $output_multiline echo "--------------------------------
" >> $output_multiline + done + + ## Gitlab Specific Output + if [[ $source == 'gitlab' ]]; then + echo "\"$CI_JOB_NAME: Energy [Joules]:\" $total_energy" | tee -a $output metrics.txt + echo "\"$CI_JOB_NAME: Avg. CPU Utilization:\" $cpu_avg" | tee -a $output metrics.txt + echo "\"$CI_JOB_NAME: Avg. Power [Watts]:\" $power_avg" | tee -a $output metrics.txt + echo "\"$CI_JOB_NAME: Duration [seconds]:\" $time" | tee -a $output metrics.txt + echo "----------------" >> $output for (( i=1; i<=$max_measurement_number; i++ )); do - echo "Label $i: $(eval echo \$label_$i)
" >> $output_multiline - echo "Energy Used [Joules]: $(eval echo \$total_energy_$i)
" >> $output_multiline - echo "Avg. CPU Utilization: $(eval echo \$cpu_avg_$i)
" >> $output_multiline - echo "Avg. Power [Watts]: $(eval echo \$power_avg_$i)
" >> $output_multiline - echo "Duration [seconds]: $(eval echo \$time_$i)
" >> $output_multiline - echo "--------------------------------
" >> $output_multiline + echo "\"${CI_JOB_NAME}: Label: $(eval echo \$label_$i): Energy Used [Joules]:\" $(eval echo \$total_energy_$i)" | tee -a $output metrics.txt + echo "\"${CI_JOB_NAME}: Label: $(eval echo \$label_$i): Avg. CPU Utilization:\" $(eval echo \$cpu_avg_$i)" | tee -a $output metrics.txt + echo "\"${CI_JOB_NAME}: Label: $(eval echo \$label_$i): Avg. Power [Watts]:\" $(eval echo \$power_avg_$i)" | tee -a $output metrics.txt + echo "\"${CI_JOB_NAME}: Label: $(eval echo \$label_$i): Duration [seconds]:\" $(eval echo \$time_$i)" | tee -a $output metrics.txt + echo "----------------" >> $output done - + fi + + if [[ ${display_table} == 'true' ]]; then ## Used for the main output display for github (step summary) / gitlab (artifacts) if [[ $source == 'github' ]]; then echo "|Label|🖥 avg. CPU utilization [%]|🔋 Total Energy [Joules]|🔌 avg. Power [Watts]|Duration [Seconds]|" >> $output @@ -78,28 +95,8 @@ function display_results { do echo "|$(eval echo \$label_$i)|$(eval echo \$cpu_avg_$i)|$(eval echo \$total_energy_$i)|$(eval echo \$power_avg_$i)|$(eval echo \$time_$i)|" >> $output done - - # echo -e "$final_line" >> $output echo '' >> $output - elif [[ $source == 'gitlab' ]]; then - echo "Total Energy [Joules]: $total_energy" >> $output - echo "Total Avg. CPU Utilization: $cpu_avg" >> $output - echo "Total Avg. Power [Watts]: $power_avg" >> $output - echo "Total Duration [seconds]: $time" >> $output - echo "----------------" >> $output - - for (( i=1; i<=$max_measurement_number; i++ )); do - echo "Label $i: $(eval echo \$label_$i)" >> $output - echo "Energy Used [Joules]: $(eval echo \$total_energy_$i)" >> $output - echo "Avg. CPU Utilization: $(eval echo \$cpu_avg_$i)" >> $output - echo "Avg. Power [Watts]: $(eval echo \$power_avg_$i)" >> $output - echo "Duration [seconds]: $(eval echo \$time_$i)" >> $output - echo "----------------" >> $output - done fi - - - fi if [[ ${display_graph} == 'true' ]]; then From 98c0fbc52c50a37af7aaaa1f306d3785d937a87e Mon Sep 17 00:00:00 2001 From: dan-mm Date: Mon, 31 Jul 2023 22:02:27 +0200 Subject: [PATCH 03/11] update readme --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e8475f7..8dbcefbe 100644 --- a/README.md +++ b/README.md @@ -190,13 +190,15 @@ variables: ECO_CI_SEND_DATA: "false" ``` -Then, for each job you need to export the artifacts: +Then, for each job you need to export the artifacts. We currently export the pipeline data as a regular artifact, as well as make use of Gitlab's [Metric Report](https://docs.gitlab.com/ee/ci/testing/metrics_reports.html) artifact (which we output to the default metrics.txt): ``` artifacts: paths: - eco-ci-output.txt - eco-ci-total-data.json + reports: + metrics: metrics.txt ``` Here is a sample .gitlab-ci.yml example file to illustrate: @@ -228,6 +230,8 @@ test-job: artifacts: paths: - eco-ci-output.txt + reports: + metrics: metrics.txt ``` From cba28a83ac3e00401b25f6db934d7cceddc00874 Mon Sep 17 00:00:00 2001 From: dan-mm Date: Tue, 1 Aug 2023 12:25:34 +0200 Subject: [PATCH 04/11] readability --- eco-ci-gitlab.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eco-ci-gitlab.yml b/eco-ci-gitlab.yml index e50197ef..722fc95d 100644 --- a/eco-ci-gitlab.yml +++ b/eco-ci-gitlab.yml @@ -40,7 +40,8 @@ cache: -l "$ECO_CI_LABEL" \ -r $CI_PIPELINE_ID \ -b $CI_COMMIT_REF_NAME \ - -R $repo -c $CI_COMMIT_SHA \ + -R $repo \ + -c $CI_COMMIT_SHA \ -sd $ECO_CI_SEND_DATA \ -s "gitlab" \ From 08455c37e7ffd3de3e0deefa2f2887a4497919c9 Mon Sep 17 00:00:00 2001 From: dan-mm Date: Tue, 1 Aug 2023 14:30:32 +0200 Subject: [PATCH 05/11] fixed gitlab import in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8dbcefbe..32a44626 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ jobs: To use Eco-CI in your gitlab pipeline, you must first include a reference to the eco-ci-gitlab.yml file as such: ``` include: - remote: 'https://github.com/green-coding-berlin/eco-ci-energy-estimation/blob/main/eco-ci-gitlab.yml' + remote: 'https://raw.githubusercontent.com/green-coding-berlin/eco-ci-energy-estimation/main/eco-ci-gitlab.yml' ``` and you call the various scripts in your pipeline with call like this: @@ -206,7 +206,7 @@ Here is a sample .gitlab-ci.yml example file to illustrate: ``` image: ubuntu:22.04 include: - remote: 'https://github.com/green-coding-berlin/eco-ci-energy-estimation/blob/main/eco-ci-gitlab.yml' + remote: 'https://raw.githubusercontent.com/green-coding-berlin/eco-ci-energy-estimation/main/eco-ci-gitlab.yml' stages: - test From 543b755a7c0bdc329e56c602822a15e308154f3a Mon Sep 17 00:00:00 2001 From: dan-mm Date: Fri, 4 Aug 2023 13:33:47 +0200 Subject: [PATCH 06/11] pr-comment change view --- .github/workflows/test.yml | 1 + scripts/display_results.sh | 40 +++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8aff0715..25df39e9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,3 +49,4 @@ jobs: uses: ./ with: task: display-results + pr-comment: true diff --git a/scripts/display_results.sh b/scripts/display_results.sh index 18448875..b67deaf5 100755 --- a/scripts/display_results.sh +++ b/scripts/display_results.sh @@ -51,21 +51,21 @@ function display_results { done ## Used for display in the PR comment body - echo "Eco-Ci Output:

" >> $output_multiline - echo "Total Energy [Joules]: $total_energy
" >> $output_multiline - echo "Total Avg. CPU Utilization: $cpu_avg
" >> $output_multiline - echo "Total Avg. Power [Watts]: $power_avg
" >> $output_multiline - echo "Total Duration [seconds]: $time
" >> $output_multiline - echo "--------------------------------
" >> $output_multiline - - for (( i=1; i<=$max_measurement_number; i++ )); do - echo "Label $i: $(eval echo \$label_$i)
" >> $output_multiline - echo "Energy Used [Joules]: $(eval echo \$total_energy_$i)
" >> $output_multiline - echo "Avg. CPU Utilization: $(eval echo \$cpu_avg_$i)
" >> $output_multiline - echo "Avg. Power [Watts]: $(eval echo \$power_avg_$i)
" >> $output_multiline - echo "Duration [seconds]: $(eval echo \$time_$i)
" >> $output_multiline - echo "--------------------------------
" >> $output_multiline - done + # echo "Eco-Ci Output:

" >> $output_multiline + # echo "Total Energy [Joules]: $total_energy
" >> $output_multiline + # echo "Total Avg. CPU Utilization: $cpu_avg
" >> $output_multiline + # echo "Total Avg. Power [Watts]: $power_avg
" >> $output_multiline + # echo "Total Duration [seconds]: $time
" >> $output_multiline + # echo "--------------------------------
" >> $output_multiline + + # for (( i=1; i<=$max_measurement_number; i++ )); do + # echo "Label $i: $(eval echo \$label_$i)
" >> $output_multiline + # echo "Energy Used [Joules]: $(eval echo \$total_energy_$i)
" >> $output_multiline + # echo "Avg. CPU Utilization: $(eval echo \$cpu_avg_$i)
" >> $output_multiline + # echo "Avg. Power [Watts]: $(eval echo \$power_avg_$i)
" >> $output_multiline + # echo "Duration [seconds]: $(eval echo \$time_$i)
" >> $output_multiline + # echo "--------------------------------
" >> $output_multiline + # done ## Gitlab Specific Output if [[ $source == 'gitlab' ]]; then @@ -87,15 +87,15 @@ function display_results { if [[ ${display_table} == 'true' ]]; then ## Used for the main output display for github (step summary) / gitlab (artifacts) if [[ $source == 'github' ]]; then - echo "|Label|🖥 avg. CPU utilization [%]|🔋 Total Energy [Joules]|🔌 avg. Power [Watts]|Duration [Seconds]|" >> $output - echo "|---|---|---|---|---|" >> $output - echo "|Total Run|$cpu_avg|$total_energy|$power_avg|$time|" >> $output + echo "|Label|🖥 avg. CPU utilization [%]|🔋 Total Energy [Joules]|🔌 avg. Power [Watts]|Duration [Seconds]|" | tee -a $output $output_multiline + echo "|---|---|---|---|---|" | tee -a $output $output_multiline + echo "|Total Run|$cpu_avg|$total_energy|$power_avg|$time|" | tee -a $output $output_multiline #display measurument lines in table summary for (( i=1; i<=$max_measurement_number; i++ )) do - echo "|$(eval echo \$label_$i)|$(eval echo \$cpu_avg_$i)|$(eval echo \$total_energy_$i)|$(eval echo \$power_avg_$i)|$(eval echo \$time_$i)|" >> $output + echo "|$(eval echo \$label_$i)|$(eval echo \$cpu_avg_$i)|$(eval echo \$total_energy_$i)|$(eval echo \$power_avg_$i)|$(eval echo \$time_$i)|" | tee -a $output $output_multiline done - echo '' >> $output + echo '' | tee -a $output $output_multiline fi fi From 91221ad31fd33ce412b912fe7cdad4c1f6f590a3 Mon Sep 17 00:00:00 2001 From: dan-mm Date: Fri, 4 Aug 2023 13:38:58 +0200 Subject: [PATCH 07/11] add pull-requests:write note to README. updated workflow --- .github/workflows/test.yml | 1 + README.md | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25df39e9..563051a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,7 @@ on: permissions: contents: read actions: read + pull-requests: write jobs: test-action: diff --git a/README.md b/README.md index 32a44626..f4b13fb0 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,9 @@ jobs: - automatically false if send-data is also false - `pr-comment`: (optional) (default: false) - used with display-results - - if on, will post a comment on the PR issue with the Eco-CI results + - if on, will post a comment on the PR issue with the Eco-CI results. only occurs if the triggering event is a pull_request + - remember to set `pull-requests: write` to true in your workflow file + #### Continuing on Errors From 6c48e8b8e8a05aa0f233dc2c78fbbbedfc09128a Mon Sep 17 00:00:00 2001 From: dan-mm Date: Fri, 4 Aug 2023 13:47:38 +0200 Subject: [PATCH 08/11] preserve endline characters --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 693053a3..88e8ad67 100644 --- a/action.yml +++ b/action.yml @@ -151,11 +151,11 @@ runs: env: PR_NUMBER: ${{ github.event.pull_request.number }} run: | - COMMENT=$(cat "/tmp/eco-ci/output-multiline.txt") + COMMENT=$(cat "/tmp/eco-ci/output-multiline.txt" | jq -Rs '.') API_URL="${{ github.api_url }}/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" curl -X POST -H "Authorization: Bearer ${{github.token}}" -d @- $API_URL < Date: Fri, 4 Aug 2023 13:52:30 +0200 Subject: [PATCH 09/11] output graph as well --- action.yml | 2 +- scripts/display_results.sh | 40 ++++++++++++-------------------------- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/action.yml b/action.yml index 88e8ad67..5d8a66ed 100644 --- a/action.yml +++ b/action.yml @@ -151,7 +151,7 @@ runs: env: PR_NUMBER: ${{ github.event.pull_request.number }} run: | - COMMENT=$(cat "/tmp/eco-ci/output-multiline.txt" | jq -Rs '.') + COMMENT=$(cat "/tmp/eco-ci/output-pr.txt" | jq -Rs '.') API_URL="${{ github.api_url }}/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" curl -X POST -H "Authorization: Bearer ${{github.token}}" -d @- $API_URL <
" >> $output_multiline - # echo "Total Energy [Joules]: $total_energy
" >> $output_multiline - # echo "Total Avg. CPU Utilization: $cpu_avg
" >> $output_multiline - # echo "Total Avg. Power [Watts]: $power_avg
" >> $output_multiline - # echo "Total Duration [seconds]: $time
" >> $output_multiline - # echo "--------------------------------
" >> $output_multiline - - # for (( i=1; i<=$max_measurement_number; i++ )); do - # echo "Label $i: $(eval echo \$label_$i)
" >> $output_multiline - # echo "Energy Used [Joules]: $(eval echo \$total_energy_$i)
" >> $output_multiline - # echo "Avg. CPU Utilization: $(eval echo \$cpu_avg_$i)
" >> $output_multiline - # echo "Avg. Power [Watts]: $(eval echo \$power_avg_$i)
" >> $output_multiline - # echo "Duration [seconds]: $(eval echo \$time_$i)
" >> $output_multiline - # echo "--------------------------------
" >> $output_multiline - # done - ## Gitlab Specific Output if [[ $source == 'gitlab' ]]; then echo "\"$CI_JOB_NAME: Energy [Joules]:\" $total_energy" | tee -a $output metrics.txt @@ -87,25 +70,26 @@ function display_results { if [[ ${display_table} == 'true' ]]; then ## Used for the main output display for github (step summary) / gitlab (artifacts) if [[ $source == 'github' ]]; then - echo "|Label|🖥 avg. CPU utilization [%]|🔋 Total Energy [Joules]|🔌 avg. Power [Watts]|Duration [Seconds]|" | tee -a $output $output_multiline - echo "|---|---|---|---|---|" | tee -a $output $output_multiline - echo "|Total Run|$cpu_avg|$total_energy|$power_avg|$time|" | tee -a $output $output_multiline + echo "Eco-CI Output: " >> $output + echo "|Label|🖥 avg. CPU utilization [%]|🔋 Total Energy [Joules]|🔌 avg. Power [Watts]|Duration [Seconds]|" | tee -a $output $output_pr + echo "|---|---|---|---|---|" | tee -a $output $output_pr + echo "|Total Run|$cpu_avg|$total_energy|$power_avg|$time|" | tee -a $output $output_pr #display measurument lines in table summary for (( i=1; i<=$max_measurement_number; i++ )) do - echo "|$(eval echo \$label_$i)|$(eval echo \$cpu_avg_$i)|$(eval echo \$total_energy_$i)|$(eval echo \$power_avg_$i)|$(eval echo \$time_$i)|" | tee -a $output $output_multiline + echo "|$(eval echo \$label_$i)|$(eval echo \$cpu_avg_$i)|$(eval echo \$total_energy_$i)|$(eval echo \$power_avg_$i)|$(eval echo \$time_$i)|" | tee -a $output $output_pr done - echo '' | tee -a $output $output_multiline + echo '' | tee -a $output $output_pr fi fi if [[ ${display_graph} == 'true' ]]; then if [[ $source == 'github' ]]; then - echo '📈 Energy graph:' >> $output - echo '```bash' >> $output - echo ' ' >> $output - cat /tmp/eco-ci/energy-total.txt | /home/runner/go/bin/asciigraph -h 10 -c "Watts over time" >> $output - echo ' ```' >> $output + echo '📈 Energy graph:' | tee -a $output $output_pr + echo '```bash' | tee -a $output $output_pr + echo ' ' | tee -a $output $output_pr + cat /tmp/eco-ci/energy-total.txt | /home/runner/go/bin/asciigraph -h 10 -c "Watts over time" | tee -a $output $output_pr + echo ' ```' | tee -a $output $output_pr elif [[ $source == 'gitlab' ]]; then echo '📈 Energy graph:' >> $output cat /tmp/eco-ci/energy-total.txt | /home/runner/go/bin/asciigraph -h 10 -c "Watts over time" >> $output From 19d408f9f58b635e96a1ba5c993bda7e07c7e731 Mon Sep 17 00:00:00 2001 From: dan-mm Date: Fri, 4 Aug 2023 13:54:45 +0200 Subject: [PATCH 10/11] fixed output line --- scripts/display_results.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/display_results.sh b/scripts/display_results.sh index 8d83ade9..a9998580 100755 --- a/scripts/display_results.sh +++ b/scripts/display_results.sh @@ -70,7 +70,7 @@ function display_results { if [[ ${display_table} == 'true' ]]; then ## Used for the main output display for github (step summary) / gitlab (artifacts) if [[ $source == 'github' ]]; then - echo "Eco-CI Output: " >> $output + echo "Eco-CI Output: " >> $output_pr echo "|Label|🖥 avg. CPU utilization [%]|🔋 Total Energy [Joules]|🔌 avg. Power [Watts]|Duration [Seconds]|" | tee -a $output $output_pr echo "|---|---|---|---|---|" | tee -a $output $output_pr echo "|Total Run|$cpu_avg|$total_energy|$power_avg|$time|" | tee -a $output $output_pr From fc0c4738f6dc095027c84f960a2ffafd07910692 Mon Sep 17 00:00:00 2001 From: dan-mm <33732895+dan-mm@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:24:44 +0200 Subject: [PATCH 11/11] add v2.1 option --- .github/workflows/update-tag.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-tag.yml b/.github/workflows/update-tag.yml index 82264848..2739ed6d 100644 --- a/.github/workflows/update-tag.yml +++ b/.github/workflows/update-tag.yml @@ -9,6 +9,7 @@ on: description: The tag to update required: true options: + - v2.1 - v2 - v1