Forum Moderators: bakedjake
Which utility in HPUX will allow me to view Threads per Process for HP?
/usr/bin/top does not show No of Lightweight Processes (NLWP) information.
Equivalent utility for Solaris is - /usr/bin/prstat.
Also, ps(1) for HPUX hasn't got a -L option support (as Solaris) to view NLWP information.
Thanks,
Manish.
#include <sys/param.h>
#include <sys/pstat.h>
#include <sys/unistd.h>
#include <stdio.h>
main()
{
int pid;
struct pst_status pst;
printf("Enter pid number ... ");
scanf("%d",&pid);
/*
* First get the desired process to get its 'index'.
* This will be used when retrieving the file data.
*/
if (pstat_getproc(&pst, sizeof(pst), (size_t)0, pid)!= -1)
{
printf("pid is %d, cmd is %s, # threads
%d\n",pst.pst_pid,pst.pst_cmd,pst.pst_nlwps);
}
else
{
perror("pstat_getproc");
}
}
Enter the pid and you get number of threads per process.
-Manish.