This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gprof profiling of multi-threaded Cygwin programs, ver 2


Hi Mark,

On Feb 20 00:16, Mark Geisert wrote:
> Version 2 incorporating review comments of version 1.

I'm afraid we need a v3, two points.

One is, for completeness it would be nice if you could add a
description to the git comment along the lines of your original
comment so we have a description in the log.

The other point is:

> +	/* We copy an undocumented glibc feature: customizing the profiler's
> +	   output file name somewhat, depending on the env var GMON_OUT_PREFIX.
> +	   if GMON_OUT_PREFIX is unspecified, the file's name is "gmon.out".
> +
> +	   if GMON_OUT_PREFIX is specified with at least one character, the
> +	   file's name is computed as "$GMON_OUT_PREFIX.$pid".
> +
> +	   if GMON_OUT_PREFIX is specified but contains no characters, the
> +	   file's name is computed as "gmon.out.$pid".  Cygwin-specific.
> +	*/
> +	if ((prefix = getenv("GMON_OUT_PREFIX")) != NULL) {
> +		char *buf;
> +		long divisor = 100000;	// the power of 10 bigger than PID_MAX
> +		pid_t pid = getpid();
> +		size_t len = strlen(prefix);
> +
> +		if (len == 0)
> +			len = strlen(prefix = filename);
> +		buf = alloca(len + 8);	// allows for '.', 5-digit pid, NUL, +1

I've seen 6 digit PIDs.  In fact, we're not that tight on space here
so we should err on the side of caution and leave room for the entire
possible size of a Windows PID.  That's a LONG, 32 bit, 10 decimal
digits.

Other than that, the patch looks good to me.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]