Re: is it safe to generate profiles from multiple concurrent processes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I would like to change this code
------
#include <fstream>
int main () {
 std::fstream fs;
fs.open ("test.txt", std::fstream::in | std::fstream::out | std::fstream::app);
 fs << " more lorem ipsum";
 fs.close();
 return 0;
}
-------
To look like this
#include <fstream>
int main () {
 using my_read = std::fstream::in; //<== Error: expected type-specifier
 std::fstream fs;
 fs.open ("test.txt", my_read | std::fstream::out; | std::fstream::app);
 fs << " more lorem ipsum";
 fs.close();
 return 0;
}

What am I doing wrong?

-----Original Message----- From: Markus Trippelsdorf
Sent: Wednesday, June 25, 2014 7:59 AM
To: Vincenzo Innocente
Cc: gcc-help@xxxxxxxxxxx
Subject: Re: is it safe to generate profiles from multiple concurrent processes?

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





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux