I demonstrated the software-general Linux technology-Linux programming and kernel information. The following is a detailed description. Now, this software can be used to show the overall running status of a program, CPU and memory usage during the running process. I have considered tracking the running status of a single process, but the problem is that it is likely that a multi-threaded program makes it difficult to obtain accurate data during memory statistics. In the memory statistics of proc/pid/statm, linux calculates the memory used by the dynamic link library of processes and so on. It will certainly be computed repeatedly, in this way, data has no practical significance. One method is to write the module and put it directly into the kernel to understand the memory usage; or simply use/proc/meminfo, although it cannot be accurate to each process, however, you can control it through the test environment.
Some improvements in the program found that the windows client experienced a gdi leak, which has been improved. In addition, we plan to list the pid memory and cpu data in the Run status. The cpu is calculated based on the difference between two samples.
My colleagues raised new requirements for the software. How can we combine the cpu usage and memory usage with log so that we can know that cpu usage is 100%, the approximate location when a large amount of memory is occupied.
It was originally two sets of things that had to be mixed up. At first, I did not expect a solution.
When I come back in the evening, I think it can be solved. That is, when the agent software at the embedded end reads data every second, it uses our format to output data to the log at the same time. In the drawing software, the log file is finally read, and corresponding graphics are drawn based on the output memory and cpu values. At the same time, you can remember the position of each point in the file. In this way, the memory, cpu, and file operations are roughly matched.
This method is suitable for post-event analysis. Disadvantage: The program runs quickly and lacks sufficient precision.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service