简体   繁体   中英

Measure CPU Usage (in Cores) and Memory Usage of Compiled Programs

I have two programs, one in go and one in python that I am trying to characterize. For this, I'd like to measure the CPU usage and Memory Usage by regularly measuring the amounts consumed by the two programs at regular intervals (say, every 0.1 seconds) for some given amount of time. I have been looking everywhere for any sort of solution to this problem, but I can't find any.

Does a good solution to this exist? If so, what?

You can also try Check server load with top, htop, iotop.

For my particular case, the best choice is to instrument the each of the programs for something like Prometheus. Then I can scrape the data at regular intervals to get what I am looking for.

In this case, I would follow off of something like: https://prometheus.io/docs/guides/go-application/

Or: https://linuxhint.com/monitor-python-applications-prometheus/

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