Operating System - HP-UX
1752749 Members
4866 Online
108789 Solutions
New Discussion юеВ

Program or script to count current used kthreads

 
SOLVED
Go to solution
John M. Robinson_1
Occasional Advisor

Program or script to count current used kthreads

Does anyone have a way to count the number of current ktheads being used, compare it to the maximum allowed and return both values? I want to use this on HP-UX 11.11, 11.23 (PA-RISC and Itanium).
If you don't ask, the answer is NO.
4 REPLIES 4
Olivier Masse
Honored Contributor
Solution

Re: Program or script to count current used kthreads

I have one here, you will need to have glance:

http://www.mayoxide.com/toolbox/count_threads.sh
Olivier Masse
Honored Contributor

Re: Program or script to count current used kthreads

You'll probably want to replace kmtune with kctune for 11.23, though.
Sandman!
Honored Contributor

Re: Program or script to count current used kthreads

Compile and run the program pasted below:

# cc nkthreads.c -o nkthreads
# ./nkthreads

=======================nkthreads.c=======================
#include
#include
#include

main(void)
{
struct pst_dynamic dyn, *pdyn = &dyn;

if (pstat_getdynamic(pdyn, sizeof(dyn), 1, 0) == 1)
printf("kthreads (in-use/max) = %ld%s%ld\n", pdyn->
psd_numkthreadsallocd, "/", pdyn->psd_maxkthreads);
else
return 1;
return 0;
}
John M. Robinson_1
Occasional Advisor

Re: Program or script to count current used kthreads

Used Olivier Masse's solution.
If you don't ask, the answer is NO.