商务合作加Q:411239339

翻出以前笔记中记录的几个调试工具

浏览:580次阅读
没有评论

共计 960 个字符,预计需要花费 3 分钟才能阅读完成。

1、cflow

cflow 程序打印出一个函数调用树,显示函数之间的调用关系。

[root@localhost writelog]# cflow -b writelog.c 

main() <int main (int argc, char *argv[]) at writelog.c:72>:

    openFile() <FILE *openFile (const char *fileName, const char *mode) at writelog.c:30>:

        fopen()

    writeFile() <int writeFile (FILE *fp, const char *str, int bLog) at writelog.c:44>:

        assert()

        getTime() <int getTime (char *out, int fmt) at writelog.c:11>:

            time()

            localtime()

            sprintf()

        fprintf()

        fflush()

    closeFile() <int closeFile (FILE *fp) at writelog.c:66>:

        fclose()

2、gprof

    gprof 用来查找程序的性能。

    #gcc -pg -o writelog writelog.c

    

Each sample counts as 0.01 seconds.

 no time accumulated

  %   cumulative   self              self     total           

 time   seconds   seconds    calls  Ts/call  Ts/call  name    

  0.00      0.00     0.00        1     0.00     0.00  closeFile

  0.00      0.00     0.00        1     0.00     0.00  getTime

  0.00      0.00     0.00        1     0.00     0.00  openFile

  0.00      0.00     0.00        1     0.00     0.00  writeFile

3、valgrind 

   # valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./test

内存检测工具

正文完
扫码赞助
post-qrcode
 0
果子
版权声明:本站原创文章,由 果子 于2016-10-14发表,共计960字。
转载说明:除特殊说明外本站文章皆由果较瘦原创发布,转载请注明出处。
评论(没有评论)