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

2016/10/1422:46:10 发表评论

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

内存检测工具

  • 微信扫码赞助
  • weinxin
  • 支付宝赞助
  • weinxin

发表评论

您必须才能发表评论!