- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Way to determine number of active processors progr...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2009 02:13 AM
01-09-2009 02:13 AM
Way to determine number of active processors programmatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2009 02:32 AM
01-09-2009 02:32 AM
Re: Way to determine number of active processors programmatically
Have a look at the sysinfo tool from this page.
http://h20331.www2.hp.com/Hpsub/cache/286022-0-0-225-121.html?jumpid=reg_R1002_USEN
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2009 03:09 AM
01-09-2009 03:09 AM
Re: Way to determine number of active processors programmatically
ioscan -k |grep -n processor |wc -l
This does not account for active/inactive processors, however. Can you explain what you mean by active processors?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2009 04:11 AM
01-09-2009 04:11 AM
Re: Way to determine number of active processors programmatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2009 04:19 AM
01-09-2009 04:19 AM
Re: Way to determine number of active processors programmatically
If we're talking v3 or v2, then from the DDR you have wsio_get_processor_count(9F) and wsio_get_active_processor_count(9F). Those will give you the number of processors possible/configured (allowing for future OLA including Cell OLA on v3, so this is your high water mark) and the number currently active respectively.
Note that there's no guarantee that the active processors are _contiguous_ in cpu identifier number (and very often they aren't), so your algorithm needs to account for this. How you do that is up to you, of course -- but typically if the per-processor statistics are small you'd just allocate/initialize to the base (zero?) state for all processors and then only update statistics for processors which are doing work (and are hence active at some point in your sampling cycle). If your statistics areas are large, you will want to think of other ways [since the total number of processors on a small vPar with v3 reflects the possibility that the underlying nPar could get full OLA and all resources could be given to this vPar, and hence can be much larger than the actual number you'd typically use -- memory consumption must be considered for those cases].
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2009 07:52 PM
01-09-2009 07:52 PM
Re: Way to determine number of active processors programmatically
I found this code in a pthread code library
bind_threads()
{
pthread_spu_t answer, spu_nums[4], spu = (pthread_spu_t)-1;
int i, ret;
/* Get the ID of the first processor */
ret = pthread_processor_id_np(PTHREAD_GETFIRSTSPU_NP,
&answer, spu);
check_error(ret, "get_first_spu");
spu_nums[0] = answer;
/* Get the ID of the next 3 processors */
for (i = 1; i < 4; i++) {
spu = answer;
ret = pthread_processor_id_np(PTHREAD_GETNEXTSPU_NP,
&answer, spu);
if (ret == EINVAL)
break;
spu_nums[i] = answer;
}
/* Did we find four processors? Spread out the IDs if not. */
if (i == 2) { /* found two processors */
spu_nums[2] = spu_nums[0];
spu_nums[3] = spu_nums[1];
} else if (i == 3) { /* found three processors */
spu_nums[3] = spu_nums[0];
}
/* Bind each of threads if we have multiple processors. */
if (i > 1) {
for (i = 0; i < 4; i++) {
ret = pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
&answer, spu_nums[i],
threads[i]);
check_error(ret, "pthread_processor_bind_np()");
printf("Thread %d bound to processor %d\n", threads[i],
spu_nums[i]);
}
}
/* Rest of application here. */
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2009 04:42 AM
01-10-2009 04:42 AM
Re: Way to determine number of active processors programmatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2009 03:18 AM
01-11-2009 03:18 AM
Re: Way to determine number of active processors programmatically
Thank you very much for the responses. I am trying to work with the wsio interfaces that you suggested. I did not get enough documentation on the wsio interfaces. The HP-UX 11.31 development machine that I have access to does not seem to have the 9F man pages. Please let me know any other reference to the relevant documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2009 04:25 AM
01-11-2009 04:25 AM
Re: Way to determine number of active processors programmatically
int active_processor_count
int processor_count
be carefull in the kernel that the number of active cpus can raise dynamically upt to processor_count.
but better to use wsio functions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2009 11:01 AM
01-11-2009 11:01 AM
Re: Way to determine number of active processors programmatically
The 9F man pages should be available in the DDK, I'd expect -- but if nothing else, go to the DSPP site (http://h21007.www2.hp.com/portal/site/dspp) join if you need to, and get the v3 Device Developer Reference (DDR) guide. That will have the man pages within the guide.