vmstat 1 will print virtual memory and CPU statistics:
(this is a very busy server with ~97% CPU usage, but fortunately no swapping)
This system info can be captured over a long time with
vmstat -n 1 > vmstat.log
On Linux, CPU and memory info can be obtained with
cat /proc/cpuinfo and
cat /proc/meminfo respectively.