busybox

How to enable the ps -ux option on busybox?


I have stripped down busybox for my embedded linux. Currently the busybox supports only ps -w option.

I need to sample an application for its CPU and memory usage and the sample should be at least 5 per sec. The top command gives 1 sample per sec.

I am currently using ps -ux to get the CPU and memory usage for this particular process and using vmstat and meminfo to get the overall CPU and memory usage. I am straightaway redirecting the info obtained from "ps -ux", "meminfo", "vmstat" to a file and later on I will parse this file to see the trend for this particular process with respect to overall CPU and Memory Usage that's how I am getting 3-5 samples per second.

The problem is I am not able to enable the "ps -ux" on my busybox. How to enable the ps -ux option on busybox which has a stripped down linux version?


Solution

  • The only solution I see here is to build a needed version of ps from source code. Of course, do not forget that you need to cross-compile it as it's for embedded system that I assume runs on ARM or other non x86 architecture. After that simply replace binary on your embedded system with the newly built one (don't forget backup, just in case).