Note for Cat System Workshop #11 (2016/10/11)



  • Regions of code
  • SkyPat
    • Define unittest, checking both correctness and performance for you.
    • #include <pat/pat.h>
    • A glace at SkyPat
#include <pat/pat.h>  

// In MathCase, fibonacci_test  
PAT_F(MathCase, fibonacci_test)  
    ASSERT_TRUE(fibonacci(3) == 3);  
    EXPECT_EQ(fibonacci(3), 3);  
    PERFORM {  

// 一個 case 裏面有很多個 tests  
  • Loop-Intensive
    • Benefic Compiler Optimization
    • 比較容易展開
    • 測試效能也比較沒那麼困難,主要就看這段 code 要被執行幾次。
    • Example:
      • GIMP
      • Skymizer
  • Call Intensive
    • Damage Compilter Optimization
    • Difficult to Evaluate
    • 比較難處理
    • 如果產生得出夠完整的 call graph,可能可以做些優化
    • Loop 展開不太有效果
    • 只能試試看能不能減少呼叫
    • 有很多不知道的小瓶頸
    • Example:
      • Browsers (Chrome, Firefox)
      • Editors (Evernote, ...)

  • SkyPat 就是專門用來處理 Call Intensive 這種惱人的效能分析的
  • perf cannot evaluate regions of code.
  • SkyPat integrates perf_event to evaluate regions of code.
  • "Software Task Clock" is still not cycle-accurate
  • Only cycle-accurate timer w/o OS interference.
  • Can evaluate call-intensive program

  • Install:
    • $ git clone


#include <pat/pat.h>  

int main(int argc, char* argv[]) {  
    pat::Test::Initialize(&argc, argv);  

  • SkyPat v3.0 will be released at Oct 30th.
  • Add more Perf events
  • Welcome feedbac and patches

其他的 tool 只能測量 function level,
但 SkyPat 可以測量 block level。


也歡迎使用者、貢獻者開 Issues 跟 Pull Request,

Related links



如果覺得這篇文章對你有幫助, 除了留言讓我知道外, 或許也可以考慮請我喝杯咖啡, 不論金額多寡我都會非常感激且能鼓勵我繼續寫出對你有幫助的文章。

If this blog post happens to be helpful to you, besides of leaving a reply, you may consider buy me a cup of coffee to support me. It would help me write more articles helpful to you in the future and I would really appreciate it.

Related Posts