xref: /onnv-gate/usr/src/cmd/perl/contrib/Sun/Solaris/Exacct/pod/Object.pod (revision 12388:1bc8d55b0dfd)
10Sstevel@tonic-gate#
2*12388SJohn.Sonnenschein@Sun.COM# Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
30Sstevel@tonic-gate#
4*12388SJohn.Sonnenschein@Sun.COM
50Sstevel@tonic-gate#
60Sstevel@tonic-gate# Sun::Solaris::Exacct::Object documentation.
70Sstevel@tonic-gate#
80Sstevel@tonic-gate
90Sstevel@tonic-gate=head1 NAME
100Sstevel@tonic-gate
110Sstevel@tonic-gateSun::Solaris::Exacct::Object - exacct object manipulation
120Sstevel@tonic-gate
130Sstevel@tonic-gate=head1 SYNOPSIS
140Sstevel@tonic-gate
150Sstevel@tonic-gate use Sun::Solaris::Exacct::Object qw(:ALL);
160Sstevel@tonic-gate print($ea_obj->value(), "\n");
170Sstevel@tonic-gate
180Sstevel@tonic-gateThis module is used as a parent of the two possible types of Perl exacct
190Sstevel@tonic-gateobjects: Items and Groups. An Item is either a single data value such as the
200Sstevel@tonic-gatenumber of seconds of user CPU time consumed by a process, an embedded Perl
210Sstevel@tonic-gateexacct object, or a block of raw data. A Group is an ordered collection of
220Sstevel@tonic-gatePerl exacct Items such as all of the resource usage values for a particular
230Sstevel@tonic-gateprocess or task. If Groups need to be nested within each other, the inner
240Sstevel@tonic-gateGroups can be stored as embedded Perl exacct objects inside the enclosing
250Sstevel@tonic-gateGroup.
260Sstevel@tonic-gate
270Sstevel@tonic-gateThis module contains methods that are common to both Perl exacct Items and
280Sstevel@tonic-gateGroups. The attributes of C<Sun::Solaris::Exacct::Object> and all classes
290Sstevel@tonic-gatederived from it are read-only after initial creation with new(). This behavior
300Sstevel@tonic-gateprevents the inadvertent modification of the attributes that could produce
310Sstevel@tonic-gateinconsistent catalog tags and data values. The only exception is the array
320Sstevel@tonic-gateused to store the Items inside a Group object, which can be modified using the
330Sstevel@tonic-gatenormal Perl array operators. See the C<value()> method below.
340Sstevel@tonic-gate
350Sstevel@tonic-gate=head2 Constants
360Sstevel@tonic-gate
370Sstevel@tonic-gateC<EO_ERROR>, C<EO_NONE>, C<EO_ITEM>, and C<EO_GROUP>.
380Sstevel@tonic-gate
390Sstevel@tonic-gate=head2 Functions
400Sstevel@tonic-gate
410Sstevel@tonic-gateNone.
420Sstevel@tonic-gate
430Sstevel@tonic-gate=head2 Class methods
440Sstevel@tonic-gate
450Sstevel@tonic-gateB<C<dump($object, $filehandle)>>
460Sstevel@tonic-gate
470Sstevel@tonic-gateThis method dumps formatted text representation of a Perl exacct object to the
480Sstevel@tonic-gatesupplied file handle. If no file handle is specified, the text representation
490Sstevel@tonic-gateis dumped to C<STDOUT>. See EXAMPLES below for sample output.
500Sstevel@tonic-gate
510Sstevel@tonic-gate=head2 Object methods
520Sstevel@tonic-gate
530Sstevel@tonic-gateB<C<type()>>
540Sstevel@tonic-gate
550Sstevel@tonic-gateThis method returns the type field of the Perl exacct object. The value of the
560Sstevel@tonic-gatetype field is returned as a dual-typed scalar and is either C<EO_ITEM>,
570Sstevel@tonic-gateC<EO_GROUP>, or C<EO_NONE>.
580Sstevel@tonic-gate
590Sstevel@tonic-gateB<C<catalog()>>
600Sstevel@tonic-gate
610Sstevel@tonic-gateThis method returns the catalog field of the Perl exacct object. The value is
620Sstevel@tonic-gatereturned as a C<Sun::Solaris::Exacct::Catalog> object.
630Sstevel@tonic-gate
640Sstevel@tonic-gateB<C<match_catalog($catalog)>>
650Sstevel@tonic-gate
660Sstevel@tonic-gateThis method matches the passed catalog tag against the object. C<true> is
670Sstevel@tonic-gatereturned of a match occurs. Otherwise C<false> is returned. This method has
680Sstevel@tonic-gatethe same behavior as the underlying C<ea_match_object_catalog(3EXACCT)>
690Sstevel@tonic-gatefunction.
700Sstevel@tonic-gate
710Sstevel@tonic-gateB<C<value()>>
720Sstevel@tonic-gate
730Sstevel@tonic-gateThis method returns the value of the Perl exacct object. In the case of an
740Sstevel@tonic-gateItem, this object will normally be a Perl scalar, either a number or string.
750Sstevel@tonic-gateFor raw Items, the buffer contained inside the object is returned as a Perl
760Sstevel@tonic-gatestring that can be manipulated with the Perl C<unpack()> function. If the Item
770Sstevel@tonic-gatecontains either a nested Item or a nested Group, the enclosed Item is returned
780Sstevel@tonic-gateas a reference to an object of the appropriate subtype of the
790Sstevel@tonic-gateC<Sun::Solaris::Exacct::Object> class.
800Sstevel@tonic-gate
810Sstevel@tonic-gateFor Group objects, if C<value()> is called in a scalar context, the return
820Sstevel@tonic-gatevalue is a reference to the underlying array used to store the component Items
830Sstevel@tonic-gateof the Group. Since this array can be manipulated with the normal Perl array
840Sstevel@tonic-gateindexing syntax and array operators, the objects inside the Group can be
850Sstevel@tonic-gatemanipulated. All objects in the array must be derived from the
860Sstevel@tonic-gateC<Sun::Solaris::Exacct::Object> class. Any attempt to insert something else
870Sstevel@tonic-gateinto the array will generate a fatal runtime error that can be caught with an
880Sstevel@tonic-gateC<eval { }> block.
890Sstevel@tonic-gate
900Sstevel@tonic-gateIf C<value()> is called in a list context for a Group object, it returns a
910Sstevel@tonic-gatelist of all the objects in the Group. Unlike the array reference returned in a
920Sstevel@tonic-gatescalar context, this list cannot be manipulated to add or delete Items from a
930Sstevel@tonic-gateGroup. This mechanism is considerably faster than the array mechanism
940Sstevel@tonic-gatedescribed above and is the preferred mechanism if a Group is being examined in
950Sstevel@tonic-gatea read-only manner.
960Sstevel@tonic-gate
970Sstevel@tonic-gate=head2 Exports
980Sstevel@tonic-gate
990Sstevel@tonic-gateBy default nothing is exported from this module. The following tags can be
1000Sstevel@tonic-gateused to selectively import constants and functions defined in this module:
1010Sstevel@tonic-gate
1020Sstevel@tonic-gate :CONSTANTS   EO_ERROR, EO_NONE, EO_ITEM, and EO_GROUP
1030Sstevel@tonic-gate
1040Sstevel@tonic-gate :ALL         :CONSTANTS
1050Sstevel@tonic-gate
1060Sstevel@tonic-gate=head1 EXAMPLES
1070Sstevel@tonic-gate
1080Sstevel@tonic-gateThe following is an example of output of the C<dump()> method for a Perl exacct
1090Sstevel@tonic-gateGroup object.
1100Sstevel@tonic-gate
1110Sstevel@tonic-gate GROUP
1120Sstevel@tonic-gate   Catalog = EXT_GROUP|EXC_DEFAULT|EXD_GROUP_PROC_PARTIAL
1130Sstevel@tonic-gate   ITEM
1140Sstevel@tonic-gate     Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_PID
1150Sstevel@tonic-gate     Value = 3
1160Sstevel@tonic-gate    ITEM
1170Sstevel@tonic-gate      Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_UID
1180Sstevel@tonic-gate      Value = 0
1190Sstevel@tonic-gate    ITEM
1200Sstevel@tonic-gate      Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_GID
1210Sstevel@tonic-gate      Value = 0
1220Sstevel@tonic-gate    ITEM
1230Sstevel@tonic-gate      Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_PROJID
1240Sstevel@tonic-gate      Value = 0
1250Sstevel@tonic-gate    ITEM
1260Sstevel@tonic-gate      Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_TASKID
1270Sstevel@tonic-gate      Value = 0
1280Sstevel@tonic-gate    ITEM
1290Sstevel@tonic-gate      Catalog = EXT_STRING|EXC_DEFAULT|EXD_PROC_COMMAND
1300Sstevel@tonic-gate      Value = fsflush
1310Sstevel@tonic-gate ENDGROUP
1320Sstevel@tonic-gate
1330Sstevel@tonic-gate=head1 ATTRIBUTES
1340Sstevel@tonic-gate
1350Sstevel@tonic-gateSee C<attributes(5)> for descriptions of the following attributes:
1360Sstevel@tonic-gate
1370Sstevel@tonic-gate  ___________________________________________________________
1380Sstevel@tonic-gate |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
1390Sstevel@tonic-gate |_____________________________|_____________________________|
1400Sstevel@tonic-gate | Availability                | CPAN (http://www.cpan.org)  |
1410Sstevel@tonic-gate |_____________________________|_____________________________|
1420Sstevel@tonic-gate | Interface Stability         | Evolving                    |
1430Sstevel@tonic-gate |_____________________________|_____________________________|
1440Sstevel@tonic-gate
1450Sstevel@tonic-gate=head1 SEE ALSO
1460Sstevel@tonic-gate
1470Sstevel@tonic-gateC<ea_match_object_catalog(3EXACCT)>, C<Sun::Solaris::Exacct(3)>,
1480Sstevel@tonic-gateC<Sun::Solaris::Exacct::Catalog(3)>, C<Sun::Solaris::Exacct::File(3)>,
1490Sstevel@tonic-gateC<Sun::Solaris::Exacct::Object::Group(3)>,
1500Sstevel@tonic-gateC<Sun::Solaris::Exacct::Object::Item(3)>, C<libexacct(3LIB)>, C<attributes(5)>
151