C++ gprof 表示 main 仅使用约 20% 的时间
我尝试使用 gprof 分析我的 C++ 程序。程序本身运行了大约53秒,所以我不明白为什么它说,main只运行了大约8.29秒。对此有何解释?
以下是摘录:
index % time self children called name
<spontaneous>
[2] 20.5 0.00 8.29 main [2]
0.00 8.28 1/1 MPQS::start(std::basic_ofstream<char, std::char_traits<char> >&) [3]
0.00 0.01 1/1 MPQS::MPQS(NTL::ZZ, long) [36]
0.00 0.00 1/1 MPQS::~MPQS() [78]
-----------------------------------------------
0.00 8.28 1/1 main [2]
[3] 20.5 0.00 8.28 1 MPQS::start(std::basic_ofstream<char, std::char_traits<char> >&) [3]
7.15 1.08 801/801 MPQS::sieve() [4]
0.00 0.04 801/801 MPQS::find_smooth_vals() [23]
0.01 0.00 1/1 MPQS::try_solutions(NTL::mat_GF2&) [35]
0.00 0.00 801/801 MPQS::compute_coeffecients() [59]
-----------------------------------------------
7.15 1.08 801/801 MPQS::start(std::basic_ofstream<char, std::char_traits<char> >&) [3]
[4] 20.4 7.15 1.08 801 MPQS::sieve() [4]
1.08 0.00 801/801 MPQS::find_candidates() [9]
I tried profiling my C++ program with gprof. The program itself ran for about 53 seconds, so I dont understand why it says, main only ran for about 8.29 seconds. Any explanation on this?
Here is an excerpt:
index % time self children called name
<spontaneous>
[2] 20.5 0.00 8.29 main [2]
0.00 8.28 1/1 MPQS::start(std::basic_ofstream<char, std::char_traits<char> >&) [3]
0.00 0.01 1/1 MPQS::MPQS(NTL::ZZ, long) [36]
0.00 0.00 1/1 MPQS::~MPQS() [78]
-----------------------------------------------
0.00 8.28 1/1 main [2]
[3] 20.5 0.00 8.28 1 MPQS::start(std::basic_ofstream<char, std::char_traits<char> >&) [3]
7.15 1.08 801/801 MPQS::sieve() [4]
0.00 0.04 801/801 MPQS::find_smooth_vals() [23]
0.01 0.00 1/1 MPQS::try_solutions(NTL::mat_GF2&) [35]
0.00 0.00 801/801 MPQS::compute_coeffecients() [59]
-----------------------------------------------
7.15 1.08 801/801 MPQS::start(std::basic_ofstream<char, std::char_traits<char> >&) [3]
[4] 20.4 7.15 1.08 801 MPQS::sieve() [4]
1.08 0.00 801/801 MPQS::find_candidates() [9]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否将结果打印到控制台? gprof 不计算阻塞时间。 请参阅此内容。
Were you printing results to the console? gprof doesn't count blocked time. See this.