xscale_be-gcov.1
来自「Intel ixp425 toolchain」· 1 代码 · 共 454 行 · 第 1/2 页
1
454 行
.PDWrite branch frequencies to the output file, and write branch summaryinfo to the standard output. This option allows you to see how ofteneach branch in your program was taken..Ip "\fB\-c\fR" 4.IX Item "-c".PD 0.Ip "\fB\*(--branch-counts\fR" 4.IX Item "branch-counts".PDWrite branch frequencies as the number of branches taken, rather thanthe percentage of branches taken..Ip "\fB\-n\fR" 4.IX Item "-n".PD 0.Ip "\fB\*(--no-output\fR" 4.IX Item "no-output".PDDo not create the \fBgcov\fR output file..Ip "\fB\-l\fR" 4.IX Item "-l".PD 0.Ip "\fB\*(--long-file-names\fR" 4.IX Item "long-file-names".PDCreate long file names for included source files. For example, if theheader file \fIx.h\fR contains code, and was included in the file\&\fIa.c\fR, then running \fBgcov\fR on the file \fIa.c\fR will producean output file called \fIa.c.x.h.gcov\fR instead of \fIx.h.gcov\fR.This can be useful if \fIx.h\fR is included in multiple source files..Ip "\fB\-f\fR" 4.IX Item "-f".PD 0.Ip "\fB\*(--function-summaries\fR" 4.IX Item "function-summaries".PDOutput summaries for each function in addition to the file level summary..Ip "\fB\-o\fR \fIdirectory\fR" 4.IX Item "-o directory".PD 0.Ip "\fB\*(--object-directory\fR \fIdirectory\fR" 4.IX Item "object-directory directory".PDThe directory where the object files live. Gcov will search for \fI.bb\fR,\&\fI.bbg\fR, and \fI.da\fR files in this directory..PPWhen using \fBgcov\fR, you must first compile your program with twospecial \s-1GCC\s0 options: \fB\-fprofile-arcs \-ftest-coverage\fR.This tells the compiler to generate additional information needed bygcov (basically a flow graph of the program) and also includesadditional code in the object files for generating the extra profilinginformation needed by gcov. These additional files are placed in thedirectory where the source code is located..PPRunning the program will cause profile output to be generated. For eachsource file compiled with \fB\-fprofile-arcs\fR, an accompanying \fI.da\fRfile will be placed in the source directory..PPRunning \fBgcov\fR with your program's source file names as argumentswill now produce a listing of the code along with frequency of executionfor each line. For example, if your program is called \fItmp.c\fR, thisis what you see when you use the basic \fBgcov\fR facility:.PP.Vb 5\& $ gcc -fprofile-arcs -ftest-coverage tmp.c\& $ a.out\& $ gcov tmp.c\& 87.50% of 8 source lines executed in file tmp.c\& Creating tmp.c.gcov..VeThe file \fItmp.c.gcov\fR contains output from \fBgcov\fR.Here is a sample:.PP.Vb 3\& main()\& {\& 1 int i, total;.Ve.Vb 1\& 1 total = 0;.Ve.Vb 2\& 11 for (i = 0; i < 10; i++)\& 10 total += i;.Ve.Vb 5\& 1 if (total != 45)\& ###### printf ("Failure\en");\& else\& 1 printf ("Success\en");\& 1 }.VeWhen you use the \fB\-b\fR option, your output looks like this:.PP.Vb 6\& $ gcov -b tmp.c\& 87.50% of 8 source lines executed in file tmp.c\& 80.00% of 5 branches executed in file tmp.c\& 80.00% of 5 branches taken at least once in file tmp.c\& 50.00% of 2 calls executed in file tmp.c\& Creating tmp.c.gcov..VeHere is a sample of a resulting \fItmp.c.gcov\fR file:.PP.Vb 3\& main()\& {\& 1 int i, total;.Ve.Vb 1\& 1 total = 0;.Ve.Vb 5\& 11 for (i = 0; i < 10; i++)\& branch 0 taken = 91%\& branch 1 taken = 100%\& branch 2 taken = 100%\& 10 total += i;.Ve.Vb 9\& 1 if (total != 45)\& branch 0 taken = 100%\& ###### printf ("Failure\en");\& call 0 never executed\& branch 1 never executed\& else\& 1 printf ("Success\en");\& call 0 returns = 100%\& 1 }.VeFor each basic block, a line is printed after the last line of the basicblock describing the branch or call that ends the basic block. There canbe multiple branches and calls listed for a single source line if thereare multiple basic blocks that end on that line. In this case, thebranches and calls are each given a number. There is no simple way to mapthese branches and calls back to source constructs. In general, though,the lowest numbered branch or call will correspond to the leftmost constructon the source line..PPFor a branch, if it was executed at least once, then a percentageindicating the number of times the branch was taken divided by thenumber of times the branch was executed will be printed. Otherwise, themessage ``never executed'' is printed..PPFor a call, if it was executed at least once, then a percentageindicating the number of times the call returned divided by the numberof times the call was executed will be printed. This will usually be100%, but may be less for functions call \f(CW\*(C`exit\*(C'\fR or \f(CW\*(C`longjmp\*(C'\fR,and thus may not return every time they are called..PPThe execution counts are cumulative. If the example program wereexecuted again without removing the \fI.da\fR file, the count for thenumber of times each line in the source was executed would be added tothe results of the previous \fIrun\fR\|(s). This is potentially useful inseveral ways. For example, it could be used to accumulate data over anumber of program runs as part of a test verification suite, or toprovide more accurate long-term information over a large number ofprogram runs..PPThe data in the \fI.da\fR files is saved immediately before the programexits. For each source file compiled with \fB\-fprofile-arcs\fR, the profilingcode first attempts to read in an existing \fI.da\fR file; if the filedoesn't match the executable (differing number of basic block counts) itwill ignore the contents of the file. It then adds in the new executioncounts and finally writes the data to the file..Sh "Using \fBgcov\fP with \s-1GCC\s0 Optimization".IX Subsection "Using gcov with GCC Optimization"If you plan to use \fBgcov\fR to help optimize your code, you mustfirst compile your program with two special \s-1GCC\s0 options:\&\fB\-fprofile-arcs \-ftest-coverage\fR. Aside from that, you can use anyother \s-1GCC\s0 options; but if you want to prove that every single linein your program was executed, you should not compile with optimizationat the same time. On some machines the optimizer can eliminate somesimple code lines by combining them with other lines. For example, codelike this:.PP.Vb 4\& if (a != b)\& c = 1;\& else\& c = 0;.Vecan be compiled into one instruction on some machines. In this case,there is no way for \fBgcov\fR to calculate separate execution countsfor each line because there isn't separate code for each line. Hencethe \fBgcov\fR output looks like this if you compiled the program withoptimization:.PP.Vb 4\& 100 if (a != b)\& 100 c = 1;\& 100 else\& 100 c = 0;.VeThe output shows that this block of code, combined by optimization,executed 100 times. In one sense this result is correct, because therewas only one instruction representing all four of these lines. However,the output does not indicate how many times the result was 0 and howmany times the result was 1..SH "SEE ALSO".IX Header "SEE ALSO"\&\fIgpl\fR\|(7), \fIgfdl\fR\|(7), \fIfsf-funding\fR\|(7), \fIgcc\fR\|(1) and the Info entry for \fIgcc\fR..SH "COPYRIGHT".IX Header "COPYRIGHT"Copyright (c) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc..PPPermission is granted to copy, distribute and/or modify this documentunder the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 orany later version published by the Free Software Foundation; with theInvariant Sections being ``\s-1GNU\s0 General Public License'' and ``FundingFree Software'', the Front-Cover texts being (a) (see below), and withthe Back-Cover Texts being (b) (see below). A copy of the license isincluded in the \fIgfdl\fR\|(7) man page..PP(a) The \s-1FSF\s0's Front-Cover Text is:.PP.Vb 1\& A GNU Manual.Ve(b) The \s-1FSF\s0's Back-Cover Text is:.PP.Vb 3\& You have freedom to copy and modify this GNU Manual, like GNU\& software. Copies published by the Free Software Foundation raise\& funds for GNU development..Ve
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?