- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Calculating Memory Use with awk
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
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
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
09-12-2008 04:28 AM
09-12-2008 04:28 AM
Re: Calculating Memory Use with Awk
Again -- I don't know enough awk (sorry, I think in C not shell scripts) to know exactly how to work it in... but I can't recommend hard-coding the expectation that the system page size is 4kb in scripts. The page size is tunable with 11.31.0809 and I'd expect it to remain so in the future. Your scripts doubtless work fine now -- but when and if you encounter a system with 16kb or 64kb pages, you will get the wrong answer. "getconf _SC_PAGE_SIZE" will always give you the right factor. (Divide that by 1024 first if you want Kb and are worried about overflows -- but you'd still run into problems on a 2Tb or beyond system, right? Assuming signed 32-bit math and all).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2008 05:04 PM - edited 09-06-2011 07:25 AM
09-12-2008 05:04 PM - edited 09-06-2011 07:25 AM
Re: Calculating Memory Use with awk
>TTr: I used the awk statement from above code and it stopped counting at the above number. Maybe I should have said "It appears that awk is using 32-bit arithmetic...".
Ah, I used a giant number and had no problems:
awk 'BEGIN {print 2000000000 + 2000000000 + 2000000000 }' /dev/null
6e+09
Unfortunately this format gives a bogus answer:
printf "%lld\n"
4612175268889493503
So you would need: printf "%.0f\n"
6000000000
- « Previous
-
- 1
- 2
- Next »