AIX-Perfstat
view release on metacpan or search on metacpan
inc/Devel/CheckLib.pm view on Meta::CPAN
# redirect to nowhere
local *DEV_NULL;
open DEV_NULL, ">" . File::Spec->devnull
or die "CheckLib: $! opening handle to null device";
open STDOUT, ">&" . fileno DEV_NULL
or die "CheckLib: $! redirecting STDOUT to null handle";
open STDERR, ">&" . fileno DEV_NULL
or die "CheckLib: $! redirecting STDERR to null handle";
# run system command
my $rv = system(@cmd);
# restore handles
open STDOUT, ">&" . fileno STDOUT_SAVE
or die "CheckLib: $! restoring STDOUT handle";
open STDERR, ">&" . fileno STDERR_SAVE
or die "CheckLib: $! restoring STDERR handle";
return $rv;
}
call_method|5.006000||p
call_pv|5.006000||p
call_sv|5.006000||p
calloc||5.007002|n
cando|||
cast_i32||5.006000|
cast_iv||5.006000|
cast_ulong||5.006000|
cast_uv||5.006000|
check_uni|||
checkcomma|||
checkposixcc|||
ck_anoncode|||
ck_bitop|||
ck_concat|||
ck_defined|||
ck_delete|||
ck_die|||
ck_eof|||
ck_eval|||
ck_exec|||
my $x = AIX::Perfstat::cpu_total();
ok( defined $x, 'cpu_total returned a defined value');
ok( exists $x->{'ncpus'} );
ok( exists $x->{'description'} );
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);
#Using anonymous blocks to avoid polluting the symbol table.
{
my $x = AIX::Perfstat::disk_total();
ok( defined $x, 'disk_total returned a defined value');
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);
t/netinterface.t view on Meta::CPAN
#Using anonymous blocks to avoid polluting the symbol table.
{
my $x = AIX::Perfstat::netinterface_total();
ok( defined $x, 'netinterface_total returned a defined value');
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);
( run in 0.908 second using v1.01-cache-2.11-cpan-f56aa216473 )