AIX-Perfstat
view release on metacpan or search on metacpan
inc/Devel/CheckLib.pm view on Meta::CPAN
int main(void) { return 0; }
and linking it to the specified libraries. If something pops out the end
which looks executable, then we know that it worked. That tiny program is
built once for each library that you specify, and (without linking) once
for each header file.
=head1 FUNCTIONS
All of these take the same named parameters and are exported by default.
To avoid exporting them, C<use Devel::CheckLib ()>.
=head2 assert_lib
This takes several named parameters, all of which are optional, and dies
with an error message if any of the libraries listed can
not be found. B<Note>: dying in a Makefile.PL or Build.PL may provoke
a 'FAIL' report from CPAN Testers' automated smoke testers. Use
C<check_lib_or_exit> instead.
lib/AIX/Perfstat.pm view on Meta::CPAN
Only valid data is returned (Example: If you call
C<AIX::Perfstat::netinterface(5)> on a machine with only 2 network
interfaces, the returned array will only contain two entries.) When
these functions are called with a variable for the name parameter
the variable will be modified in place to contain the name of the next
available record, or "" if no more records are available.
=head2 EXPORT
None by default.
=head1 SEE ALSO
/usr/include/libperfstat.h
=head1 AUTHOR
If this option is given, a single patch file will be created if
any changes are suggested. This requires a working diff program
to be installed on your system.
=head2 --copy=I<suffix>
If this option is given, a copy of each file will be saved with
the given suffix that contains the suggested changes. This does
not require any external programs.
If neither C<--patch> or C<--copy> are given, the default is to
simply print the diffs for each file. This requires either
C<Text::Diff> or a C<diff> program to be installed.
=head2 --diff=I<program>
Manually set the diff program and options to use. The default
is to use C<Text::Diff>, when installed, and output unified
context diffs.
=head2 --compat-version=I<version>
Tell F<ppport.h> to check for compatibility with the given
Perl version. The default is to check for compatibility with Perl
version 5.003. You can use this option to reduce the output
of F<ppport.h> if you intend to be backward compatible only
up to a certain Perl version.
=head2 --cplusplus
Usually, F<ppport.h> will detect C++ style comments and
replace them with C style comments for portability reasons.
Using this option instructs F<ppport.h> to leave C++
comments untouched.
Don't output any hints. Hints often contain useful portability
notes.
=head2 --nochanges
Don't suggest any changes. Only give diagnostic output and hints
unless these are also deactivated.
=head2 --nofilter
Don't filter the list of input files. By default, files not looking
like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
=head2 --list-provided
Lists the API elements for which compatibility is provided by
F<ppport.h>. Also lists if it must be explicitly requested,
if it has dependencies, and if there are hints for it.
=head2 --list-unsupported
sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL
vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL
To avoid namespace conflicts, you can change the namespace of the
explicitly exported functions using the C<DPPP_NAMESPACE> macro.
Just C<#define> the macro before including C<ppport.h>:
#define DPPP_NAMESPACE MyOwnNamespace_
#include "ppport.h"
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
ok( exists $x->{'processorHZ'} );
ok( exists $x->{'loadavg'} );
cmp_ok( $x->{'processorHZ'}, '>', 0, 'cpu_total processorHZ > 0' );
}
cmp_ok(AIX::Perfstat::cpu_count(), '>=', 1, 'cpu_count must be at least 1');
cmp_ok(AIX::Perfstat::cpu_count(), '==', `lsdev -C -c processor | wc -l`, 'cpu_count agrees with the commandline lsdev count of processors');
{
my $cpu_count = AIX::Perfstat::cpu_count();
cmp_ok(@{AIX::Perfstat::cpu()}+0, '==', 1, 'cpu called with default arguments returns 1 record');
cmp_ok(@{AIX::Perfstat::cpu($cpu_count)} + 0, '==', $cpu_count, 'cpu called with cpu_count for desired number returns cpu_count records');
cmp_ok(@{AIX::Perfstat::cpu($cpu_count+1)} +0, '==', $cpu_count, 'cpu called with cpu_count +1 for desired number returns cpu_count records');
ok( !defined(AIX::Perfstat::cpu(1,"Foo")), 'cpu called with name that does not exist returns undef');
SKIP: {
skip "These tests rely on having more than one processor\n", 2 if ($cpu_count < 2);
my $name = "";
my $x = AIX::Perfstat::cpu(1,$name);
cmp_ok($name, 'eq', "proc1", 'cpu called with a variable of the empty string returns the second processor name in $name');
ok( exists $x->{'number'} );
ok( exists $x->{'size'} );
cmp_ok( $x->{'number'}, '>', 0, 'disk_total number > 0' );
}
cmp_ok(AIX::Perfstat::disk_count(), '>=', 1, 'disk_count must be at least 1');
cmp_ok(AIX::Perfstat::disk_count(), '==', `lsdev -C -t scsd | wc -l` + `lsdev -C -t osdisk | wc -l`, 'disk_count agrees with the commandline lsdev count of disks');
{
my $disk_count = AIX::Perfstat::disk_count();
cmp_ok(@{AIX::Perfstat::disk()}+0, '==', 1, 'disk called with default arguments returns 1 record');
cmp_ok(@{AIX::Perfstat::disk($disk_count)} + 0, '==', $disk_count, 'disk called with disk_count for desired number returns disk_count records');
cmp_ok(@{AIX::Perfstat::disk($disk_count+1)} +0, '==', $disk_count, 'disk called with disk_count +1 for desired number returns disk_count records');
ok( !defined(AIX::Perfstat::disk(1,"Foo")), 'disk called with name that does not exist returns undef');
# SKIP: {
# skip "These tests rely on having more than one disk\n", 2 if ($disk_count < 2);
#
# my $name = "";
# my $x = AIX::Perfstat::disk(1,$name);
# cmp_ok($name, 'eq', "hdisk1", 'disk called with a variable of the empty string returns the second disk name in $name');
t/netinterface.t view on Meta::CPAN
ok( exists $x->{'number'} );
ok( exists $x->{'ipackets'} );
cmp_ok( $x->{'ipackets'}, '>=', 0, 'netinterface_total ipackets >= 0' );
}
cmp_ok(AIX::Perfstat::netinterface_count(), '>=', 0, 'netinterface_count >= 0');
cmp_ok(AIX::Perfstat::netinterface_count(), '==', `ifconfig -l | sed -e 's/ /\\\n/g' | wc -l`, 'netinterface_count agrees with the commandline ifconfig count of network interfaces');
{
my $netinterface_count = AIX::Perfstat::netinterface_count();
cmp_ok(@{AIX::Perfstat::netinterface()}+0, '==', 1, 'netinterface called with default arguments returns 1 record');
cmp_ok(@{AIX::Perfstat::netinterface($netinterface_count)} + 0, '==', $netinterface_count, 'netinterface called with netinterface_count for desired number returns netinterface_count records');
cmp_ok(@{AIX::Perfstat::netinterface($netinterface_count+1)} +0, '==', $netinterface_count, 'netinterface called with netinterface_count +1 for desired number returns netinterface_count records');
ok( !defined(AIX::Perfstat::netinterface(1,"Foo")), 'netinterface called with name that does not exist returns undef');
SKIP: {
skip "These tests rely on having more than one netinterface\n", 2 if ($netinterface_count < 2);
my $name = "";
my $x = AIX::Perfstat::netinterface(1,$name);
if ($netinterface_count == 2)
( run in 0.999 second using v1.01-cache-2.11-cpan-0a6323c29d9 )