2012-07-15 3 views
2

가능한 중복 :
gprof reports no time accumulated프로파일 C : 빈 보고서

나는 작은 C 프로그램을 프로파일 링하기 위해 노력하고있어.

나는 컴파일하고는 :

% gcc -std=c99 main.c -Wall -c -pg main.c 
% gcc -Wall -pg main.o 
% ./a.out 

은 그 때 나는 프로파일 보고서를 읽으려고하지만 비어 내가 잘못 뭐하는 거지

% gprof a.out                                         130 ↵ 



call graph profile: 
      The sum of self and descendents is the major sort 
      for this listing. 

      function entries: 

index  the index of the function in the call graph 
      listing, as an aid to locating it (see below). 

%time  the percentage of the total time of the program 
      accounted for by this function and its 
      descendents. 

self  the number of seconds spent in this function 
      itself. 

descendents 
      the number of seconds spent in the descendents of 
      this function on behalf of this function. 

called the number of times this function is called (other 
      than recursive calls). 

self  the number of times this function calls itself 
      recursively. 

name  the name of the function, with an indication of 
      its membership in a cycle, if any. 

index  the index of the function in the call graph 
      listing, as an aid to locating it. 



      parent listings: 

self*  the number of seconds of this function's self time 
      which is due to calls from this parent. 

descendents* 
      the number of seconds of this function's 
      descendent time which is due to calls from this 
      parent. 

called** the number of times this function is called by 
      this parent. This is the numerator of the 
      fraction which divides up the function's time to 
      its parents. 

total* the number of times this function was called by 
      all of its parents. This is the denominator of 
      the propagation fraction. 

parents the name of this parent, with an indication of the 
      parent's membership in a cycle, if any. 

index  the index of this parent in the call graph 
      listing, as an aid in locating it. 



      children listings: 

self*  the number of seconds of this child's self time 
      which is due to being called by this function. 

descendent* 
      the number of seconds of this child's descendent's 
      time which is due to being called by this 
      function. 

called** the number of times this child is called by this 
      function. This is the numerator of the 
      propagation fraction for this child. 

total* the number of times this child is called by all 
      functions. This is the denominator of the 
      propagation fraction. 

children the name of this child, and an indication of its 
      membership in a cycle, if any. 

index  the index of this child in the call graph listing, 
      as an aid to locating it. 



      * these fields are omitted for parents (or 
      children) in the same cycle as the function. If 
      the function (or child) is a member of a cycle, 
      the propagated times and propagation denominator 
      represent the self time and descendent time of the 
      cycle as a whole. 

      ** static-only parents and children are indicated 
      by a call count of 0. 



      cycle listings: 
      the cycle as a whole is listed with the same 
      fields as a function entry. Below it are listed 
      the members of the cycle, and their contributions 
      to the time and call counts of the cycle. 



granularity: each sample hit covers 4 byte(s) no time propagated 

            called/total  parents 
index %time self descendents called+self name  index 
            called/total  children 






flat profile: 

%   the percentage of the total running time of the 
time  program used by this function. 

cumulative a running sum of the number of seconds accounted 
seconds for by this function and those listed above it. 

self  the number of seconds accounted for by this 
seconds function alone. This is the major sort for this 
      listing. 

calls  the number of times this function was invoked, if 
      this function is profiled, else blank. 

self  the average number of milliseconds spent in this 
ms/call function per call, if this function is profiled, 
     else blank. 

total  the average number of milliseconds spent in this 
ms/call function and its descendents per call, if this 
     function is profiled, else blank. 

name  the name of the function. This is the minor sort 
      for this listing. The index shows the location of 
     the function in the gprof listing. If the index is 
     in parenthesis it shows where it would appear in 
     the gprof listing if it were to be printed. 



granularity: each sample hit covers 4 byte(s) no time accumulated 

    % cumulative self    self  total   
time seconds seconds calls ms/call ms/call name  


Index by function name 

?

맥 OS X의

% gcc -v                                           
Using built-in specs. 
Target: i686-apple-darwin11 
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 
Thread model: posix 
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00) 
+0

은 $ gprof gmon.out을 읽고 있습니까? – Aftnix

답변

0

그것은 당신의 작은 C 프로그램은 주로 I/O를 수행하는 것으로 보인다 그것입니까?

2 분의 실행 시간은 99.99 % I/O 일 수 있습니다.

이 사이트에서 누군가가 내부 루프에 printf이라는 작은 프로그램을 작성한 다음 gprof을 실행 한 다음 이와 같은 질문을 게시하는 것이 일반적입니다.

gprof 및 기타 "CPU 프로파일 러"는 I/O에 대해 눈이 멀기 때문에 아무 것도 볼 수없는 것일 수 있습니다.

Check this discussion.