Unix-Processors-2.046/0000755000177100017500000000000013153245132014562 5ustar wsnyderwsnyderUnix-Processors-2.046/MANIFEST.SKIP0000644000177100017500000000022212621511544016456 0ustar wsnyderwsnyder^CVS/ ^.git/ /CVS/ pm_to_blib$ MYMETA.yml MYMETA.json ,v$ \.(bak|new|old)$ \bMakefile$ \.o$ \.c$ \.bs$ \.tar\. \bblib\b \.svn/ ^(.*/)?MYMETA\..*$ Unix-Processors-2.046/.gitignore0000644000177100001440000000014411752623640016222 0ustar wsnyderusersblib Makefile Makefile.old pm_to_blib Processors.c README *.bs *.tar.gz *.old *.o test_dir MYMETA.* Unix-Processors-2.046/typemap0000644000177100001440000000042310530657457015642 0ustar wsnyderusersTYPEMAP CpuNumFromRef_t INT_REF_OBJECT INPUT INT_REF_OBJECT if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) $var = ($type)SvIV((SV*)SvRV( $arg )); else{ warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } Unix-Processors-2.046/Processors/0000755000177100017500000000000013153245132016724 5ustar wsnyderwsnyderUnix-Processors-2.046/Processors/Info.pm0000644000177100017500000000305213153245074020162 0ustar wsnyderwsnyder# Unix::Processors::Info # See copyright, etc in below POD section. ###################################################################### =head1 NAME Unix::Processors::Info - Interface to processor (CPU) information =head1 SYNOPSIS use Unix::Processors; ... $aproc = $proc->processors[0]; print ($aproc->id, $aproc->state, $aproc->clock); } =head1 DESCRIPTION This package provides access to per-processor (CPU) information from the operating system in a OS independent manner. =over 4 =item id Return the cpu number of this processor. =item clock Return the clock frequency in MHz. =item state Return the cpu state as "online", "offline", or "poweroff". =item type Return the cpu type. =back =head1 DISTRIBUTION The latest version is available from CPAN and from L. Copyright 1999-2017 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. =head1 AUTHORS Wilson Snyder =head1 SEE ALSO L =cut package Unix::Processors::Info; require DynaLoader; @ISA = qw(DynaLoader); use strict; use vars qw($VERSION); ###################################################################### #### Configuration Section $VERSION = '2.046'; ###################################################################### #### Code #It's all in C ###################################################################### #### Package return 1; Unix-Processors-2.046/META.yml0000644000177100017500000000077713153245074016053 0ustar wsnyderwsnyder--- #YAML:1.0 name: Unix-Processors version: 2.046 version_from: Processors.pm abstract: Interface to processor (CPU) information license: perl installdirs: site author: - Wilson Snyder resources: homepage: http://www.veripool.org requires: Test: 1 warnings: 1 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 distribution_type: module generated_by: hand Unix-Processors-2.046/Makefile.PL0000644000177100017500000000352513100136231016530 0ustar wsnyderwsnyder# DESCRIPTION: Perl ExtUtils: Type 'perl Makefile.PL' to create a Makefile for this package # # Copyright 1998-2017 by Wilson Snyder. This program is free software; # you can redistribute it and/or modify it under the terms of either the GNU # Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. use ExtUtils::MakeMaker; use Carp; sub MY::postamble { q{ README: readme.texi -$(RM_RF) $@ makeinfo $< --output $@ --no-headers --no-validate ## Maintainer use: preexist: svnorcvs nexists $(DISTNAME)_$(VERSION_SYM) test -s README tag: svnorcvs tag $(DISTNAME)_$(VERSION_SYM) maintainer-diff: svnorcvs diff $(DISTNAME)_$(VERSION_SYM) maintainer-dist: preexist dist tag svnorcvs release $(DISTVNAME).tar.gz maintainer-clean: distclean -$(RM_RF) README Makefile dist: distcheck README }; } # Check for AIX libraries and headers required to support this package # System calls: perfstat_cpu_total, # /usr/include/libperfstat.h # /usr/lib/libperfstat.a my $ARCH = `uname`; chomp($ARCH); my $libs; my $defs; my $incs; if ($ARCH eq "AIX") { print "\nChecking for required AIX components...\n"; my $has_perfstat; if (-f "/usr/include/libperfstat.h") { print " - libperfstat.a appears to be installed\n"; $libs = "-lperfstat"; $defs = "-DHAS_PERFSTAT"; $has_perfstat = 1; } else { print " - libperfstat.a is not installed\n"; } print "\n"; } WriteMakefile( NAME => "Unix::Processors", AUTHOR => 'Wilson Snyder ', ABSTRACT_FROM => 'Processors.pm', VERSION_FROM => 'Processors.pm', NO_META => 1, DISTNAME => 'Unix-Processors', LIBS => $libs, DEFINE => $defs, 'dist' => {COMPRESS => 'gzip -9f', SUFFIX => '.gz', DIST_DEFAULT => 'README all tardist', }, ); Unix-Processors-2.046/COPYING0000644000177100001440000002156111177646673015307 0ustar wsnyderusersArtistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ******** This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions *********** "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution ******************************************************** (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version ****************************************************** (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source ********************************************************** (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified ****************************************************************** Versions without the Source *************************** (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package ********************************** (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version ******************************************************** (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions ****************** (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Unix-Processors-2.046/README0000644000177100017500000000416713100136231015441 0ustar wsnyderwsnyder1 Unix::Processors ****************** This is the Unix::Processors Perl Package. 1.1 Copyright ============= This package is Copyright 1999-2017 by Wilson Snyder . This program is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. This code is provided with no warranty of any kind, and is used entirely at your own risk. 1.2 Description =============== This package provides access to per-processor information from Perl. my $procs = new Unix::Processors; print $procs->max_online, " CPUs at ", $procs->max_clock, " MHz\n"; if ($procs->max_online != $procs->max_physical) { print "Hyperthreading between ",$procs->max_physical," physical CPUs.\n"; } (my $FORMAT = "%2s %-8s %4s \n") =~ s/\s\s+/ /g; printf($FORMAT, "#", "STATE", "CLOCK", "TYPE", ); foreach my $proc (@{$procs->processors}) { printf ($FORMAT, $proc->id, $proc->state, $proc->clock, $proc->type); } See `man Unix::Processors' after installation. 1.3 Obtaining Distribution ========================== The latest version is available at `http://www.perl.org/CPAN/' Download the latest package from that site, and decompress. `gunzip Unix-Processors_version.tar.gz ; tar xvf Unix-Processors_version.tar' 1.4 Supported Systems ===================== This version of Unix::Processors has been built and tested on: * i386-linux * aix-4.3.3 * aix-5.1.0 (32 and 64 bit) * alpha-osf * freebsd (clock methods not supported before freebsd 5.4) * hpux-11.00 * hpux-11.11 * sgi-irix * sparc-sun-solaris2.6 * sparc-sun-solaris2.8 Porting will definately be necessary for other operating systems. 1.5 Installation ================ 1. `cd' to the directory containing this README notice. 2. Type `perl Makefile.PL' to configure Unix::Processors for your system. 3. Type `make' to compile Unix::Processors. 4. Type `make install' to install the programs and any data files and documentation. Unix-Processors-2.046/readme.texi0000644000177100017500000000553613100136231016712 0ustar wsnyderwsnyder\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename readme.info @settitle Perl Unix::Processors Installation @c %**end of header @c DESCRIPTION: TexInfo: DOCUMENT source run through texinfo to produce README file @c Use 'make README' to produce the output file @c Before release, run C-u C-c C-u C-a (texinfo-all-menus-update) @node Top, Copyright, (dir), (dir) @chapter Unix::Processors This is the Unix::Processors Perl Package. @menu * Copyright:: * Description:: * Obtaining Distribution:: * Supported Systems:: * Installation:: @end menu @node Copyright, Description, Top, Top @section Copyright This package is Copyright 1999-2017 by Wilson Snyder @email{wsnyder@@wsnyder.org}. This program is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. This code is provided with no warranty of any kind, and is used entirely at your own risk. @node Description, Obtaining Distribution, Copyright, Top @section Description This package provides access to per-processor information from Perl. @example my $procs = new Unix::Processors; print $procs->max_online, " CPUs at ", $procs->max_clock, " MHz\n"; if ($procs->max_online != $procs->max_physical) @{ print "Hyperthreading between ",$procs->max_physical," physical CPUs.\n"; @} (my $FORMAT = "%2s %-8s %4s \n") =~ s/\s\s+/ /g; printf($FORMAT, "#", "STATE", "CLOCK", "TYPE", ); foreach my $proc (@@@{$procs->processors@}) @{ printf ($FORMAT, $proc->id, $proc->state, $proc->clock, $proc->type); @} @end example See @samp{man Unix::Processors} after installation. @node Obtaining Distribution, Supported Systems, Description, Top @section Obtaining Distribution The latest version is available at @uref{http://www.perl.org/CPAN/} Download the latest package from that site, and decompress. @samp{gunzip Unix-Processors_version.tar.gz ; tar xvf Unix-Processors_version.tar} @node Supported Systems, Installation, Obtaining Distribution, Top @section Supported Systems This version of Unix::Processors has been built and tested on: @itemize @bullet @item i386-linux @item aix-4.3.3 @item aix-5.1.0 (32 and 64 bit) @item alpha-osf @item freebsd (clock methods not supported before freebsd 5.4) @item hpux-11.00 @item hpux-11.11 @item sgi-irix @item sparc-sun-solaris2.6 @item sparc-sun-solaris2.8 @end itemize Porting will definately be necessary for other operating systems. @node Installation, , Supported Systems, Top @section Installation @enumerate @item @code{cd} to the directory containing this README notice. @item Type @samp{perl Makefile.PL} to configure Unix::Processors for your system. @item Type @samp{make} to compile Unix::Processors. @item Type @samp{make install} to install the programs and any data files and documentation. @end enumerate Unix-Processors-2.046/Changes0000644000177100017500000000573213153245057016072 0ustar wsnyderwsnyderRevision history for Perl extension Unix::Processors The contributors that suggested a given feature are shown in []. * Unix::Processors 2.046 2017-09-04 **** Fix FreeBSD support, rt122943. [Slaven Rezic] * Unix::Processors 2.045 2017-04-26 **** Fix tests '.' for Perl 5.26.0, rt121025. [Dan Collins] * Unix::Processors 2.044 2015-11-13 **** Fix MYMETA packaging, rt108783. [Alexandr Ciornii] * Unix::Processors 2.043 2014-09-11 **** Fix Pod::Usage dependency, rt51024. [Andreas Koenig] **** Fix manifest warning. * Unix::Processors 2.042 2010-01-22 **** Support Mac OSX, rt53894. [Justin Case] * Unix::Processors 2.041 2009-05-08 ** This package is now licensed under LGPL v3 and/or Artistic v2.0. * Unix::Processors 2.040 2008-08-14 *** Added max_socket call, for number of CPU sockets. *** Fix max_physical wrong result on AMD Phenom quad-core Linux. * Unix::Processors 2.034 2007-01-02 *** Fix Linux on MIPS support. * Unix::Processors 2.033 2005-07-11 *** Fix Mac OS X Panther and Tiger support. * Unix::Processors 2.032 2005-01-07 *** Added support for Itanium irelinux. [by Tim Berke] * Unix::Processors 2.031 2005-23-05 **** Fix C++ Comments [Merijn Brand] * Unix::Processors 2.030 2005-01-04 ** NEWS is now renamed Changes, to support CPAN indexing. [Offer Kaye] *** Fix max_clock and clock for BSD 5.4 and newer. [by Daniel Gustafson] * Unix::Processors 2.022 2004-13-09 **** Documentation updates. * Unix::Processors 2.021 2004-05-04 *** Hyperthreading detection added for FreeBSD [by Daniel Gustafson] * Unix::Processors 2.020 2004-04-03 ** Added max_physical for detecting number of CPUs ignoring hyperthreading. * Unix::Processors 2.015 2004-27-01 **** Documentation fixes. * Unix::Processors 2.014 2003-12-05 *** Irix/FreeBSD port fixes. [by Daniel Gustafson] * Unix::Processors 2.013 2003-05-05 *** Add support for SGI Irix and some FreeBSD. [by Daniel Gustafson] * Unix::Processors 2.011 2003-02-01 *** Fix type and frequency for AIX and HPUX. [by Reid Madsen] * Unix::Processors 2.010 2002-30-12 ** Added support for AIX, HPUX, MIPS, Alpha. [by Reid Madsen] **** Major version bump only because '1.10' < '1.9' * Unix::Processors 1.9 2002-08-30 **** README updates * Unix::Processors 1.8 2001-02-13 **** Makefile.PL updates for testing * Unix::Processors 1.7 2000-01-21 **** VERSION into Processors.pm, AUTHOR into Makefile.PL * Unix::Processors 1.6 2000-01-17 ** First CPAN Release ---------------------------------------------------------------------- DESCRIPTION: Documentation on change history for this package ---------------------------------------------------------------------- This uses outline mode in Emacs. See C-h m [M-x describe-mode]. Copyright 1999-2017 by Wilson Snyder. This program is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. Local variables: mode: outline paragraph-separate: "[ \f\n]*$" end: Unix-Processors-2.046/MANIFEST0000644000177100017500000000031012621511544015707 0ustar wsnyderwsnyder.gitignore Changes COPYING Makefile.PL MANIFEST MANIFEST.SKIP META.yml Processors.pm Processors.xs Processors/Info.pm README readme.texi t/00_pod.t t/01_manifest.t t/20_test.t t/test_utils.pl typemap Unix-Processors-2.046/Processors.pm0000644000177100017500000000630613153245074017274 0ustar wsnyderwsnyder# Unix::Processors # See copyright, etc in below POD section. ###################################################################### =head1 NAME Unix::Processors - Interface to processor (CPU) information =head1 SYNOPSIS use Unix::Processors; my $procs = new Unix::Processors; print "There are ", $procs->max_online, " CPUs at ", $procs->max_clock, "\n"; if ($procs->max_online != $procs->max_physical) { print "Hyperthreading between ",$procs->max_physical," physical CPUs.\n"; } (my $FORMAT = "%2s %-8s %4s \n") =~ s/\s\s+/ /g; printf($FORMAT, "#", "STATE", "CLOCK", "TYPE", ); foreach my $proc (@{$procs->processors}) { printf ($FORMAT, $proc->id, $proc->state, $proc->clock, $proc->type); } =head1 DESCRIPTION This package provides accessors to per-processor (CPU) information. The object is obtained with the Unix::Processors::processors call. the operating system in a OS independent manner. =over 4 =item max_online Return number of threading processors currently online. On hyperthreaded Linux systems, this indicates the maximum number of simultaneous threads that may execute; see max_physical for the real physical CPU count. =item max_physical Return number of physical processor cores currently online. For example, a single chip quad-core processor returns four. =item max_socket Returns the number of populated CPU sockets, if known, else the same number as max_physical. For example, a single chip quad-core processor returns one. =item max_clock Return the maximum clock speed across all online processors. Not all OSes support this call. =item processors Return an array of processor references. See the Unix::Processors::Info manual page. Not all OSes support this call. =back =head1 DISTRIBUTION The latest version is available from CPAN and from L. Copyright 1999-2017 by Wilson Snyder. This package is free software; you you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. =head1 AUTHORS Wilson Snyder =head1 SEE ALSO L, L =cut package Unix::Processors; use Unix::Processors::Info; $VERSION = '2.046'; require DynaLoader; @ISA = qw(DynaLoader); use strict; use Carp; ###################################################################### #### Configuration Section bootstrap Unix::Processors; ###################################################################### #### Accessors sub new { # NOP for now, just need a handle for other routines @_ >= 1 or croak 'usage: Unix::Processors->new ({options})'; my $proto = shift; my $class = ref($proto) || $proto; my $self = {@_,}; bless $self, $class; return $self; } sub processors { my $self = shift; ($self && ref($self)) or croak 'usage: $self->max_online()'; my @list; for (my $cnt=0; $cnt<64; $cnt++) { my $val = $cnt; my $vref = \$val; # Just a reference to a cpu number bless $vref, 'Unix::Processors::Info'; if ($vref->type) { push @list, $vref; } } return \@list; } ###################################################################### #### Package return 1; Unix-Processors-2.046/Processors.xs0000644000177100017500000004760013153244667017323 0ustar wsnyderwsnyder#/* -*- Mode: C -*- */ #/* Author: Wilson Snyder */ #/* IRIX & FreeBSD port by: Daniel Gustafson */ #/*##################################################################### */ #/* */ #/* Copyright 1999-2017 by Wilson Snyder. This program is free software; */ #/* you can redistribute it and/or modify it under the terms of either the GNU */ #/* Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. */ #/* */ #/* This program is distributed in the hope that it will be useful, */ #/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ #/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ #/* GNU General Public License for more details. */ #/* */ #/*##################################################################### */ #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include #include #include #include #if defined(_AIX) # define AIX #endif #if defined(hpux) || defined(__hpux) # define HPUX #endif #if defined(__osf__) && (defined(__alpha) || defined(__alpha__)) # define OSF_ALPHA #endif #if defined(__mips) # define MIPS # if defined(sgi) # define IRIX # endif #endif #if defined(sun) || defined(__sun__) # define SUNOS #endif #ifdef AIX # ifdef HAS_PMAPI # include # endif # ifdef HAS_PERFSTAT # include # endif #endif #ifdef HPUX #include #include struct pst_dynamic psd; #endif #ifdef OSF_ALPHA #include #include #endif #if defined(MIPS) && !defined(__linux__) #include #endif #ifdef IRIX #include #include #include #include #include #include #include #include #endif #ifdef SUNOS #include #endif #if defined(__FreeBSD__) || defined(__APPLE__) #include #include #include #include #endif /* Missing in older headers */ #ifndef P_POWEROFF #define P_POWEROFF 5 #endif typedef int CpuNumFromRef_t; #/**************************************************************/ #ifdef __linux__ const char* proc_cpuinfo_field (const char *field) /* Return string from a field of /proc/cpuinfo, NULL if not found */ /* Comparison is case insensitive */ /* If multiple matches, the last match is returned */ { FILE* fp; static char line[1000]; static char result[1000]; int len = strlen(field); char* resultp = NULL; if (NULL!=(fp = fopen ("/proc/cpuinfo", "r"))) { while (!feof(fp)) { const char* ok = fgets (line, 990, fp); if (ok && 0==strncasecmp (field, line, len)) { char *loc = strchr (line, ':'); if (loc) { strncpy(result,loc+2, 990); resultp = result; loc = strchr (result, '\n'); if (loc) *loc = '\0'; /*printf("MATCH: %s: %s\n", field, resultp);*/ } } } fclose(fp); } return (resultp); } int _proc_cpuinfo_clock_calc (void) { const char* value; value = proc_cpuinfo_field ("cpu MHz"); if (value) return (atoi(value)); value = proc_cpuinfo_field ("clock"); if (value) return (atoi(value)); value = proc_cpuinfo_field ("bogomips"); if (value) return (atoi(value)); return (0); } int proc_cpuinfo_clock (void) /* Return clock frequency */ { static int cache = 0; if (!cache) cache = _proc_cpuinfo_clock_calc(); return cache; } #endif int _proc_nthreaders_calc (void) { int num_cpus = 0; /* Determine how many processors are online and available */ #ifdef HPUX if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) != -1) num_cpus = psd.psd_proc_cnt; #endif #ifdef OSF_ALPHA getsysinfo(GSI_CPUS_IN_BOX,&num_cpus,sizeof(num_cpus),0,0) #endif #if defined(MIPS) && !defined(__linux__) char buf[16]; if (sysinfo(_MIPS_SI_NUM_PROCESSORS, buf, 10) != -1) num_cpus = atoi(buf); #endif /* Generic linux defaults */ #if defined(SUNOS) || defined(AIX) || defined(__APPLE__) || defined (__linux__) if (num_cpus < 1) num_cpus = sysconf(_SC_NPROCESSORS_ONLN); # ifdef __linux__ if (num_cpus < 1) { /* SPARC Linux has a bug where SC_NPROCESSORS is set to 0. */ const char* value = proc_cpuinfo_field("ncpus active"); if (value) num_cpus = atoi(value); } # endif #endif #if defined(__FreeBSD__) || defined(HW_NCPU) size_t len = sizeof(num_cpus); sysctlbyname("hw.ncpu", &num_cpus, &len, NULL, 0); #endif if (num_cpus < 1) num_cpus=1; /* We're running this program, after all :-) */ return (num_cpus); } int proc_nthreaders (void) /* Return number of processor threads */ { static int cache = 0; if (!cache) cache = _proc_nthreaders_calc(); return cache; } #ifdef IRIX /* invent_cpuinfo_t irix_get_cpuinf(int cpuid); * Returns an invent_cpuinfo_t regarding the requested cpuid. */ invent_cpuinfo_t irix_get_cpuinf(int cpuid) { union { invent_generic_t generic; invent_cpuinfo_t cpu; } hw_inv; int attr_len = sizeof(hw_inv); DIR *hw_graph; struct dirent *hw_entry; char *hw_entry_buf = (char *)malloc(MAXPATHLEN); char *hw_filename = (char *)malloc(MAXPATHLEN); if ((hw_graph = opendir("/hw/cpunum")) != NULL) { while ((hw_entry = readdir(hw_graph)) != NULL) { if ((strcmp(hw_entry->d_name, ".") != 0) && (strcmp(hw_entry->d_name, "..") != 0)) { strcpy(hw_filename, "/hw/cpunum/"); strncat(hw_filename, hw_entry->d_name, 1); if (realpath(hw_filename, hw_entry_buf) != NULL) { if (attr_get(hw_entry_buf, INFO_LBL_DETAIL_INVENT, (char *)&hw_inv, &attr_len, 0) == 0) { if (hw_inv.generic.ig_invclass == INV_PROCESSOR) { if (hw_inv.cpu.ic_cpuid == cpuid) { break; } } } } } } } closedir(hw_graph); return(hw_inv.cpu); } #endif int logical_per_physical_cpu() { int logical_per = 1; #ifdef __linux__ const char* flags = proc_cpuinfo_field ("flags"); /* flags: ... ht ... indicates hyperthreading enabled on a cpu */ if (flags && strstr (flags, " ht ")) { /* HACK: Current linux under hyperthreading always makes 2 logical CPUs per physical CPU */ logical_per = 2; } #endif #ifdef __FreeBSD__ int hlt_htt_cpu = 0; size_t len = sizeof(hlt_htt_cpu); if (sysctlbyname("machdep.hlt_logical_cpus", &hlt_htt_cpu, &len, NULL, 0) == 0) { if (hlt_htt_cpu == 0) { /* HACK: Current FreeBSD under hyperthreading always makes 2 logical CPUs per physical CPU */ logical_per = 2; } } #endif return logical_per; } int proc_num_physical_ids() { #ifdef __linux__ { const char* value = proc_cpuinfo_field ("physical id"); if (value) { int phys = atoi(value)+1; return phys; } } #endif return 0; } int _proc_ncores_calc() { /* Can't have more cores than threaders */ int num = proc_nthreaders(); #ifdef __linux__ { int phys = proc_num_physical_ids(); const char* cvalue = proc_cpuinfo_field ("cpu cores"); if (phys && cvalue) { int cores_per_phys = atoi(cvalue); int cores = phys * cores_per_phys; if (cores && (cores <= num)) return cores; } } #endif { /* If hyperthreading, the threader count is too high */ if (num > 1) { num /= logical_per_physical_cpu(); } return num; } } int proc_ncores() { /* Return number of processor cores */ static int cache = 0; if (!cache) cache = _proc_ncores_calc(); return cache; } int _proc_nsockets_calc() { int num = proc_ncores(); /* default to core count, trim downwards if we can */ int phys = proc_num_physical_ids(); if (phys && ((phys <= num))) num = phys; return num; } int proc_nsockets() { /* Return number of processor sockets */ static int cache = 0; if (!cache) cache = _proc_nsockets_calc(); return cache; } MODULE = Unix::Processors PACKAGE = Unix::Processors #/**********************************************************************/ #/* class->max_online() */ #/* Self is a argument, but we don't need it */ #/* We use sysconf, as that is more portable */ #/* Other packages also provide sysconf, but saves downloading them... */ long max_online(self) SV *self; CODE: { if (self) {} /* Prevent unused warning */ RETVAL = proc_nthreaders(); } OUTPUT: RETVAL #/**********************************************************************/ #/* class->max_physical() */ #/* Self is a argument, but we don't need it */ long max_physical(self) SV *self; CODE: { if (self) {} /* Prevent unused warning */ RETVAL = proc_ncores(); } OUTPUT: RETVAL #/**********************************************************************/ #/* class->max_socket() */ #/* Self is a argument, but we don't need it */ long max_socket(self) SV *self; CODE: { if (self) {} /* Prevent unused warning */ RETVAL = proc_nsockets(); } OUTPUT: RETVAL #/**********************************************************************/ #/* class->max_clock() */ #/* Self is a argument, but we don't need it */ int max_clock(self) SV *self; CODE: { int clock = 0; #ifdef AIX # if defined(HAS_PERFSTAT) perfstat_cpu_total_t data; if (perfstat_cpu_total (0, &data, sizeof(data), 1)) { clock = data.processorHZ / 1000000; } # elif defined(HAS_PMAPI) /* pm_cycles uses an approximation to arrive at cycle time * so we round up to the nearest Mhz */ clock = (int)((pm_cycles() + 500000) / 1000000); # endif #endif #ifdef HPUX /* all processors have the same clock on HP - just report the first one */ struct pst_processor psp; if (pstat_getprocessor(&psp, sizeof(psp), 1, 0)) { clock = psp.psp_iticksperclktick / 10000; } #endif #ifdef SUNOS int cpu; int last_cpu = 0; processor_info_t info, *infop=&info; for (cpu=0; cpu < last_cpu+16; cpu++) { if (processor_info (cpu, infop)==0 && infop->pi_state == P_ONLINE) { if (clock < infop->pi_clock) { clock = infop->pi_clock; } last_cpu = cpu; } } #endif #ifdef IRIX int num_cpus = proc_nthreaders(); if ((num_cpus > 0) && (num_cpus < 3)) { inventory_t *sys_invent; if (setinvent() != -1) { for (sys_invent = getinvent(); (sys_invent); sys_invent = getinvent()) { if ((sys_invent->inv_class == INV_PROCESSOR) && (sys_invent->inv_type == INV_CPUBOARD)) { clock = sys_invent->inv_controller; break; } } endinvent(); } } else { invent_cpuinfo_t cpu_info; int i; for (i = 0; i < proc_nthreaders(); i++) { cpu_info = irix_get_cpuinf(i); if (cpu_info.ic_cpuid == i) if (cpu_info.ic_cpu_info.cpufq > clock) clock = cpu_info.ic_cpu_info.cpufq; } } #endif #if (defined(__FreeBSD__) && (__FreeBSD_version >= 503105)) int value = 0; size_t len = sizeof(value); /* * Even if the frequency is modified using cpu_freq(3), all cpus * have the same value why we can request CPU 0 for max_clock. */ if (sysctlbyname("dev.cpu.0.freq", &value, &len, NULL, 0) == 0) { clock = value; } #elif defined(HW_CPU_FREQ) long long value = 0; size_t len = sizeof(value); if (sysctlbyname("hw.cpufrequency", &value, &len, NULL, 0) == 0) { clock = value; } #endif #ifdef __linux__ int value = proc_cpuinfo_clock(); if (value) clock = value; #endif if (self) {} /* Prevent unused warning */ RETVAL = clock; } OUTPUT: RETVAL #/**********************************************************************/ #/**********************************************************************/ #/**********************************************************************/ #/**********************************************************************/ #/**********************************************************************/ MODULE = Unix::Processors PACKAGE = Unix::Processors::Info #/**********************************************************************/ #/* class->id() */ int id (cpu) CpuNumFromRef_t cpu PROTOTYPE: $ CODE: { RETVAL = cpu; } OUTPUT: RETVAL #/**********************************************************************/ #/* class->clock() */ SV * clock (cpu) CpuNumFromRef_t cpu PROTOTYPE: $ CODE: { int value = 0; #ifdef AIX int num_cpus = proc_nthreaders(); if (cpu < num_cpus) { # if defined(HAS_PERFSTAT) perfstat_cpu_total_t data; if (perfstat_cpu_total (0, &data, sizeof(data), 1)) { value = data.processorHZ / 1000000; } # elif defined(HAS_PMAPI) /* pm_cycles uses an approximation to arrive at cycle time * so we round up to the nearest Mhz */ clock = (int)((pm_cycles() + 500000) / 1000000); # endif } #endif #ifdef HPUX int num_cpus = proc_nthreaders(); if (cpu < num_cpus) { /* all processors have the same clock on HP - just report the first one */ struct pst_processor psp; if (pstat_getprocessor(&psp, sizeof(psp), 1, 0)) { value = psp.psp_iticksperclktick / 10000; } } #endif #ifdef SUNOS processor_info_t info, *infop=&info; if (processor_info (cpu, infop)==0) { value = infop->pi_clock; } #endif #ifdef IRIX int num_cpus = proc_nthreaders(); if ((num_cpus > 0) && (num_cpus < 3)) { inventory_t *sys_invent; if (setinvent() != -1) { while ((sys_invent = getinvent()) != NULL) { if ((sys_invent->inv_class == INV_PROCESSOR) && (sys_invent->inv_type == INV_CPUBOARD)) { value = sys_invent->inv_controller; break; } } endinvent(); } } else { invent_cpuinfo_t cpu_info; cpu_info = irix_get_cpuinf(cpu); if (cpu_info.ic_cpuid == cpu) value = cpu_info.ic_cpu_info.cpufq; } #endif #if (defined(__FreeBSD__) && (__FreeBSD_version >= 503105)) int cpu_freq = 0; size_t len = sizeof(cpu_freq); char cpu_freq_req[16]; snprintf(cpu_freq_req, 16, "dev.cpu.%d.freq", cpu); if (sysctlbyname(cpu_freq_req, &cpu_freq, &len, NULL, 0) == 0) { value = cpu_freq; } #endif #ifdef __linux__ /* Cheat... Same clock for every CPU */ value = proc_cpuinfo_clock(); #endif if (value) { ST(0) = sv_newmortal(); sv_setiv (ST(0), value); } else { ST(0) = &PL_sv_undef; } } #/**********************************************************************/ #/* class->state() */ SV * state (cpu) CpuNumFromRef_t cpu PROTOTYPE: $ CODE: { char *value = NULL; #ifdef SUNOS processor_info_t info, *infop=&info; if (processor_info (cpu, infop)==0) { switch (infop->pi_state) { case P_ONLINE: value = "online"; break; case P_OFFLINE: value = "offline"; break; case P_POWEROFF: value = "poweroff"; break; } } #endif #ifdef IRIX int num_cpus; if ((num_cpus = sysmp(MP_NPROCS)) != -1) { struct pda_stat proc_info[num_cpus]; if (sysmp(MP_STAT, proc_info) != -1) { if (proc_info[cpu].p_flags == PDAF_MASTER) value = "MASTER"; else if (proc_info[cpu].p_flags == PDAF_CLOCK) value = "CLOCK"; else if (proc_info[cpu].p_flags == PDAF_ENABLED) value = "ENABLED"; else if (proc_info[cpu].p_flags == PDAF_FASTCLOCK) value = "FASTCLOCK"; else if (proc_info[cpu].p_flags == PDAF_ISOLATED) value = "ISOLATED"; else if (proc_info[cpu].p_flags == PDAF_BROADCAST_OFF) value = "BROADCAST_OFF"; else if (proc_info[cpu].p_flags == PDAF_NONPREEMPTIVE) value = "NONPREEMPTIVE"; else if (proc_info[cpu].p_flags == PDAF_NOINTR) value = "NOINTR"; else if (proc_info[cpu].p_flags == PDAF_ITHREADSOK) value = "ITHREADSOK"; else if (proc_info[cpu].p_flags == PDAF_DISABLE_CPU) value = "DISABLE_CPU"; else if (proc_info[cpu].p_flags == PDAF_EXCLUDED) value = "EXCLUDED"; else /* * No p_flags value is specified for uniprocessor * systems. Return ONLINE. */ value = "ONLINE"; } } #endif /* Cheat... Assume all online */ if (value == NULL) value = "online"; /* Return it */ if (value) { ST(0) = sv_newmortal(); sv_setpv (ST(0), value); } else { ST(0) = &PL_sv_undef; } } #/**********************************************************************/ #/* class->type() */ SV * type (cpu) CpuNumFromRef_t cpu PROTOTYPE: $ CODE: { const char* value = NULL; #ifdef AIX # if defined(HAS_PERFSTAT) int num_cpus = proc_nthreaders(); if (cpu < num_cpus) { perfstat_cpu_total_t data; if (perfstat_cpu_total (0, &data, sizeof(data), 1)) { value = data.description; } } # endif #endif #ifdef HPUX int num_cpus = proc_nthreaders(); if (cpu < num_cpus) { switch(sysconf(_SC_CPU_VERSION)) { case CPU_PA_RISC1_0: value = "HP PA-RISC 1.0"; break; case CPU_PA_RISC1_1: value = "HP PA-RISC 1.1"; break; case CPU_PA_RISC1_2: value = "HP PA-RISC 1.2"; break; case CPU_PA_RISC2_0: value = "HP PA-RISC 2.0"; break; } } #endif #ifdef SUNOS processor_info_t info, *infop=&info; if (processor_info (cpu, infop)==0) { value = infop->pi_processor_type; } #endif #ifdef __linux__ int ncpu = proc_nthreaders(); if (cpu < ncpu) { value = proc_cpuinfo_field ("model name"); if (!value) value = proc_cpuinfo_field ("machine"); if (!value) value = proc_cpuinfo_field ("family"); } #endif #if defined(MIPS) && !defined(__linux__) if (cpu < proc_nthreaders()) { if ((value = (char *)malloc(64)) != NULL) { sysinfo(SI_MACHINE, value, 64); } } #endif #ifdef IRIX if (cpu < proc_nthreaders()) { int cpu_data = 0; int num_cpus = proc_nthreaders(); if ((num_cpus > 0) && (num_cpus < 3)) { inventory_t *sys_invent; if (setinvent() != -1) { while ((sys_invent = getinvent()) != NULL) { if ((sys_invent->inv_class == INV_PROCESSOR) && (sys_invent->inv_type == INV_CPUCHIP)) { cpu_data = sys_invent->inv_state; break; } } endinvent(); } } else { invent_cpuinfo_t cpu_info; cpu_info = irix_get_cpuinf(cpu); if (cpu_info.ic_cpuid == cpu) cpu_data = cpu_info.ic_cpu_info.cpuflavor; } if (cpu_data != 0) { if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R2000A) strcat(value, " MIPS R2000A"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R2000) strcat(value, " MIPS R2000A"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R3000A) strcat(value, " MIPS R3000A"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R3000) strcat(value, " MIPS R3000"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R4000) { if (((cpu_data&C0_MAJREVMASK)>>C0_MAJREVSHIFT) >= C0_MAJREVMIN_R4400) strcat(value, " MIPS R4400"); else strcat(value, " MIPS R4000"); } else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R4650) strcat(value, " MIPS R4650"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R4700) strcat(value, " MIPS R4700"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R4600) strcat(value, " MIPS R4600"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R5000) strcat(value, " MIPS R5000"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_RM5271) strcat(value, " MIPS RM5271"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R6000A) strcat(value, " MIPS R6000A"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R6000) strcat(value, " MIPS R6000"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_RM7000) strcat(value, " MIPS RM7000"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R8000) strcat(value, " MIPS R8000"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R10000) strcat(value, " MIPS R10000"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R12000) strcat(value, " MIPS R12000"); else if ((cpu_data >> C0_IMPSHIFT) == C0_IMP_R14000) strcat(value, " MIPS R14000"); else strcat(value, " Undefined MIPS"); sprintf(value, "%s Chip Rev: %x.%x", value, ((cpu_data&C0_MAJREVMASK)>>C0_MAJREVSHIFT), ((cpu_data&C0_MINREVMASK)>>C0_MINREVSHIFT)); } } #endif #ifdef __FreeBSD__ if (cpu < proc_nthreaders()) { if ((value = (char *)malloc(64)) != NULL) { size_t len = 64; sysctlbyname("hw.machine_arch", value, &len, NULL, 0); } } #endif if (value) { ST(0) = sv_newmortal(); sv_setpv (ST(0), value); } else { ST(0) = &PL_sv_undef; } } Unix-Processors-2.046/t/0000755000177100017500000000000013153245132015025 5ustar wsnyderwsnyderUnix-Processors-2.046/t/01_manifest.t0000755000177100017500000000155013100136231017313 0ustar wsnyderwsnyder#!/usr/bin/perl -w # DESCRIPTION: Perl ExtUtils: Type 'make test' to test this package # # Copyright 2007-2017 by Wilson Snyder. This program is free software; # you can redistribute it and/or modify it under the terms of either the GNU # Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. use strict; use Test; BEGIN { plan tests => 1 } if (!$ENV{VERILATOR_AUTHOR_SITE}) { skip("author only test (harmless)",1); } else { eval { use ExtUtils::Manifest; }; $ExtUtils::Manifest::Quiet = 1; my ($missing, $extra) = ExtUtils::Manifest::fullcheck(); my $bad; foreach my $file (@{$missing}) { next if $file eq "README"; warn "%Warning: MANIFEST listed file not found: $file\n"; $bad = 1; } foreach my $file (@{$extra}) { warn "%Warning: MANIFEST maybe missing: $file\n"; $bad = 1; } ok (!$bad); } Unix-Processors-2.046/t/00_pod.t0000755000177100017500000000101013100136231016255 0ustar wsnyderwsnyder#!/usr/bin/perl -w # DESCRIPTION: Perl ExtUtils: Type 'make test' to test this package # # Copyright 2000-2017 by Wilson Snyder. This program is free software; # you can redistribute it and/or modify it under the terms of either the GNU # Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. use strict; use Test; eval "use Test::Pod 1.00"; if ($@) { print "1..1\n"; print "ok 1 # skip Test::Pod not installed so ignoring Pod check (harmless)"; } else { all_pod_files_ok(); } Unix-Processors-2.046/t/test_utils.pl0000644000177100017500000000101513100136231017545 0ustar wsnyderwsnyder# DESCRIPTION: Perl ExtUtils: Common routines required by package tests # # Copyright 2001-2017 by Wilson Snyder. This program is free software; # you can redistribute it and/or modify it under the terms of either the GNU # Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. use vars qw($PERL); use IO::File; $PERL = "$^X -Iblib/arch -Iblib/lib"; mkdir 'test_dir',0777; if (!$ENV{HARNESS_ACTIVE}) { use lib '.'; use lib '..'; use lib "blib/lib"; use lib "blib/arch"; } 1; Unix-Processors-2.046/t/20_test.t0000755000177100017500000000265213100136231016471 0ustar wsnyderwsnyder#!/usr/bin/perl -w # DESCRIPTION: Perl ExtUtils: Type 'make test' to test this package # # Copyright 1999-2017 by Wilson Snyder. This program is free software; # you can redistribute it and/or modify it under the terms of either the GNU # Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. use strict; use Test; BEGIN { plan tests => 9 } BEGIN { require "./t/test_utils.pl"; } use Unix::Processors; ok(1); ######################### End of black magic. # Insert your test code below (better if it prints "ok 13" # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): # 2: Constructor my $procs = new Unix::Processors(); ok ($procs); # 3: Max online my $online = $procs->max_online; print "Cpu threads online: $online\n"; ok($online); # 4: Max physical my $phys = $procs->max_physical; print "Physical cpu cores: $phys\n"; ok($phys); # 5: Max socket my $socks = $procs->max_socket; print "Physical cpu sockets: $socks\n"; ok($socks); # 6: Max speed my $clock = $procs->max_clock; print "Cpu frequency: $clock\n"; ok($online); # 7: Procs state my $proclist = $procs->processors; ok($proclist); # 8: Procs owner my $ok=1; foreach my $proc (@{$procs->processors}) { $ok = 0 if (!$proc->state || !$proc->type); printf +("Id %s State %s Clock %s Type %s\n", $proc->id, $proc->state, $proc->clock, $proc->type); } ok($ok); # 9: Destructor undef $procs; ok(1);