[CentOS] Measure system resources consumptions by ClamAV File scanner

Thu Jan 3 21:02:50 UTC 2019
Jonathan Billings <billings at negate.org>

On Thu, Jan 03, 2019 at 11:17:03PM +0530, Kaushal Shriyan wrote:
> I am running ClamAV process which is invoked by Cron scheduler around 3:00
> AM ( Midnight) on remote server running CentOS Linux release 7.6.1810
> (Core). Is there a way to measure what was the system resources
> consumptions like CPU, Network, I/O, Memory and Computing load is
> being used and is it possible to find out how much time it took to complete
> the scan?

The easiest thing I can think of would be to prepend the command in
the crontab with /usr/bin/time (or '/usr/bin/time -v' to get the
output to be more verbose).

You'll get something like this (example using 'dd'):

$ /usr/bin/time -v dd if=/dev/urandom of=/dev/null count=500 bs=1M
500+0 records in
500+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 2.19242 s, 239 MB/s
	Command being timed: "dd if=/dev/urandom of=/dev/null count=500 bs=1M"
	User time (seconds): 0.00
	System time (seconds): 2.19
	Percent of CPU this job got: 99%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.19
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 3140
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 0
	Minor (reclaiming a frame) page faults: 342
	Voluntary context switches: 1
	Involuntary context switches: 24
	Swaps: 0
	File system inputs: 0
	File system outputs: 0
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0

Jonathan Billings <billings at negate.org>