I need to test huge amount of applications that will run mostly about 100ms to 1s(pretty fast). I need to measure max memory usage and cpu time on each of them. because they fast I can't just check every second so I need something better.
Still this answer dont suits me, because they use interval method. I found very inefficient one, bin-search max memory limit until program crash. this Method might take up to 30 seconds to test one program.
psrecord
lets you specify the interval as a floating point number, ie. fractions of seconds, and defaults to "as often as possible". But complete, non-polled memory tracking (eg. with valgrind) is going to take much longer than the original, untraced process; you will need different tools to measure cpu time and mem usage separately./usr/bin/time -v
that shows max memory usage. And: Measuring RAM usage of a program. Thus, an option is to just ask about the max-CPU part, although when a program just runs 100ms, I assume whatever CPU usage, start/exit overhead outweighs it.