微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Linux-无法运行Google Perf工具Google Profiler

如何解决Linux-无法运行Google Perf工具Google Profiler

我正在尝试运行google-perf工具来查找我的代码(堆分析器)中的泄漏。 我已经安装:

- libgoogle-perftools-dev
- automake
- autoconf
- libtool
- tcmalloc

我用于测试堆分析器的简单代码

#include <iostream>
#include <unistd.h>

int main()
{
        while(true){
                int* p = new int[1000];
                std::cout << "wake" << std::endl;
                sleep(3);
        }
        return 0;
}

我正在使用tcmalloc编译代码

g++ -std=c++17 -ltcmalloc main.cpp -o MyProg

现在,我想使用堆分析器运行程序:

HEAPPROFILE=/test_profiler_output/res MyProg

但是我得到的是:

MyProg: command not found

如何使用heapprofiler运行程序并获取内存使用情况图?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。