acct_put Kernel Service

Purpose

Writes an accounting record.

Syntax

#include <sys/aacct.h>

void acct_put(trid, flags, projid, usage, trdata, tr_len);
int trid;
int flags;
projid_t projid;
struct tusage *usage;
void *trdata;
int tr_len;

Parameters

Item Description
trid Transaction identifier.
flags Flags associated with the transaction or the production of the transaction. The following value is defined:
ACCT_PUT_DIRECT
Overrides aggregate transaction
projid Project identifier, associated with the transaction, that identifies the billable entity. The following values are defined:
PROJID_SYSTEM
This identifier is typically associated with system overhead and is often used for shared devices, such as disks and network adapters.
PROJID_UNKNOWN
This identifier is used when the billable entity is unknown to the caller. In this case, the system calculates the project identifier using the project assignment policy specified by the system administrator.
project identifier
If the project identifier is known, it should be specified.
usage Identifies the resource usage values associated with the transaction.
trdata Transaction-specific information.
tr_len Size of the transaction-specific data in bytes.

Description

The acct_put kernel service provides accounting data to the advanced accounting subsystem. This service builds the accounting record header from its parameters and values associated with the calling context. The transaction-specific data specified by the caller is copied after the header. This data is internally buffered so that it can be written efficiently to the accounting data file some time later.

The trid parameter identifies the type of transaction that is being provided and implicitly identifies the format of the transaction-specific data. This identifier is included within the accounting header and is used by report and analysis commands to infer the right template that can interpret transaction-specific data. Vendors are encouraged to document their transaction identifiers and record templates so that report and analysis tools can be produced to interpret this data.

Accounting transaction identifiers are defined in the following range:
Item Description
0-127 AIX® accounting transaction identifiers
128-255 Vendor accounting transaction identifiers

The ACCT_PUT_DIRECT flag is provided as an override to the aggregation of accounting records, which is an optional feature of the advanced accounting subsystem. By default, the system does not aggregate accounting data. Aggregation is designed to reduce the volume of data that is written to the accounting file. It is transparent to applications and middleware. When aggregation is enabled, the system throws out the transaction-specific data and produces statistics about the occurrence of the transaction and the aggregate resource utilization. The data is produced along project boundaries, so the ability to perform chargeback is not lost, although the data that is produced is different. Statistical information about the transaction is captured in the accounting file in lieu of the transaction.

Because aggregation might not be desirable in some cases, the ACCT_PUT_DIRECT flag is provided to override this feature. For example, because the significance of a transaction that describes the shared use of a disk is bound up in the transaction-specific data, the transaction cannot be effectively aggregated. The significance of the transaction is thrown out in the course of aggregation. In effect, the statistic has already been aggregated by the producer, so it should be written directly to the file instead of being aggregated again by the accounting subsystem.

The usage values pointed to by the usage parameter is calculated using the acct_get_usage kernel service. The usage parameter is optional. A value of NULL can be specified to signify no usage information. Aggregation uses this field to accumulate resource utilization. If this information is calculated for the transaction, it should be passed as a parameter to this routine, instead of just including it within the transaction-specific data section. The advanced accounting subsystem does not know the format of this section and cannot aggregate it. In such a case, this section would be thrown out when aggregation is enabled.

The trdata parameter contains the address of a buffer containing transaction-specific data, and the tr_len parameter identifies the number of bytes in this buffer that should be copied to the accounting file. A maximum of 16 KB of data can be written.

Execution Environment

The acct_put kernel service can be started from either the process or interrupt environment. However, aggregation of the transaction is only supported when the acct_put service is started from the process environment.

Return Values

The acct_put kernel service does not return a value.