From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13369 invoked by alias); 25 Jun 2014 11:59:39 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 13355 invoked by uid 89); 25 Jun 2014 11:59:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=BAYES_00,KAM_MXURI,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mail.ud10.udmedia.de Received: from ud10.udmedia.de (HELO mail.ud10.udmedia.de) (194.117.254.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 25 Jun 2014 11:59:36 +0000 Received: (qmail 26170 invoked from network); 25 Jun 2014 13:59:33 +0200 Received: from unknown (HELO x4) (ud10?360p3@91.64.99.187) by mail.ud10.udmedia.de with ESMTPSA (DHE-RSA-AES256-SHA encrypted, authenticated); 25 Jun 2014 13:59:33 +0200 Date: Wed, 25 Jun 2014 12:58:00 -0000 From: Markus Trippelsdorf To: Vincenzo Innocente Cc: gcc-help@gcc.gnu.org Subject: Re: is it safe to generate profiles from multiple concurrent processes? Message-ID: <20140625115932.GA294@x4> References: <3D1DD18C-D9D8-4135-9CB5-4E3CDACBF0F1@gmail.com> <0540A5C9-F12F-467F-AB10-D1759A4727D2@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0540A5C9-F12F-467F-AB10-D1759A4727D2@gmail.com> X-SW-Source: 2014-06/txt/msg00116.txt.bz2 On 2014.06.25 at 11:35 +0200, Vincenzo Innocente wrote: > I have built a library with -fprofile-generate. Now I want to > generate profiles using various applications that link that library. > > My understanding is that it is safe to run a multi-thread process to > populate the profiles. > It is unclear to me if one can safely run multiple processes concurrently. > > is there any risk of corruption or overwriting of the various "gcda” > files if different processes attempt to write on them? If safe I can > easily speed up the generation of profiles by orders of magnitude. The gcda files are accessed by proper locks, so you should be save. (See gcc/gcov-io.c). -- Markus