From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin" <cygwin@cygwin.com>
To: "'cygwin@cygwin.com'" <cygwin@cygwin.com>
Subject: getpriority() and top display for priority is inconsistent
Date: Tue, 06 Aug 2019 18:54:00 -0000 [thread overview]
Message-ID: <BL0PR0901MB4308798C7E132A9D569FB9AAA5D50@BL0PR0901MB4308.namprd09.prod.outlook.com> (raw)
I have noticed a discrepancy between the process priority shown by "top" vs. what getpriority() returns.
I'm using the procps-based "top", so it reads the priority value from /proc/PID/stat. The value gets there via code found in "fhandler_process.cc":
/* The BasePriority returned to a 32 bit process under WOW64 is
apparently broken, for 32 and 64 bit target processes. 64 bit
processes get the correct base priority, even for 32 bit processes. */
if (wincap.is_wow64 ())
priority = 8; /* Default value. */
else
priority = pbi.BasePriority;
But that's an inconsistent way of generating the value, because it is supposed to be the one that "getpriority()" returns.
Also, it looks like the higher value in "pbi.BasePriority" corresponds to a higher process priority, while Unix priority is higher when the value is less
(20 - nice, generally).
It looks like it should have been done by calling a utility function, winprio_to_nice(GetPriorityClass(CurrentProcess())), and setting up both the priority
field (as "NZERO + winprio_to_nice()") and the following "nice" field (which is currently set to permanent zero) with what winprio_to_nice() returns.
--
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
next reply other threads:[~2019-08-06 18:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 18:54 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin [this message]
2019-08-06 20:08 ` Corinna Vinschen
2019-08-07 0:45 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-07 8:08 ` Corinna Vinschen
2019-08-07 19:28 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-08 8:00 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BL0PR0901MB4308798C7E132A9D569FB9AAA5D50@BL0PR0901MB4308.namprd09.prod.outlook.com \
--to=cygwin@cygwin.com \
--cc=lavr@ncbi.nlm.nih.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).