Go to main content

man pages section 3: Extended Library Functions, Volume 4

Exit Print View

Updated: Thursday, June 13, 2019
 
 

zs_pset_used_cpus(3ZONESTAT)

Name

zs_pset, zs_pset_list, zs_pset_walk, zs_pset_property, zs_pset_total_time, zs_pset_total_cpus, zs_pset_used_time, zs_pset_used_cpus, zs_pset_used_pct, zs_pset_stolen_all_time, zs_pset_stolen_all_cpus, zs_pset_stolen_all_pct, zs_pset_stolen_time, zs_pset_stolen_cpus, zs_pset_stolen_pct, zs_pset_stolen_zones_time, zs_pset_stolen_zones_cpus, zs_pset_stolen_zones_pct - libzonestat pset accessor methods

Synopsis

cc [ flag ... ] file... -lzonestat [ libary ... ]
#include <zonestat.h>

int zs_pset_list(zs_usage_t usage, zs_pset_t *psetlist, int num);
zs_pset_t zs_pset_walk(zs_usage_t usage, zs_pset_t pset);
zs_property_t zs_pset_property(zs_pset_t pset, zs_pset_property_t prop);
void zs_pset_total_time(zs_pset_t pset, timestruc_t *ts);
uint64_t zs_pset_total_cpus(zs_pset_t pset);
void zs_pset_used_time(zs_pset_t pset, zs_user_t user, timestruc_t *ts);
uint64_t zs_pset_used_cpus(zs_pset_t pset, zs_user_t user);
uint_t zs_pset_used_pct(zs_pset_t pset, zs_user_t user);
void zs_pset_stolen_all_time(zs_pset_t pset, timestruc_t *ts);
uint64_t zs_pset_stolen_all_cpus(zs_pset_t pset);
uint_t zs_pset_stolen_all_pct(zs_pset_t pset);
void zs_pset_stolen_time(zs_pset_t pset, timestruc_t *ts);
uint64_t zs_pset_stolen_cpus(zs_pset_t pset);
uint_t zs_pset_stolen_pct(zs_pset_t pset);
void zs_pset_stolen_zones_time(zs_pset_t pset, timestruc_t *ts);
uint64_t zs_pset_stolen_zones_cpus(zs_pset_t pset);
uint_t zs_pset_stolen_zones_pct(zs_pset_t pset);

Description

These functions are used to access the processor sets (psets) in the usage object. These psets are the psets which existed at the time when the zs_usage_read was called, and returned the usage object.

By default, the system has a single processor set which contains all cpus. Processor sets can be created by resource pools (pooladm(8)), the psrset(8) command, and by the zonecfg(8) dedicated cpu resource.

The zs_pset_list() function returns the number of zs_pset_t objects contained within usage. If psetlist is non-NULL, the psetlist array will be filled with up to num zs_pset_t objects. The psetlist array must be first allocated by the caller. The first pset returned in the array will always be the default pset. The remaining pset will be in alphanumeric ordered by pset name.

The zs_pset_walk() function walks the psets contained in usage. If pset is NULL, the first pset is returned. The first pset is always the default pset. Otherwise, the psets are returned in alphanumeric order. NULL will be returned if there are no more psets.

The zs_pset_property() function will return the prop property of a pset. See libzonestat(3LIB) for a description of the ZS_PSET_PROP_* property codes.

The zs_pset_total_time() function sets ts to the total cpu time that has been available in pset. For example, if a pset has 2 online cpus, and zs_open as called 30 seconds before zs_usage_read, then the total time available in the pset is 60 seconds. ts must be allocated by the caller.

The zs_pset_total_cpus() function returns the number of online cpus in pset * 100. For instance, if the number of online cpus is 4, the value returned will be 400.

The zs_pset_used_time() function sets ts to the total cpu time that has been used in pset, starting at zero from the point when zs_open was first called.

The zs_pset_used_cpus() function returns quantity of cpus used by user. The value returned is the number of cpus used * 100. For instance, if user ZS_USER_ZONES (which represents total pset usage by all zones) has used 2.5 cpus worth of cpu time, then the value returned is 250.

The uint_t zs_pset_used_pct() function returns the percentage of cpu time used by user. The value returned is the percentage * 100. For example, if user ZS_USER_ALL (representing total cpu usage) is 50%, then the value returned will be 5000.

All ZS_USER_* user codes are described in the libzonestat(3LIB) manual page.

The zs_pset_stolen_all_time() function sets ts to the sum of the time stolen from the pset and time stolen from all the zones bound to the pset. For more information about stolen time, see solaris-kz (7) .

The zs_pset_stolen_all_cpus() function returns the sum of number of cpus stolen from the pset with number of cpus stolen from the zones bound to the pset.

The zs_pset_stolen_all_pct() function returns the percentage of cpu time stolen from the pset and all its zones.

The zs_pset_stolen_time() function sets ts to the time stolen from the pset. Stolen time is supported only when running inside a supported zone brand. If stolen time is not supported by the current system, ts is set to a zero structure.

The zs_pset_stolen_cpus() function returns cpus stolen from the pset. If the current system does not support stolen time, a special value of ZS_LIMIT_NONE is returned.

The zs_pset_stolen_pct() function returns percentage of time stolen from the pset. If stolen time is not supported by the current system, special value of ZS_PCT_NONE is returned.

The zs_pset_stolen_zones_time() function sets ts to the total sum of time stolen from the zones bound to the pset.

The zs_pset_stolen_zones_cpus() function returns cpus stolen from the zones bound to the pset.

The zs_pset_stolen_zones_pct() function returns percentage of time stolen from the zones bound to the pset.

Return Values

See Description.

Errors

If a zs_pset_*() function is called with an invalid user code, the function will abort with abort(3C).

Examples

Example 1 Retrieve information about all psets in a usage object.

The following example traverses all psets in a usage object, retrieving information about each pset.

#include <zonestat.h>
...
extern zs_usage_t usage;        /* assume returned by zs_usage_read() */
...
zs_pset_t pset;
zs_property_t prop;
char * psetname;
uint64_t online;
uint64_t used;
uint64_t stolen;

for (pset = zs_pset_first(usage); pset != NULL;
    pset = zs_pset_next(usage, pset)) {

/* Get psetname */
prop = zs_pset_property(pset, ZS_PSET_PROP_NAME);
psetname = strdup(zs_property_string(prop)));

/*
 * Get number of online cpus, quantity of cpu used, and time
 * stolen from the pset, all in number of cpus * 100.
 */
online = zs_pset_total_cpus(pset);
used = zs_pset_used_cpus(pset, ZS_USER_ALL);
stolen = zs_pset_stolen_cpus(pset);
}

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Safe

See Also

zonestat(1), abort(3C), libpool(3LIB), libzonestat(3LIB), zs_open(3ZONESTAT), zs_property(3ZONESTAT), zs_pset_zone(3ZONESTAT), zs_resource(3ZONESTAT), zs_usage(3ZONESTAT), zs_zone(3ZONESTAT), attributes(7), resource-controls(7), pooladm(8), psrset(8), rcapadm(8), swap(8), zoneadm(8), zonestatd(8)