|
研究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++ Profiling :http://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/
|
|