mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-23 05:58:04 +00:00
Merge pull request #9821 from GabyCT/topic/fixts
metrics: Use function definition to have uniformity
This commit is contained in:
commit
461b6e7c93
@ -252,7 +252,7 @@ function init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Computes the average of the data
|
# Computes the average of the data
|
||||||
calc_avg_array() {
|
function calc_avg_array() {
|
||||||
data=("$@")
|
data=("$@")
|
||||||
avg=0
|
avg=0
|
||||||
LSCALE=6
|
LSCALE=6
|
||||||
@ -268,7 +268,7 @@ calc_avg_array() {
|
|||||||
|
|
||||||
|
|
||||||
# Computes the standard deviation of the data
|
# Computes the standard deviation of the data
|
||||||
calc_sd_array() {
|
function calc_sd_array() {
|
||||||
data=("$@")
|
data=("$@")
|
||||||
sum_sqr_n=0
|
sum_sqr_n=0
|
||||||
size="${#data[@]}"
|
size="${#data[@]}"
|
||||||
@ -315,7 +315,7 @@ calc_sd_array() {
|
|||||||
|
|
||||||
# Computes the Coefficient of variation.
|
# Computes the Coefficient of variation.
|
||||||
# The result is given as percentage.
|
# The result is given as percentage.
|
||||||
calc_cov_array() {
|
function calc_cov_array() {
|
||||||
sd=$1
|
sd=$1
|
||||||
mean=$2
|
mean=$2
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ calc_cov_array() {
|
|||||||
|
|
||||||
# Writes a JSON with the statistics results
|
# Writes a JSON with the statistics results
|
||||||
# for each launch time metric
|
# for each launch time metric
|
||||||
write_stats_results() {
|
function write_stats_results() {
|
||||||
size="${#total_result_ds[@]}"
|
size="${#total_result_ds[@]}"
|
||||||
avg_total_result=$(calc_avg_array "${total_result_ds[@]}")
|
avg_total_result=$(calc_avg_array "${total_result_ds[@]}")
|
||||||
avg_to_workload=$(calc_avg_array "${to_workload_ds[@]}")
|
avg_to_workload=$(calc_avg_array "${to_workload_ds[@]}")
|
||||||
@ -396,7 +396,7 @@ EOF
|
|||||||
metrics_json_add_array_element "$json"
|
metrics_json_add_array_element "$json"
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
function help() {
|
||||||
usage=$(cat << EOF
|
usage=$(cat << EOF
|
||||||
Usage: $0 [-h] [options]
|
Usage: $0 [-h] [options]
|
||||||
Description:
|
Description:
|
||||||
@ -412,7 +412,7 @@ EOF
|
|||||||
echo "$usage"
|
echo "$usage"
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
function main() {
|
||||||
local OPTIND
|
local OPTIND
|
||||||
while getopts "dhi:n:s" opt;do
|
while getopts "dhi:n:s" opt;do
|
||||||
case ${opt} in
|
case ${opt} in
|
||||||
|
Loading…
Reference in New Issue
Block a user