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.

  • I am using ubuntu – ruslan jankurazov Nov 23 '18 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](https://unix.stackexchange.com/a/414770/90751) suggests several tools that should suit your needs. – JigglyNaga Nov 23 '18 at 12:02
  • psrecord still use intervals(read from docs) – ruslan jankurazov Nov 23 '18 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 Nov 23 '18 at 17:06
  • I would suggest you to look at profiling tools as `memusage` (for memory, usually part of `glibc`) or `perf` [website](https://perf.wiki.kernel.org/). These tools intercept system events/calls, so they don't suffer from the usual limitations of those based on polling. – fra-san Nov 23 '18 at 18:05
  • 1
    There is also [How to measure on Linux the peak memory of an application after has ended](https://unix.stackexchange.com/questions/77370/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](https://unix.stackexchange.com/questions/18841/measuring-ram-usage-of-a-program/192063). 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. – maxschlepzig Nov 24 '18 at 12:44

0 Answers0