[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

perfstat_protocol Subroutine


Retrieves protocol usage statistics.


Perfstat Library (libperfstat.a)


#include <libperfstat.h>

int perfstat_protocol (name, userbuff, sizeof_struct, desired_number)
perfstat_id_t *name;
perfstat_protocol_t *userbuff;
size_t sizeof_struct;
int desired_number;


The perfstat_protocol subroutine retrieves protocol usage statistics such as ICMP, ICMPv6, IP, IPv6, TCP, UDP, RPC, NFS, NFSv2, NFSv3. To get one or more sets of protocol usage metrics, set the name parameter to the name of the first protocol for which statistics are desired, and set the desired_number parameter.

To start from the first protocol, set the name parameter to "" or FIRST_PROTOCOL. The userbuff parameter must point to a memory area big enough to contain the desired number of perfstat_protocol_t structures which will be copied by this function. Upon return, the name parameter will be set to either the name of the next protocol, or to "" if all structures have been copied.

To retrieve the number of available sets of protocol usage metrics, set the name and userbuff parameters to NULL, and the desired_number parameter to 0. The returned value will be the number of available sets.


name Contains either "ip", "ipv6", "icmp", "icmpv6", "tcp", "udp", "rpc", "nfs", "nfsv2", "nfsv3", "", or FIRST_PROTOCOL.
userbuff Points to the memory area to be filled with one or more perfstat_protocol_t structures.
sizeof_struct Specifies the size of the perfstat_protocol_t structure: sizeof(perfstat_protocol_t)
desired_number Specifies the number of perfstat_protocol_t structures to copy to userbuff.

Return Values

Upon successful completion, the number of structures which could be filled is returned. If unsuccessful, a value of -1 is returned and the errno global variable is set.

Error Codes

The perfstat_protocol subroutine is unsuccessful if the following is true:

EINVAL One of the parameters is not valid.


The libperfstat.h file defines standard macros, data types, and subroutines.

Related Information

perfstat_netbuffer Subroutine, perfstat_cpu Subroutine, perfstat_cpu_total Subroutine, perfstat_disk Subroutine, perfstat_diskadapter Subroutine, perfstat_disk_total Subroutine, perfstat_memory_total Subroutine, perfstat_netinterface Subroutine, perfstat_netinterface_total Subroutine, and perfstat_pagingspace Subroutine.

Perfstat API in Performance Tools and APIs Technical Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]