linux中C語言工具

來源:互聯網
上載者:User

 

Gprof---程式分析工具

用gprof對程式進行分析主要有以下三個步驟:

  1. 用編譯器對程式進行編譯,加上-pg參數。
  2. 運行編譯後的程式。
  3. 用gprof命令查看程式的運行時資訊。

例如:

  • 首先,用以下命令進行編譯:

#gcc –o test –pg test.c

  • 然後,運行可執行檔test.

          #./test,

         運行後,在目前的目錄下將產生一個檔案gmon.out,這就是gprof產生的檔案,儲存有程式運行期間函數調用等資訊。

  • 最後,用gprof命令查看gmon.out儲存的資訊:

#gprof test gmon.out –b

其他工具
indent c程式美化器,在源檔案中運行這個過濾器,可以使源檔案有標準的布局和縮排格式。
dump -Lv 列印動態連結資訊
time 顯示程式所使用的實際時間和CPU時間
nm 列印目標檔案的符號表
prof 顯示每個程式所消耗時間的百分比
ranlib Generate an index to speed access to archives
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.