https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97834

--- Comment #4 from Roland Illig <roland.illig at gmx dot de> ---
(In reply to Nathan Sidwell from comment #3)
> gcov has its own buffer.

I wish the above were true.  Using gcov from GCC 5.5.0, ktrace shows that the
actual buffer size is 0.  That's consistent with the setbuf call in gcov_open.

When the instrumented binary is run, this is what happens:

  8998      1 make     CALL  open(0x7affea387b00,0x202,0x1b6)
  8998      1 make     NAMI  "/home/rillig/proj/src/usr.bin/make/arch.gcda"
  8998      1 make     RET   open 3
  8998      1 make     CALL  fcntl(3,F_SETLKW,0x7f7fffc0b6c0)
  8998      1 make     RET   fcntl 0
  8998      1 make     CALL  fcntl(3,F_GETFL,0)
  8998      1 make     RET   fcntl 2
  8998      1 make     CALL  __fstat50(3,0x7f7fffc0b6e0)
  8998      1 make     RET   __fstat50 0
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "a"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "d"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "c"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "g"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "*"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "5"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "0"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "5"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "\M-4"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "\M--"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "\^_"
  8998      1 make     RET   read 1
  8998      1 make     CALL  read(3,0x7affea752497,1)
  8998      1 make     GIO   fd 3 read 1 bytes
       "\M-N"

These syscalls obviously take more time than any form of buffering.

Reply via email to