From 48266b3287e9c81e29fdc10ea1d2bcbd2bd548b4 Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Tue, 4 Nov 2025 08:03:31 -0700 Subject: [PATCH] 1762268611 --- customscripts/measure_performance | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/customscripts/measure_performance b/customscripts/measure_performance index e24c05e..aaeadd3 100644 --- a/customscripts/measure_performance +++ b/customscripts/measure_performance @@ -5,6 +5,8 @@ ## measure_performance "my_command -with -args" # todo: calculate human readable sizes for mem, r and w +# todo: loop through list of commands supplied by a file +## output da actual log for dis one ig lmao idk cmd="$@" # da command as a string or as args start_date=$(date) @@ -31,10 +33,10 @@ end_unixmicroseconds=$(date +"%s%6N") # get dis fast for accuracy duration_microseconds=$(($end_unixmicroseconds - $start_unixmicroseconds)) ## seconds duration_seconds=$(($duration_microseconds / 1000000)) # seconds = microseconds / 1,000,000 - -# remove lines starting with # (comments), empty lines, and those starting with Linux so its a pure csv -# then squash spaces and replace with commas -# them awk by delimiter comma to output +# parse da fiel +## remove lines starting with # (comments), empty lines, and those starting with Linux so its a pure csv +## then squash spaces and replace with commas +## them awk by delimiter comma to output cat "$logfile" | sed '/^#\|^$\|^Linux/d' | tr -s ' ' ',' | awk -F, '{ cpup += $8; memk += $13; memp += $14; rkbs += $15; wkbs += $15 } END { print "\nCPU:",cpup/NR,"\nMemory Usage (KiB):",memk/NR,"\nMemory Usage %:",memp/NR,"\nKiB Read Per Second:",rkbs/NR,"\nKiB Written Per Second:",wkbs/NR }' #$1,$3,$8,$13,$14,$15,$16,$17 }' # add footer echo -e "Duration Seconds: $duration_seconds\nDuration Microseconds: $duration_microseconds\nReturn Code: $ret" \ No newline at end of file