public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jim Wilson <jimw@sifive.com>
To: heng zhang <byone.heng@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Question about the coverage statistics of Gcov
Date: Wed, 7 Apr 2021 13:35:48 -0700	[thread overview]
Message-ID: <CAFyWVabV4ecaVxkUkh_y5rD2wG5=1tNj5DMJe5-8iSHkKR9+iw@mail.gmail.com> (raw)
In-Reply-To: <85B58B5E-BA94-4FA3-9EF9-BB4F389109A1@gmail.com>

On Tue, Apr 6, 2021 at 8:34 AM heng zhang <byone.heng@gmail.com> wrote:

> As you said, the 8th line has some unexecuted parts, i.e., “ i++ ” so why
> is not the execution time of the 8th line 1*?
>

The process of mapping source lines to object file basic blocks and back
again is very complicated, depends on compiler optimizations and the source
code, and we don't always do a perfect job of it.  The gcov output should
always be considered reasonable estimates.  If you want better answers, try
lowering the optimization level, or adding more newlines to your code so
you have fewer statements on each source line.

Jim

  reply	other threads:[~2021-04-07 20:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02  8:50 heng zhang
2021-04-02 23:15 ` Jim Wilson
2021-04-06 15:34   ` heng zhang
2021-04-07 20:35     ` Jim Wilson [this message]
2021-04-09  5:35       ` heng zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyWVabV4ecaVxkUkh_y5rD2wG5=1tNj5DMJe5-8iSHkKR9+iw@mail.gmail.com' \
    --to=jimw@sifive.com \
    --cc=byone.heng@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).