c++ - 识别主要页面错误原因

标签 c++ linux administration page-fault

我被要求查看一个用 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++ - 识别主要页面错误原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4267006/

相关文章:

c++ - GLFW 无法创建窗口 : "GLX: Failed to create context: GLXBadFBConfig"

android - 使用 Android 模拟器 "-scale"选项的有损图片

hadoop - INFO org.apache.hadoop.ipc.Client:重试连接到服务器:nn1.hcluster.com/192.168.155.131:9000。已经尝试了0次

version-control - 如果TFS中的文件被别人锁定了怎么办?

linux - 使用自动 yes/ok/... 选项安装 ".run"程序

c++ - sem_open() 错误 : "undefined reference to sem_open()" on linux (Ubuntu 10. 10)

类的 C++ 初学者问题,可能是析构函数

c++ - 如何修复错误 2298 和 2563

c++:为什么调用 foo(X&) 而不是 foo(X&&)?

linux - 在 for 循环 |bash 中为变量赋值时出现问题