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

Technical Reference: Base Operating System and Extensions, Volume 1

perfstat_netbuffer Subroutine


Retrieves network buffer allocation usage statistics.


Perfstat Library (libperfstat.a)


#include <libperfstat.h>

int perfstat_netbuffer (name, userbuff, sizeof_struct, desired_number)
perfstat_id_t *name;
perfstat_netbuffer_t *userbuff;
size_t sizeof_struct;
int desired_number;


The perfstat_netbuffer subroutine retrieves statistics about network buffer allocations for each possible buffer size. Returned counts are the sum of allocation statistics for all processors (kernel statistics are kept per size per processor) corresponding to a buffer size.

To get one or more sets of network buffer allocation usage metrics, set the name parameter to the network buffer size for which statistics are desired, and set the desired_number parameter. To start from the first network buffer size, specify "" or FIRST_NETBUFFER in the name parameter. The userbuff parameter must point to a memory area big enough to contain the desired number of perfstat_netbuffer_t structures which will be copied by this function.

Upon return, the name parameter will be set to either the ASCII size of the next buffer type, or to "" if all structures have been copied. Only the statistics for network buffer sizes that have been used are returned. Consequently, there can be holes in the returned array of statistics, and the structure corresponding to allocations of size 4096 may directly follow the structure for size 256 (in case 512, 1024 and 2048 have not been used yet). The structure corresponding to a buffer size not used yet is returned (with all fields set to 0) when it is directly asked for by name.

To retrieve the number of available sets of network buffer 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 "", FIRST_NETBUFFER, or the size of the network buffer in ASCII. It is a power of 2. For example:
32, 64, 128, ..., 16384
userbuff Points to the memory area to be filled with one or more perfstat_netbuffer_t structures.
sizeof_struct Specifies the size of the perfstat_netbuffer_t structure: sizeof(perfstat_netbuffer_t)
desired_number Specifies the number of perfstat_netbuffer_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_netbuffer 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_cpu Subroutine, perfstat_cpu_total Subroutine, perfstat_memory_total Subroutine, perfstat_disk Subroutine, perfstat_disk_total Subroutine, perfstat_netinterface_total Subroutine, perfstat_diskadapter Subroutine, perfstat_protocol 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 ]