c – 识别主要页面错误原因
作者:互联网
我被要求查看用C编写并在Linux上运行的内部应用程序,这些应用程序存在一些困难.
它会定期出现大量主要页面错误(约200k),这会导致挂钟运行时间增加x10,然后在某些运行时它将没有.
我已经尝试隔离代码的不同部分,但在测试时我很难重复页面错误错误.
有没有人有任何关于在主要页面错误中从应用程序/ Linux获取更多信息的建议?我所有的一切都是真的.
解决方法:
您可以考虑在主页上描述的Valgrid:
Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools.
具体而言,Valgrind包含一个名为Massif的工具,手册中给出了以下(释义)概述:
Massif is a heap profiler. It measures how much heap memory your program uses. [..]
Heap profiling can help you reduce the amount of memory your program uses. On modern machines with virtual memory, this provides the following benefits:
It can speed up your program — a smaller program will interact better with your machine’s caches and avoid paging.
If your program uses lots of memory, it will reduce the chance that it exhausts your machine’s swap space.
标签:c-2,linux,administration,page-fault 来源: https://codeday.me/bug/20190630/1341007.html