我正在尝试使用gprof来分析我正在开发的一些数字代码,但是gprof似乎无法从我的程序中收集数据.这是我的命令行:
g++ -Wall -O3 -g -pg -o fftw_test fftw_test.cpp -lfftw3 -lfftw3_threads -lm && ./fftw_test
Run Code Online (Sandbox Code Playgroud)
gmon.out文件已创建,但似乎没有数据.当我跑
gprof -b fftw_test gmon.out > gprof.out
Run Code Online (Sandbox Code Playgroud)
我得到的只是
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
Call graph
granularity: each sample hit covers 2 byte(s) no time propagated
index % time self children called name
Index by function name
Run Code Online (Sandbox Code Playgroud)
任何见解?
代码做了很多东西,它不只是调用FFTW例程.它具有计算某些复系数的函数,通过这些系数乘以输入数据的函数,等等.
编辑:包括示例代码和结果.
#include <cstdlib>
#include <ctime>
int main()
{
std::srand( std::time( 0 ) ); …Run Code Online (Sandbox Code Playgroud)