- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Amount of network I/O from C++
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
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
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
тАО08-02-2010 02:34 AM
тАО08-02-2010 02:34 AM
Is there a way to determine the amount of network I/O (number of bytes sent and received by each network interface) from a C/C++ program similar to what pstat_getlv returns for each logical volume? This information should not be process-specific but global for the entire machine.
There do not seem to be pstat functions which return information about network interfaces. Glance has the option "network by interface" to show this data but I have not found a way to get the data from a program.
netstat -i and netstat -s only show the packets but I do not see a way to calculate the number of bytes from this, even if I found out how netstat obtains this information.
Could the Data Link Provider Interface be useful for this purpose?
Regards
Martin Jerabek
Solved! Go to Solution.
- Tags:
- pstat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2010 04:34 AM
тАО08-02-2010 04:34 AM
Re: Amount of network I/O from C++
wireshark or creative grep of tcpdump output can in combination with netstat give you a clear picture.
If your distribution supports it glance/gpm from HP does have the ability to drill into a process and see how much network bandwidth is being used.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2010 04:37 AM
тАО08-02-2010 04:37 AM
Re: Amount of network I/O from C++
HP-UX ships with a glance/gpm 60 day trial that will let you drill into a process and see how much band width it is using.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2010 04:49 AM
тАО08-02-2010 04:49 AM
Re: Amount of network I/O from C++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2010 04:54 AM
тАО08-02-2010 04:54 AM
Re: Amount of network I/O from C++
Wouldn't using APA be better judge of load scenarios?
And lets your program handle the business logic and leave the networking and OS stuff to somebody smarter?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2010 05:12 AM
тАО08-02-2010 05:12 AM
Re: Amount of network I/O from C++
I managed to get the necessary information on Windows, Linux, Solaris, AIX, and Mac OS X. The network interface information on HP-UX is the only missing piece. Since Glance is able to get it (obviously via the midaemon) it must be available but I just do not see it from where.
I ran truss on netstat to see how it does it but I am not familiar enough with the ioctls and STREAMS messages to understand it. It seems to involve /dev/ip but I have not found any documentation about it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2010 05:28 AM
тАО08-02-2010 05:28 AM
Re: Amount of network I/O from C++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2010 05:35 AM
тАО08-02-2010 05:35 AM
Re: Amount of network I/O from C++
If the necessary interfaces are only available in later versions, this would also be acceptable but of course we would prefer it not to force our customers to update their machines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2010 08:41 AM
тАО08-03-2010 08:41 AM
SolutionAnother possiblity would be SNMP queries of the MIB(s).
I seem to recall there being DLPI stats calls to retrieve link-level stats on a per-PPA basis, so yes, you might look into the DLPI manuals - at one time at least they would have been on docs.hp.com.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2010 04:44 AM
тАО08-04-2010 04:44 AM
Re: Amount of network I/O from C++
- Open /dev/dlpi. All the following STREAMS messages use this file descriptor.
- Using putmsg/getmsg get the information about all network interfaces with DL_HP_PPA_REQ (I actually used DL_HP_EXT_PPA_REQ so that I can use the dl_hp_ext_ppa_info_t::dl_link_state member to check if an interface is up).
- Attach each interface (PPA) with DL_ATTACH_REQ using the dl_ppa of the DL_HP_PPA_ACK.
- Get its statistics with DL_GET_STATISTICS_REQ. The documentation is not clear about the returned data but it is obviously Ext_mib_t from
BTW, DL_HP_GET_64BIT_STATS_REQ only returned DL_NOTSUPPORTED on my machine.
- Detach the PPA again with DL_DETACH_REQ and repeat with the next one (using dl_next_offset to find the next dl_hp_ppa_info_t).
Thanks again to all who replied!