物探论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 994|回复: 0

[Envi] C++库研究笔记[1] Profile->程序执行时间统计

[复制链接]
发表于 2013-8-12 11:36:59 | 显示全部楼层 |阅读模式
研究nvidia 的cusp 库,可见到这样的代码:[cpp] view plaincopy


  • template <typename Array1,                                                                        
  • 380           typename Array2,                                                                       
  • 381       typename ScalarType>                                                                             
  • 382 void axpy(const Array1& x,                                                                              
  • 383           const Array2& y,                                                                  
  • 384           ScalarType alpha)                                                               
  • 385 {                                                                                                
  • 386     CUSP_PROFILE_SCOPED();                                                                        
  • 387     detail::assert_same_dimensions(x, y);                                                            
  • 388     cusp::blas::detail::axpy(x.begin(), x.end(), y.begin(), alpha);                                 
  • 389 }     

[cpp] view plaincopy


  • <span style="font-family: Arial, Helvetica, sans-serif;">这一行</span>  

[cpp] view plaincopy


  • 386     CUSP_PROFILE_SCOPED();                                                                        

即为时间统计
参考:

主要:High Performance C++ Profilinghttp://floodyberry.wordpress.com ... plusplus-profiling/
clock() 函数相当的严重不准确
Resolution Problems inclock()http://www.guyrutenberg.com/2007/09/10/resolution-problems-in-clock/Profiling Code Using clock_gettime

http://www.guyrutenberg.com/2007 ... sing-clock_gettime/


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|物探论坛 ( 鄂ICP备12002012号 微信号:iwutan )

GMT+8, 2024-4-19 08:18 , Processed in 0.070373 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表