public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Support for ITIMER_PROF?
@ 2015-06-22 12:05 Ken Brown
  2015-06-22 13:25 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Brown @ 2015-06-22 12:05 UTC (permalink / raw)
  To: cygwin

According to the Cygwin API documentation 
(https://cygwin.com/cygwin-api/std-notes.html), "getitimer and setitimer only 
support ITIMER_REAL for now."  I'm wondering whether there's any chance that 
support for ITIMER_PROF might be added.  I have no idea what the obstacles are.

My reason for asking is that emacs has a CPU profiling function, which doesn't 
work on Cygwin because it relies on ITIMER_PROF.  (There's an alternative 
implementation, but it requires timer_getoverrun, also not available in Cygwin.)

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Support for ITIMER_PROF?
  2015-06-22 12:05 Support for ITIMER_PROF? Ken Brown
@ 2015-06-22 13:25 ` Corinna Vinschen
  2015-06-22 21:07   ` Ken Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2015-06-22 13:25 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

On Jun 22 08:05, Ken Brown wrote:
> According to the Cygwin API documentation
> (https://cygwin.com/cygwin-api/std-notes.html), "getitimer and setitimer
> only support ITIMER_REAL for now."  I'm wondering whether there's any chance
> that support for ITIMER_PROF might be added.  I have no idea what the
> obstacles are.
> 
> My reason for asking is that emacs has a CPU profiling function, which
> doesn't work on Cygwin because it relies on ITIMER_PROF.  (There's an
> alternative implementation, but it requires timer_getoverrun, also not
> available in Cygwin.)

Both very tricky.  Given the description of timer_getoverrun and how
this stuff is implemented in Cygwin, you might get away with

  #ifdef __CYGWIN__
  #define timer_getoverrun(x)	0
  #endif

indepedently of using SIGEV_SIGNAL or SIGEV_THREAD.


Corinna

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

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Support for ITIMER_PROF?
  2015-06-22 13:25 ` Corinna Vinschen
@ 2015-06-22 21:07   ` Ken Brown
  2015-06-23  8:43     ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Brown @ 2015-06-22 21:07 UTC (permalink / raw)
  To: cygwin

On 6/22/2015 9:25 AM, Corinna Vinschen wrote:
> On Jun 22 08:05, Ken Brown wrote:
>> According to the Cygwin API documentation
>> (https://cygwin.com/cygwin-api/std-notes.html), "getitimer and setitimer
>> only support ITIMER_REAL for now."  I'm wondering whether there's any chance
>> that support for ITIMER_PROF might be added.  I have no idea what the
>> obstacles are.
>>
>> My reason for asking is that emacs has a CPU profiling function, which
>> doesn't work on Cygwin because it relies on ITIMER_PROF.  (There's an
>> alternative implementation, but it requires timer_getoverrun, also not
>> available in Cygwin.)
>
> Both very tricky.  Given the description of timer_getoverrun and how
> this stuff is implemented in Cygwin, you might get away with
>
>    #ifdef __CYGWIN__
>    #define timer_getoverrun(x)	0
>    #endif
>
> indepedently of using SIGEV_SIGNAL or SIGEV_THREAD.

This seems to work.  Thanks!

One question: It seems that SIGEV_SIGNAL and friends are defined as macros on 
Linux (or at least on the one Linux distribution I looked at), but on Cygwin 
they're only enum constants.  And emacs expects them to be defined as macros. 
Would something like the following be reasonable for the sake of compatibility?

--- a/winsup/cygwin/include/cygwin/signal.h
+++ b/winsup/cygwin/include/cygwin/signal.h
@@ -311,6 +311,10 @@ enum
                                            perform notification */
  };

+#define SIGEV_SIGNAL SIGEV_SIGNAL
+#define SIGEV_NONE   SIGEV_NONE
+#define SIGEV_THREAD SIGEV_THREAD
+
  #if __WORDSIZE == 64
  typedef __uint64_t sigset_t;
  #else


Ken
Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Support for ITIMER_PROF?
  2015-06-22 21:07   ` Ken Brown
@ 2015-06-23  8:43     ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2015-06-23  8:43 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1933 bytes --]

On Jun 22 17:07, Ken Brown wrote:
> On 6/22/2015 9:25 AM, Corinna Vinschen wrote:
> >On Jun 22 08:05, Ken Brown wrote:
> >>According to the Cygwin API documentation
> >>(https://cygwin.com/cygwin-api/std-notes.html), "getitimer and setitimer
> >>only support ITIMER_REAL for now."  I'm wondering whether there's any chance
> >>that support for ITIMER_PROF might be added.  I have no idea what the
> >>obstacles are.
> >>
> >>My reason for asking is that emacs has a CPU profiling function, which
> >>doesn't work on Cygwin because it relies on ITIMER_PROF.  (There's an
> >>alternative implementation, but it requires timer_getoverrun, also not
> >>available in Cygwin.)
> >
> >Both very tricky.  Given the description of timer_getoverrun and how
> >this stuff is implemented in Cygwin, you might get away with
> >
> >   #ifdef __CYGWIN__
> >   #define timer_getoverrun(x)	0
> >   #endif
> >
> >indepedently of using SIGEV_SIGNAL or SIGEV_THREAD.
> 
> This seems to work.  Thanks!
> 
> One question: It seems that SIGEV_SIGNAL and friends are defined as macros
> on Linux (or at least on the one Linux distribution I looked at), but on
> Cygwin they're only enum constants.  And emacs expects them to be defined as
> macros. Would something like the following be reasonable for the sake of
> compatibility?
> 
> --- a/winsup/cygwin/include/cygwin/signal.h
> +++ b/winsup/cygwin/include/cygwin/signal.h
> @@ -311,6 +311,10 @@ enum
>                                            perform notification */
>  };
> 
> +#define SIGEV_SIGNAL SIGEV_SIGNAL
> +#define SIGEV_NONE   SIGEV_NONE
> +#define SIGEV_THREAD SIGEV_THREAD
> +
>  #if __WORDSIZE == 64
>  typedef __uint64_t sigset_t;
>  #else

Sure.  I applied the patch.


Thanks,
Corinna

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

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-23  8:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-22 12:05 Support for ITIMER_PROF? Ken Brown
2015-06-22 13:25 ` Corinna Vinschen
2015-06-22 21:07   ` Ken Brown
2015-06-23  8:43     ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).