we use api
int getrusage(int who, struct rusage *usage);
in Linux to calculate time in our code.
We use constant RUSAGE_THREAD as argument in this api for the calling thread. As documented on the manual page RUSAGE_THREAD was introduced since Linux 2.6.26.
we also compile our code using cywin64 gcc4.8.2 in cygwin environment. I have checked the header /usr/include/sys/resource.h in C:/cygwin64/ and I can't seem to find RUSAGE_THREAD defined there, it only has RUSAGE_SELF and RUSAGE_CHILDREN defined. I am using cygwin64 (CYGWIN_NT-6.2 1.7.29(0.272/5/3) 2014-04-07 13:46 x86_64 Cygwin). I also tried to look into latest cygwin versions and can't seem to find it there as well. So my question is, does cygwin support RUSAGE_THREAD ? If not then are there any plans to add this support ?
Thanks in advance.
It is not, mainly as it is not part of the POSIX standard
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_resource.h.html
The <sys/resource.h> header shall define the following symbolic constants as possible values of the who parameter of getrusage():
RUSAGE_SELF
Returns information about the current process.
RUSAGE_CHILDREN
Returns information about children of the current process.
In general to add any functionality to Cygwin, two basic principles apply:
https://cygwin.com/acronyms/#SHTDI
https://cygwin.com/acronyms/#PTC
The cygwin and the cygwin-developers mailing list are good place to ask if you are planning to contribute
https://cygwin.com/lists.html