diff --git a/ci/complexity_measurements/index_complexity.html b/ci/complexity_measurements/index_complexity.html index 71439a4c130f3c58a75d46ce91d84216192cdc1f..78dfe6294f18e5cb99a6c464b55fa83e3cbd6cd9 100755 --- a/ci/complexity_measurements/index_complexity.html +++ b/ci/complexity_measurements/index_complexity.html @@ -561,18 +561,17 @@ function WMOPS_perOP() { } - function memTickFormatter(v, axis) { - var decimals = axis.tickDecimals; - var str_val = ""; - if (v > 1000000) { - str_val = (v / 1000000).toFixed(decimals) + " MB"; - } - else if (v > 1000) { - str_val = (v / 1000).toFixed(decimals) + " kB"; - } - else { - str_val = v.toFixed(decimals) + " B"; - } + function memTickFormatter(val_bytes, axis) { + if (val_bytes == 0) return '0 B'; + + const decimals = 2; + const step = 1000; + const unit = ['B', 'KB', 'MB']; + + var idx = Math.floor(Math.log(val_bytes) / Math.log(step)); + var val_decimal = (val_bytes / Math.pow(step, idx)).toFixed(decimals); + var str_val = val_decimal + " " + unit[idx]; + return str_val; } @@ -629,10 +628,7 @@ function RAM() { var x = item.datapoint[0]; var y = item.datapoint[1]; var text = "" + item.series.id + "
" - text += 'Score: ' + y; - - text += " bytes"; - text += "
"; + text += 'Score: ' + memTickFormatter(y) + " (" + y + " B)" + "
"; if (x > 0) { var thisValue = parseFloat(y); @@ -769,10 +765,7 @@ function ROM() { var x = item.datapoint[0]; var y = item.datapoint[1]; var text = "" + item.series.id + "
" - text += 'Score: ' + y; - - text += " bytes"; - text += "
"; + text += 'Score: ' + memTickFormatter(y) + " (" + y + " B)" + "
"; if (x > 0) { var thisValue = parseFloat(y);