[PATCH] D48538: Make __gcov_flush flush counters for all shared libraries

Marco Castelluccio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 03:21:42 PDT 2018


marco-c updated this revision to Diff 153690.
marco-c added a comment.

I'm using two lists, one for the current dynamic object, one shared between all. We could make the shared one a list of lists, but I feel it would make the code more complex, with no large benefit (if you disagree, I can update the patch).
At writeout, we only write out the current dynamic object counters; at __gcov_flush, we write out and reset counters for all dynamic objects.

A question, why do we need both a writeout function and a flush function? Wouldn't it be OK to just always use flush? When we call writeout, we are atexit, so it doesn't really matter if we clear or not the counters after the writeout, or does it?


https://reviews.llvm.org/D48538

Files:
  lib/profile/GCDAProfiling.c
  test/profile/Inputs/instrprof-dlopen-dlclose-main.c
  test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov
  test/profile/Inputs/instrprof-dlopen-func.c.gcov
  test/profile/Inputs/instrprof-dlopen-func2.c.gcov
  test/profile/Inputs/instrprof-shared-lib.c.gcov
  test/profile/Inputs/instrprof-shared-main-gcov-flush-before-shared-call.c
  test/profile/Inputs/instrprof-shared-main-gcov-flush-before-shared-call.c.gcov
  test/profile/Inputs/instrprof-shared-main-gcov-flush-no-writeout.c
  test/profile/Inputs/instrprof-shared-main-gcov-flush-no-writeout.c.gcov
  test/profile/Inputs/instrprof-shared-main-gcov-flush.c
  test/profile/Inputs/instrprof-shared-main-gcov-flush.c.gcov
  test/profile/instrprof-dlopen-dlclose-gcov.test
  test/profile/instrprof-gcov-two-objects.test
  test/profile/instrprof-shared-gcov-flush-before-shared-call.test
  test/profile/instrprof-shared-gcov-flush-no-writeout.test
  test/profile/instrprof-shared-gcov-flush.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48538.153690.patch
Type: text/x-patch
Size: 22235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180702/8eef71d3/attachment.bin>


More information about the llvm-commits mailing list