我有一个简单的C程序如下所示
main(int argc, char *argv[])
{
/* Calling read function to character device driver*/
int fd = fopen("MyCharDevice",0);
/*write call to device and further code*/
return 0;
}现在,当我使用gprof对其进行分析时,我没有时间使用main()函数本身。
$ gprof -b -a a.out > analysis.txt我在那里调用我的char设备(我需要对它进行分析)。我尝试将与调用设备驱动程序相对应的代码放在其他函数中,但是我得到了相同的东西。
analysis.txt的内容如下:
Flat profile:
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 3 0.00 0.00 __gmon_start__
Call graph
granularity: each sample hit covers 4 byte(s) no time propagated
index % time self children called name
0.00 0.00 3/3 main [3]
[4] 0.0 0.00 0.00 3 __gmon_start__ [4]
-----------------------------------------------
Index by function name
[4] __gmon_start__我不知道怎么才能得到时间。
My requirement:
实际上,我必须使用一些Linux性能分析工具来比较信号量和R/W信号量的性能。所以我用的是gprof。
发布于 2013-08-12 18:41:17
我是一张卡住的唱片,一遍又一遍地重复
gprof对I/O时间视而不见
gprof对I/O时间视而不见
gprof对I/O时间视而不见
等等
要想知道时间是如何度过的,那就是在它周围放一个循环,
在GDB下暂停并检查堆栈。
在GDB下暂停并检查堆栈。
在GDB下暂停并检查堆栈。
等等
https://stackoverflow.com/questions/18180517
复制相似问题