AIX-Perfstat

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

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
should make any changes to your code, and whether any special defines
should be used, F<ppport.h> can be run as a Perl script to check your
source code. Simply say:

    perl ppport.h

ppport.h  view on Meta::CPAN

 * data from C.  All statics in extensions should be reworked to use
 * this, if you want to make the extension thread-safe.  See ext/re/re.xs
 * for an example of the use of these macros.
 *
 * Code that uses these macros is responsible for the following:
 * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
 * 2. Declare a typedef named my_cxt_t that is a structure that contains
 *    all the data that needs to be interpreter-local.
 * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
 * 4. Use the MY_CXT_INIT macro such that it is called exactly once
 *    (typically put in the BOOT: section).
 * 5. Use the members of the my_cxt_t structure everywhere as
 *    MY_CXT.member.
 * 6. Use the dMY_CXT macro (a declaration) in all the functions that
 *    access MY_CXT.
 */

#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
    defined(PERL_CAPI)    || defined(PERL_IMPLICIT_CONTEXT)

#ifndef START_MY_CXT

t/cpu.t  view on Meta::CPAN

	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');

		 $name = "proc0";
		 $x = AIX::Perfstat::cpu(1,$name);
		 cmp_ok($name, 'eq', "proc1", 'cpu called with a variable of the first processor name returns the second processor name in $name');
	}
	#setup name so we are asking for the last processor.
	my $name = "proc".($cpu_count-1);
	my $x = AIX::Perfstat::cpu(1,$name);
	cmp_ok($name, 'eq', "", 'cpu called with a variable of the last processor name returns the empty string in $name');

	$name = "";
	$x = AIX::Perfstat::cpu($cpu_count, $name);
	cmp_ok($name, 'eq', "", 'cpu called with the empty string and requesting all processors returns the empty string in $name');
}

t/disk.t  view on Meta::CPAN

	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');

#		 $name = "hdisk0";
#		 $x = AIX::Perfstat::disk(1,$name);
#		 cmp_ok($name, 'eq', "hdisk1", 'disk called with a variable of the first disk name returns the second disk name in $name');
#	}
#	#setup name so we are asking for the last disk.
#	my $name = "";
#	my $x = AIX::Perfstat::disk($disk_count-1,$name);

#	$x = AIX::Perfstat::disk(1,$name);
#	cmp_ok($name, 'eq', "", 'disk called with a variable of the last disk name returns the empty string in $name');

	$name = "";
	my $x = AIX::Perfstat::disk($disk_count, $name);

t/netinterface.t  view on Meta::CPAN

	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)
		 {
			  #We probably only have en0 and lo0
			  cmp_ok($name, 'eq', "lo0", 'netinterface called with a variable of the empty string returns the second netinterface name in $name');

			  $name = "en0";
			  $x = AIX::Perfstat::netinterface(1,$name);
			  cmp_ok($name, 'eq', "lo0", 'netinterface called with a variable of the first netinterface name returns the second netinterface name in $name');
		 }
		 else
		 {
			  cmp_ok($name, 'eq', "en1", 'netinterface called with a variable of the empty string returns the second netinterface name in $name');

			  $name = "en0";
			  $x = AIX::Perfstat::netinterface(1,$name);
			  cmp_ok($name, 'eq', "en1", 'netinterface called with a variable of the first netinterface name returns the second netinterface name in $name');
		 }
	}
	#setup name so we are asking for the last netinterface.
	my $name = "";
	my $x = AIX::Perfstat::netinterface($netinterface_count-1,$name);

	$x = AIX::Perfstat::netinterface(1,$name);
	cmp_ok($name, 'eq', "", 'netinterface called with a variable of the last netinterface name returns the empty string in $name');

	$name = "";



( run in 0.841 second using v1.01-cache-2.11-cpan-39bf76dae61 )