I have this perl script and I discovered the
pv command and decided to use it to get some feedback into what is going on with the randomness in terms of throughput. After a few tests1 I decided to throttle the command, like so:
perl_commands < /dev/urandom | pv -L 512k | tr -cd SET 5.5MiB 0:00:11 [ 529kiB/s] [ <=> ]
I suspend to ram using
systemctl suspend(Archbang). When I resume, the command still runs and includes the elapsed time since suspend in its dialog but it looks as if the limit I set is no longer enforced, throughput is 2-3MiB/s and CPU is higher - like without a limit. After some time, this subsides and I can see that the limit is still enforced.
For example, if I run the command for only a few seconds it'll take seconds for the throughput to come back to its set limit. On the other hand, generating 815Mb of data during an hour, then suspending for 30 mins, it then takes about 5 mins for the command to return to the limit I had set - and CPU usage is like with no throttling during that time.
So it is not that the limit isn't enforced, it's rather that coming out of suspend to ram seems to impact the throughput in this context. Why and can this behavior be changed?
1. The command uses one CPU core when not throttled. With a limit of 512KiB\s, CPU usage is about 10-15% or less. It takes about 2gb of randomness(and some time) to fill my 80x40 terminal window (depending on SET).