Return a reasonable number for top or ps to display for M:N thread,

since there is no direct association between M:N thread and kse,
sometimes, a thread does not have a kse, in that case, return a pctcpu
from its last kse, it is not perfect, but gives a good number to be
displayed.
This commit is contained in:
David Xu 2003-11-08 03:03:17 +00:00
parent e31d6d8149
commit 685a6c448a

View File

@ -723,6 +723,8 @@ sched_pctcpu(struct thread *td)
struct kse *ke;
ke = td->td_kse;
if (ke == NULL)
ke = td->td_last_kse;
if (ke)
return (ke->ke_pctcpu);