Maximum memory consumption on linux bash using openssl with aes

Asked

Viewed 49 times

3

#!/bin/sh
SUM = 0
for i in {1..5}
do
t=$((/ usr / bin / time-f '% e' openssl enc -aes-128-ecb -K 1234567890 -in t -out g 1> /dev/null) 2> &1)
SUM = `bc <<<" $ SUM + $ t "`
done
res = bc <<< "scale = 4; $ SUM / 5"
echo $res

The above code shows the average time of the 5 openssl repeats using the AES cipher. Getting the same idea, how can I get the maximum memory consumption?

1 answer

5


Maybe you can do what you want using the command time(1). According to the page of man of the command it supports format strings with specific features to report memory usage:

Memory

%M Maximum Resident set size of the process During its Lifetime, in Kbytes.

%t (Not in tcsh(1). ) Average Resident set size of the process, in Kbytes.

%K Total average (data+stack+text) memory use of the process, in Kbytes.

Anyway I recommend to take a look at the question Unix command to tell how much RAM was used during program run time? (in English) of our friends from Unix & Linux because they do a good job in explaining how the memory works on Linux and explains why it is very difficult (or even impossible) accurately measure what you want.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.