Skip Navigation Links | |
Exit Print View | |
man pages section 3: Extended Library Functions, Volume 4 Oracle Solaris 11.1 Information Library |
Extended Library Functions, Volume 4
gl_customize_completion(3TECLA)
scf_count_ranges_destroy(3SCF)
scf_decoration_get_bundle(3SCF)
scf_decoration_get_layer(3SCF)
scf_decoration_get_value(3SCF)
scf_decoration_layer_from_string(3SCF)
scf_decoration_layer_to_string(3SCF)
scf_entry_destroy_children(3SCF)
scf_instance_get_decoration(3SCF)
scf_instance_get_pg_composed(3SCF)
scf_instance_get_snapshot(3SCF)
scf_instance_is_complete(3SCF)
scf_iter_decoration_values(3SCF)
scf_iter_instance_decorations(3SCF)
scf_iter_instance_pgs_composed(3SCF)
scf_iter_instance_pgs_typed(3SCF)
scf_iter_instance_pgs_typed_composed(3SCF)
scf_iter_instance_snapshots(3SCF)
scf_iter_next_decoration(3SCF)
scf_iter_property_decorations(3SCF)
scf_iter_property_values(3SCF)
scf_iter_service_decorations(3SCF)
scf_iter_service_instances(3SCF)
scf_iter_service_pgs_typed(3SCF)
scf_iter_snaplevel_pgs_typed(3SCF)
scf_pg_get_parent_instance(3SCF)
scf_pg_get_parent_service(3SCF)
scf_pg_get_parent_snaplevel(3SCF)
scf_pg_get_underlying_pg(3SCF)
scf_property_get_decoration(3SCF)
scf_property_get_value_at_layer(3SCF)
scf_service_add_instance(3SCF)
scf_service_get_decoration(3SCF)
scf_service_get_instance(3SCF)
scf_simple_app_props_free(3SCF)
scf_simple_app_props_get(3SCF)
scf_simple_app_props_next(3SCF)
scf_simple_app_props_search(3SCF)
scf_simple_prop_next_astring(3SCF)
scf_simple_prop_next_boolean(3SCF)
scf_simple_prop_next_count(3SCF)
scf_simple_prop_next_integer(3SCF)
scf_simple_prop_next_opaque(3SCF)
scf_simple_prop_next_reset(3SCF)
scf_simple_prop_next_time(3SCF)
scf_simple_prop_next_ustring(3SCF)
scf_simple_prop_numvalues(3SCF)
scf_simple_walk_instances(3SCF)
scf_snaplevel_get_instance_name(3SCF)
scf_snaplevel_get_next_snaplevel(3SCF)
scf_snaplevel_get_parent(3SCF)
scf_snaplevel_get_scope_name(3SCF)
scf_snaplevel_get_service_name(3SCF)
scf_snapshot_get_base_snaplevel(3SCF)
scf_tmpl_error_prop_tmpl(3SCF)
scf_tmpl_error_source_fmri(3SCF)
scf_tmpl_prop_cardinality(3SCF)
scf_tmpl_prop_common_name(3SCF)
scf_tmpl_prop_description(3SCF)
scf_tmpl_prop_internal_seps(3SCF)
scf_tmpl_prop_visibility(3SCF)
scf_tmpl_value_common_name(3SCF)
scf_tmpl_value_count_range_choices(3SCF)
scf_tmpl_value_count_range_constraints(3SCF)
scf_tmpl_value_description(3SCF)
scf_tmpl_value_in_constraint(3SCF)
scf_tmpl_value_int_range_choices(3SCF)
scf_tmpl_value_int_range_constraints(3SCF)
scf_tmpl_value_name_choices(3SCF)
scf_tmpl_value_name_constraints(3SCF)
scf_tmpl_visibility_to_string(3SCF)
scf_transaction_destroy_children(3SCF)
scf_transaction_property_change(3SCF)
scf_transaction_property_change_type(3SCF)
scf_transaction_property_delete(3SCF)
scf_transaction_property_new(3SCF)
scf_transaction_reset_all(3SCF)
scf_value_get_as_string_typed(3SCF)
scf_value_set_from_string(3SCF)
stmfCheckHostGroupInUse(3STMF)
stmfCheckTargetGroupInUse(3STMF)
stmfFreeViewResourceList(3STMF)
stmfGetHostGroupMembers(3STMF)
stmfGetLogicalUnitProperties(3STMF)
stmfGetProviderDataProt(3STMF)
stmfGetTargetGroupMembers(3STMF)
stmfGetTargetProperties(3STMF)
stmfGetViewLuNumberList(3STMF)
stmfGetViewResourceList(3STMF)
stmfRemoveFromHostGroup(3STMF)
stmfRemoveFromTargetGroup(3STMF)
stmfSetProviderDataProt(3STMF)
sysevent_bind_handle(3SYSEVENT)
sysevent_get_attr_list(3SYSEVENT)
sysevent_get_class_name(3SYSEVENT)
sysevent_get_pub_name(3SYSEVENT)
sysevent_get_subclass_name(3SYSEVENT)
sysevent_get_vendor_name(3SYSEVENT)
sysevent_post_event(3SYSEVENT)
sysevent_subscribe_event(3SYSEVENT)
sysevent_unbind_handle(3SYSEVENT)
sysevent_unsubscribe_event(3SYSEVENT)
volmgt_feature_enabled(3VOLMGT)
XTSOLgetClientAttributes(3XTSOL)
XTSOLgetPropAttributes(3XTSOL)
XTSOLgetWorkstationOwner(3XTSOL)
XTSOLsetWorkstationOwner(3XTSOL)
zs_pset_zone_get_pset(3ZONESTAT)
zs_pset_zone_get_zone(3ZONESTAT)
zs_pset_zone_property(3ZONESTAT)
zs_pset_zone_used_cpus(3ZONESTAT)
zs_pset_zone_used_pct(3ZONESTAT)
zs_pset_zone_used_time(3ZONESTAT)
zs_resource_property(3ZONESTAT)
zs_resource_total_time(3ZONESTAT)
zs_resource_total_uint64(3ZONESTAT)
zs_resource_used_pct(3ZONESTAT)
zs_resource_used_time(3ZONESTAT)
zs_resource_used_uint64(3ZONESTAT)
zs_resource_used_zone_pct(3ZONESTAT)
zs_resource_used_zone_time(3ZONESTAT)
zs_resource_used_zone_uint64(3ZONESTAT)
zs_zone_limit_uint64(3ZONESTAT)
zs_zone_limit_used_pct(3ZONESTAT)
zs_zone_limit_used_time(3ZONESTAT)
- read system configuration and utilization
cc [ flag ... ] file... -lzonestat [ libary ... ] #include <zonestat.h> zs_usage_t zs_usage_read(zs_ctl_t zsctl);
zs_usage_t zs_usage_diff(zs_usage_t u1, zs_usage_t u2);
void zs_usage_free(zs_usage_t zsctl);
The zs_usage_read() function reads the system configuration and utilization with respect to zones, memory, and CPU.
Each zs_usage_read() will return a zs_usage_t object, which includes the following information:
The current system resources and their utilization.
The currently running zones. All properties reflect the current running state of each zone.
The usage of each resource by each zone.
The usage by each zone of its configured limits.
The currently existing processor sets. All properties and usages reflect the current running state of each processor set.
The usage of each processor set by each zone utilizing it.
Increasing utilization values are described libzonestat(3LIB). Increasing values continually increase, starting at zero from the point at which zs_open(3ZONESTAT) was first called.
For all other utilization values, utilization information will be the usage at the point in time at which zs_usage_read() is called.
For zones and processors sets that were booted or created after zs_open() was called, the increasing usage values will be usage since the most recent boot or creation before the call to zs_usage_read().
The zs_usage_diff() function computes and returns the utilization differences between two zs_usage_t objects returned by zs_usage_read(). Both u1 and u2 must be read from the same zsctl object. u2 must be read after u1.
The purpose of zs_usage_diff() is to simplify the comparison of zs_usage_read() calls made at a interval.
The returned zs_usage_t object will contain:
The current system resources, as they exist in u2.
The zones and processor sets that exist in u2.
For increasing utilization values, the value of (u2 - u1). If a specific value does not exist in u1 (such as the CPU utilization for a zone in u2 which does not exist in u1), the value will be the value from u2.
For non-increasing utilization values, the value of u2.
The zs_usage_free() function frees the memory associated with a zs_usage_t object returned by zs_usage_read() or zs_usage_diff().
On success, zs_usage_free() and zs_usage_diff() return a pointer to a zonestat usage object. On failure, zs_open() returns NULL.
The zs_usage_diff() function will fail if:
Insufficient resources are available.
Insufficient memory is available.
The zs_usage_read() function will fail if:
Insufficient resources are available.
A signal was caught.
Insufficient memory is available.
Unable to connect to the zones monitoring service. See Notes.
Example 1 Read zone CPU utilization.
The following example uses zs_usage_read() to read each zones CPU utilization at a regular interval.
#include <zonestat.h> ... extern int time_to_quit; /* hypothetical quit notification */ ... zs_ctl_t ctl; zs_usage_t last; zs_usage_t next; zs_usage_t diff; zs_zone_t zone; timestruct_t time; uint64_t cpus; ctl = zs_usage_open(); /* Open zone statistics */ last = zs_usage_read(); /* Read initial usage */ for (;;) { sleep(10); next = zs_usage_read(); diff = zs_usage_diff(last, next); /* Walk zones in usage data */ for (zone = zs_zone_first(diff); zone != NULL ; zone = zs_zone_next(diff, zone)) { /* * fetch cpu time used by zone over interval in terms of * seconds and nanoseconds */ zs_resource_used_zone_time(zone, ZS_RESOURCE_CPU, &time); /* * fetch cpu time used by zone over interval in terms of * cpu used. 100 equals one cpu. For example, a * value of 250 means the zone used 2.5 cpus worth of * time between last and next. */ zs_resource_used_zone_uint64(zone, ZS_RESOURCE_CPU, &cpus; } zs_usage_free(diff); zs_usage_free(last); last = next; if (time_to_quit) break; } zs_usage_free(last)
See attributes(5) for descriptions of the following attributes:
|
The zs_usage_*() functions are MT-safe, with the exception that only one thread may actively use a zs_ctl_t * object at any time. Synchronization is left to the application.
zonestat(1), pooladm(1M), psrset(1M), rcapadm(1M), swap(1M), zoneadm(1M), zonestatd(1M), libpool(3LIB), libzonestat(3LIB), zs_open(3ZONESTAT), zs_pset(3ZONESTAT), zs_property(3ZONESTAT), zs_pset_zone(3ZONESTAT), zs_resource(3ZONESTAT), zs_zone(3ZONESTAT), attributes(5), resource_controls(5)
The service svc:/system/zones-monitoring:default must be enabled in the global zone in order for zs_usage_read() to succeed. This requirement exists for use of libzonestat(3LIB) in both the global zone and non-global zones.
If the zones-monitoring service goes off line, ESRCH will be returned. At this point the zsctl object is no longer usable. Use zs_close(zsctl) and use zs_open(3ZONESTAT) to reconnect.