简体   繁体   中英

How do I get the disk usage (IO) of processes in UNIX?

I need to get the IO usage on the disk of processes in UNIX. I need to get it from another c++ process, better not from unix command lines but from some light c++ library. Also, if you have some nice way to know the throughput of network that goes through a process (again, not via command lines) it will also be great. Can you please recommend something? Thanks

you can use the time command in order to show all sort of I/O statistics. check the formating the output section

what you are looking for will probably be like this:

time -f "Input: %I \noutput: %O" <some-program>

that's command line, but you can embed it in a c++ program. How to run a bash script from C++ program

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM