agg_proc_stat, agg_lpar_stat, agg_arm_stat, or free_agg_list Subroutine

Purpose

Aggregate advanced accounting data.

Library

The libaacct.a library.

Syntax

#define <sys/aacct.h>
int agg_arm_stat(tran_list, arm_list);
struct aacct_tran_rec *tran_list
struct agg_arm_stat **arm_list
int agg_proc_stat(sortcrit1, sortcrit2, sortcrit3, sortcrit4, tran_list, proc_list);
int sortcrit1, sortcrit2, sortcrit3, sortcrit4
struct aacct_tran_rec *tran_list
struct agg_proc_stat **proc_list
int agg_lpar_stat(l_type, *tran_list, l_list);
int l_type
struct aacct_tran_rec *tran_list
union agg_lpar_rec *l_list
void free_agg_list(list);
void *list

Description

The agg_proc_stat, agg_lpar_stat, and agg_arm_stat subroutines return a linked list of aggregated transaction records for process, LPAR, and ARM, respectively.

The agg_proc_stat subroutine performs the process record aggregation based on the criterion values passed as input parameters. The aggregated process transaction records are sorted based on the sorting criteria values sortcrit1, sortcrit2, sortcrit3, and sortcrit4. These four can be one of the following values defined in the sys/aacct.h file:
  • CRIT_UID
  • CRIT_GID
  • CRIT_PROJ
  • CRIT_CMD
  • CRIT_NONE
The order of their usage determines the sorting order applied to the retrieved aggregated list of process transaction records. For example, the sort criteria values of PROJ_GID, PROJ_PROJ, PROJ_UID, PROJ_NONE first sorts the aggregated list on group IDs, which are further sorted based on project IDs, followed by another level of sorting based on user IDs.

Some of the process transaction records (of type TRID_agg_proc) cannot be aggregated based on group IDs and command names. For such records, agg_proc_stat returns an asterisk (*) character as the command name and a value of -2 as the group ID. This indicates to the caller that these records cannot be aggregated.

If the aggregation is not necessary on a specific criteria, agg_proc_stat returns a value of -1 in the respective field. For example, if the aggregation is not necessary on the group ID (CRIT_GID), the retrieved list of aggregation records has a value of -1 filled in the group ID fields.

The agg_lpar_stat retrieves an aggregated list of LPAR transaction records. Because there are several types of LPAR transaction records, the caller must specify the type of LPAR transaction record that is to be aggregated. The transaction record type can be one of the following values, defined in the sys/aacct.h file:
  • AGG_CPUMEM
  • AGG_FILESYS
  • AGG_NETIF
  • AGG_DISK
  • AGG_VTARGET
  • AGG_VCLIENT
The agg_lpar_stat subroutine uses a union argument of type struct agg_lpar_rec. For this argument, the caller must provide the address of the linked list to which the aggregated records should be returned.

The agg_arm_list retrieves an aggregated list of ARM transaction records from the list of transaction records provided as input. The aggregated transaction records are returned to the caller through the structure pointer of type struct agg_arm_stat.

The free_agg_list subroutine frees the memory allocated to the aggregated records returned by the agg_proc_stat, agg_lpar_stat, or agg_arm_stat subroutine.

Parameters

Item Description
arm_list Pointer to the linked list of struct agg_arm_stat nodes to be returned.
l_list Pointer to union agg_lpar_rec address to which the aggregated LPAR records are returned.
l_type Integer value that represents the type of LPAR resource to be aggregated.
list Pointer to the aggregated list to be freed.
proc_list Pointer to the linked list of struct agg_proc_stat nodes to be returned.
sortcrit1, sortcrit2, sortcrit3, sortcrit4 Integer values that represent the sorting criteria to be passed to agg_proc_stat.
tran_list Pointer to the input list of transaction records

Security

No restrictions. Any user can call this function.

Return Values

Item Description
0 The call to the subroutine was successful.
-1 The call to the subroutine failed.

Error Codes

Item Description
EINVAL The passed pointer is NULL.
ENOMEM Insufficient memory.
EPERM Permission denied. Unable to read the data file.