1

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.

6
  • I am using ubuntu Commented Nov 23, 2018 at 10:29
  • The accepted answer for the proposed duplicate uses "top", which doesn't help for your apps that exit quickly, but one of the other answers suggests several tools that should suit your needs.
    – JigglyNaga
    Commented Nov 23, 2018 at 12:02
  • psrecord still use intervals(read from docs) Commented Nov 23, 2018 at 16:46
  • 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.
    – JigglyNaga
    Commented Nov 23, 2018 at 17:06
  • 1
    There is also How to measure on Linux the peak memory of an application after has ended which e.g. mentions /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. Commented Nov 24, 2018 at 12:44

0

Browse other questions tagged .