From blair at orcaware.com Fri Jan 3 15:08:23 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Fri, 3 Jan 2003 15:08:23 -0800 Subject: [Orca-checkins] rev 179 - in trunk/orca: . docs Message-ID: <200301032308.h03N8Nx5031954@orcaware.com> Author: blair Date: 2003-01-03 15:08:10 -0800 (Fri, 03 Jan 2003) New Revision: 179 Modified: trunk/orca/HACKING trunk/orca/INSTALL trunk/orca/TODO trunk/orca/configure trunk/orca/configure.in trunk/orca/docs/ARCHITECTURE trunk/orca/docs/REQUIREMENTS Log: * HACKING, * INSTALL, * TODO, * configure.in, * configure, * docs/ARCHITECTURE, * docs/REQUIREMENTS: Replace all tabs with spaces. Modified: trunk/orca/configure ============================================================================== --- trunk/orca/configure (original) +++ trunk/orca/configure 2003-01-03 15:08:21.000000000 -0800 @@ -2937,8 +2937,8 @@ MKDIR="$config_dir/mkinstalldirs" #-------------------------------------------------------------------- -# Generate the Makefiles and shell scripts with the -# variable substitutions. +# Generate the Makefiles and shell scripts with the +# variable substitutions. #-------------------------------------------------------------------- if test "$BUILD_ORCALLATOR" = yes; then ORCALLATOR_OUTPUT="orcallator/orcallator.cfg Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-03 15:08:22.000000000 -0800 @@ -425,8 +425,8 @@ AC_SUBST(MKDIR) #-------------------------------------------------------------------- -# Generate the Makefiles and shell scripts with the -# variable substitutions. +# Generate the Makefiles and shell scripts with the +# variable substitutions. #-------------------------------------------------------------------- if test "$BUILD_ORCALLATOR" = yes; then ORCALLATOR_OUTPUT="orcallator/orcallator.cfg @@ -439,25 +439,25 @@ fi AC_OUTPUT(Makefile - config/PerlHead1 - config/PerlHead2 - lib/Makefile - packages/Makefile - src/Makefile - src/orca.pl - $ORCALLATOR_OUTPUT - docs/Makefile - contrib/Makefile - contrib/rotate_orca_graphs/Makefile - contrib/rotate_orca_graphs/rotate_orca_graphs.sh - contrib/orca_services/Makefile - contrib/orca_services/orca_services.cfg - contrib/orca_services/orca_services.pl - contrib/orca_services/orca_services_running.pl - contrib/orca_services/restart_orca_services.sh - contrib/orca_services/start_orca_services.sh - contrib/orca_services/stop_orca_services.sh - contrib/orca_services/S99orca_services.sh) + config/PerlHead1 + config/PerlHead2 + lib/Makefile + packages/Makefile + src/Makefile + src/orca.pl + $ORCALLATOR_OUTPUT + docs/Makefile + contrib/Makefile + contrib/rotate_orca_graphs/Makefile + contrib/rotate_orca_graphs/rotate_orca_graphs.sh + contrib/orca_services/Makefile + contrib/orca_services/orca_services.cfg + contrib/orca_services/orca_services.pl + contrib/orca_services/orca_services_running.pl + contrib/orca_services/restart_orca_services.sh + contrib/orca_services/start_orca_services.sh + contrib/orca_services/stop_orca_services.sh + contrib/orca_services/S99orca_services.sh) echo echo "----------------------------------------------------------------" Modified: trunk/orca/docs/ARCHITECTURE ============================================================================== --- trunk/orca/docs/ARCHITECTURE (original) +++ trunk/orca/docs/ARCHITECTURE 2003-01-03 15:08:22.000000000 -0800 @@ -7,116 +7,116 @@ Orca makes use of several internal classes (objects). They are: - Orca::OpenFileHash - Orca::HTMLFile - Orca::DataFile - Orca::SourceDataFile is a subclass of Orca::DataFile - Orca::RRDFile is a subclass of Orca::DataFile - Orca::GIFFile + Orca::OpenFileHash + Orca::HTMLFile + Orca::DataFile + Orca::SourceDataFile is a subclass of Orca::DataFile + Orca::RRDFile is a subclass of Orca::DataFile + Orca::GIFFile Orca::OpenFileHash - This class provides a cache of open file descriptors to the - user of the class. Upon creation, Orca::OpenFileHash is - told how many open file descriptors to cache. When a file - descriptor is needed for a file, the filename is passed to - a method and if the descriptor is already open, then it - is given back to the caller, otherwise the file is opened - and the newly opened descritor is passed back. If there are - already a maximum number of file descriptors open, then the - class closes the least recently used one. - - This class is used by the Orca::SourceDataFile to keep - files open as Orca waits for file updates. - - constructor new - method open - method add - method close - method change_weight - method list - method select - method get_fd - method sysread_readline - method is_open - hidden method _close_extra + This class provides a cache of open file descriptors to the + user of the class. Upon creation, Orca::OpenFileHash is + told how many open file descriptors to cache. When a file + descriptor is needed for a file, the filename is passed to + a method and if the descriptor is already open, then it + is given back to the caller, otherwise the file is opened + and the newly opened descritor is passed back. If there are + already a maximum number of file descriptors open, then the + class closes the least recently used one. + + This class is used by the Orca::SourceDataFile to keep + files open as Orca waits for file updates. + + constructor new + method open + method add + method close + method change_weight + method list + method select + method get_fd + method sysread_readline + method is_open + hidden method _close_extra Orca::HTMLFile - This class is basically a object file descriptor that can be - printed to. This class does not provide the same level of - abstraction that IO::File does. It only supports the print - method. - - What this class does is upon creation of an HTML file prints a - standard amount of HTNL to the beginning of the file. This - includes the standard and other tags. Then, when the - object is destroyed, the DESTORY method writes some trailing - HTML to the file. - - constructor new - method print - hidden method DESTROY + This class is basically a object file descriptor that can be + printed to. This class does not provide the same level of + abstraction that IO::File does. It only supports the print + method. + + What this class does is upon creation of an HTML file prints a + standard amount of HTNL to the beginning of the file. This + includes the standard and other tags. Then, when the + object is destroyed, the DESTORY method writes some trailing + HTML to the file. + + constructor new + method print + hidden method DESTROY Orca::DataFile - Orca::DataFile is a class meant to be subclassed by other - classes. What is does is cache file information, such as the - inode number, the device number of the mount point, the - files modification time (mtime). The class can be instructed - to update the cache upon demand and to return the time when - the file was last stated. - - The file information is cached to save file access and system - call overhead that can be prevented. - - constructor new - method filename - method file_dev - method file_ino - method file_mtime - method last_stat_time - method update_stat - method status + Orca::DataFile is a class meant to be subclassed by other + classes. What is does is cache file information, such as the + inode number, the device number of the mount point, the + files modification time (mtime). The class can be instructed + to update the cache upon demand and to return the time when + the file was last stated. + + The file information is cached to save file access and system + call overhead that can be prevented. + + constructor new + method filename + method file_dev + method file_ino + method file_mtime + method last_stat_time + method update_stat + method status Orca::SourceDataFile - Orca::SourceDataFile subclasses itself from Orca::DataFile. - This classes primary mission is to load and parse data from - source text files and hand it off. - - constructor new - method is_current - method next_load_time - method get_column_names - method get_date_column - method add_plots - method load_new_data - method rrds + Orca::SourceDataFile subclasses itself from Orca::DataFile. + This classes primary mission is to load and parse data from + source text files and hand it off. + + constructor new + method is_current + method next_load_time + method get_column_names + method get_date_column + method add_plots + method load_new_data + method rrds Orca::RRDFile - constructor new - method name - method rrd_update_time - method add_gif - method created_gifs - method queue_data - method flush_data + constructor new + method name + method rrd_update_time + method add_gif + method created_gifs + method queue_data + method flush_data Orca::GIFFile - constructor new - method add_rrds - method rrds - method plot_ref - method group - method files_key - method name - method no_group_name - method plot_end_time - method plot - hidden method _plot - hidden sub _expire_string + constructor new + method add_rrds + method rrds + method plot_ref + method group + method files_key + method name + method no_group_name + method plot_end_time + method plot + hidden method _plot + hidden sub _expire_string Modified: trunk/orca/docs/REQUIREMENTS ============================================================================== --- trunk/orca/docs/REQUIREMENTS (original) +++ trunk/orca/docs/REQUIREMENTS 2003-01-03 15:08:22.000000000 -0800 @@ -1,30 +1,30 @@ Orca::SourceDataFile - Requirements - Manages one source data file - Knows when the data file will be updated - Only class to know the internal format of the file - Can have brand new data fields at any point in time + Requirements + Manages one source data file + Knows when the data file will be updated + Only class to know the internal format of the file + Can have brand new data fields at any point in time - Internal Storage + Internal Storage - Methods + Methods Orca::RRDFile - Requirements - Manages on RRD file - RRD file can contain data resulting from arbitrary math - expressions. + Requirements + Manages on RRD file + RRD file can contain data resulting from arbitrary math + expressions. - Internal Storage + Internal Storage - Methods + Methods Orca::GIFFile - Requirements + Requirements - Internal Storage + Internal Storage - Methods + Methods Modified: trunk/orca/HACKING ============================================================================== --- trunk/orca/HACKING (original) +++ trunk/orca/HACKING 2003-01-03 15:08:22.000000000 -0800 @@ -1,4 +1,4 @@ - -*-text-*- + -*-text-*- If you are contributing code to the Orca project, please read this first. Modified: trunk/orca/TODO ============================================================================== --- trunk/orca/TODO (original) +++ trunk/orca/TODO 2003-01-03 15:08:22.000000000 -0800 @@ -12,8 +12,8 @@ using 7.3 gigabytes of storage. I have 9 different orcallator.cfg for different classes of machines. -* Orca: Fix the "did exist and is now gone" email messages for source - files that are fine. +* Orca: Fix the "did exist and is now gone" email messages for source + files that are fine. * Orca: Have an install option just for orcallator.se and not the Orca whole pacckage. @@ -22,268 +22,268 @@ * Orca: bug fix: - Fix the bug where if a legend is listed in a plot {} then the - number of colored boxes in the generated plot are more than - the data that appears there. + Fix the bug where if a legend is listed in a plot {} then the + number of colored boxes in the generated plot are more than + the data that appears there. * Orca: Load arbitrarily formatted source text files. - (If this is implemented, then the problems of source text files - not containing fields that orcallator.cfg is looking for and - Orca complaining will disappear). - - Orca can only handle source text files that have data from one - source, such as a host, in a single file. It cannot currently - handle source data like this: - - # Web_server time hits/s bytes/s - www1 933189273 1304 10324 - www2 933189273 2545 40322 - - I plan on having Orca allow something like this in the configuration - file for each group. To read the data above, something like this - would be defined. Here the ChangeSubGroup and StoreMeasurement - would be macros or subroutines defined elsewhere for Orca users - to use. - - group web_servers { - upon_open - # Do nothing special. - - upon_new_data - while (<$fh>) { - next if /^#/; - my @line = split; - next unless (@line == 4); - my ($www, $time, $hits_s, $bytes_s) = @line; - ChangeSubGroup($www); - StoreMeasurement('Hits Per Second', $time, $hits_s); - StoreMeasurement('Bytes Per Second', $time, $bytes_s); - } - - upon_close - # Do nothing special. - } - - For the standard orcallator.se output, something like this would - be used: - - group orcallator { - find_files /usr/local/var/orca/orcallator/(.*)/orcallator-\d+-\d+\d+ - - upon_open - # Look for the first # line describing the data. - while (<$fh>)) { - last if /^#/; - } - @ColumnsNames = split; - # Do some searching for the column with the Unix time in it. - my $time_column = ....; - splice(@ColumnNames, $time_column, 1); - - upon_new_data - # Load the new data. - while (my $line = <$fh>) { - my @line = split; - next unless @line == @ColumnNames + 1; - my ($time) = splice(@line, $time_column, 1); - # - StoreMeasurements($time, \@ColumnNames, \@line); - } - - } - - The code for each upon_* would be Perl code designed explicitly - for the type of source text. This would allow the arbitrary - reading of text files, leaving the specifics to the user of - Orca. - - This work would also include caching away the type of measurements - that each source data file provides. Currently Orca reads the - header of each source text file for the names of the columns. - With the number of source text files I have, this takes a long - time. + (If this is implemented, then the problems of source text files + not containing fields that orcallator.cfg is looking for and + Orca complaining will disappear). + + Orca can only handle source text files that have data from one + source, such as a host, in a single file. It cannot currently + handle source data like this: + + # Web_server time hits/s bytes/s + www1 933189273 1304 10324 + www2 933189273 2545 40322 + + I plan on having Orca allow something like this in the configuration + file for each group. To read the data above, something like this + would be defined. Here the ChangeSubGroup and StoreMeasurement + would be macros or subroutines defined elsewhere for Orca users + to use. + + group web_servers { + upon_open + # Do nothing special. + + upon_new_data + while (<$fh>) { + next if /^#/; + my @line = split; + next unless (@line == 4); + my ($www, $time, $hits_s, $bytes_s) = @line; + ChangeSubGroup($www); + StoreMeasurement('Hits Per Second', $time, $hits_s); + StoreMeasurement('Bytes Per Second', $time, $bytes_s); + } + + upon_close + # Do nothing special. + } + + For the standard orcallator.se output, something like this would + be used: + + group orcallator { + find_files /usr/local/var/orca/orcallator/(.*)/orcallator-\d+-\d+\d+ + + upon_open + # Look for the first # line describing the data. + while (<$fh>)) { + last if /^#/; + } + @ColumnsNames = split; + # Do some searching for the column with the Unix time in it. + my $time_column = ....; + splice(@ColumnNames, $time_column, 1); + + upon_new_data + # Load the new data. + while (my $line = <$fh>) { + my @line = split; + next unless @line == @ColumnNames + 1; + my ($time) = splice(@line, $time_column, 1); + # + StoreMeasurements($time, \@ColumnNames, \@line); + } + + } + + The code for each upon_* would be Perl code designed explicitly + for the type of source text. This would allow the arbitrary + reading of text files, leaving the specifics to the user of + Orca. + + This work would also include caching away the type of measurements + that each source data file provides. Currently Orca reads the + header of each source text file for the names of the columns. + With the number of source text files I have, this takes a long + time. * OS independent data gathering tools: - Many people have been asking for Orca for operating systems other - than Solaris, since orcallator.se only runs on Solaris hosts. + Many people have been asking for Orca for operating systems other + than Solaris, since orcallator.se only runs on Solaris hosts. - I've given this a little thought and one good solution to this is - use other publically available tools that gather host information. - The one that came to mind is top (ftp://ftp.groupsys.com/pub/top). - Looking at the configure script for top, it runs on the following - OSes: - - 386bsd For a 386BSD system - aix32 POWER and POWER2 running AIX 3.2.5.0 - aix41 PowerPC running AIX 4.1.2.0 - aux3 a Mac running A/UX version 3.x - bsd386 For a BSD/386 system - bsd43 any generic 4.3BSD system - bsd44 For a 4.4BSD system - bsd44a For a pre-release 4.4BSD system - bsdos2 For a BSD/OS 2.X system (based on the 4.4BSD Lite system) - convex any C2XX running Convex OS 11.X. - dcosx For Pyramid DC/OSX - decosf1 DEC Alpha AXP running OSF/1 or Digital Unix 4.0. - dgux for DG AViiON with DG/UX 5.4+ - dynix any Sequent Running Dynix 3.0.x - dynix32 any Sequent Running Dynix 3.2.x - freebsd20 For a FreeBSD-2.0 (4.4BSD) system - ftx For FTX based System V Release 4 - hpux10 any hp9000 running hpux version 10.x - hpux7 any hp9000 running hpux version 7 or earlier - hpux8 any hp9000 running hpux version 8 (may work with 9) - hpux9 any hp9000 running hpux version 9 - irix5 any uniprocessor, 32 bit SGI machine running IRIX 5.3 - irix62 any uniprocessor, SGI machine running IRIX 6.2 - linux Linux 1.2.x, 1.3.x, using the /proc filesystem - mtxinu any VAX Running Mt. Xinu MORE/bsd - ncr3000 For NCR 3000 series systems Release 2.00.02 and above - - netbsd08 For a NetBSD system - netbsd10 For a NetBSD-1.0 (4.4BSD) system - netbsd132 For a NetBSD-1.3.2 (4.4BSD) system - next32 any m68k or intel NEXTSTEP v3.x system - next40 any hppa or sparc NEXTSTEP v3.3 system - osmp41a any Solbourne running OS/MP 4.1A - sco SCO UNIX - sco5 SCO UNIX OpenServer5 - sunos4 any Sun running SunOS version 4.x - sunos4mp any multi-processor Sun running SunOS versions 4.1.2 or later - sunos5 Any Sun running SunOS 5.x (Solaris 2.x) - svr4 Intel based System V Release 4 - svr42 For Intel based System V Release 4.2 (DESTINY) - ultrix4 any DEC running ULTRIX V4.2 or later - umax Encore Multimax running any release of UMAX 4.3 - utek Tektronix 43xx running UTek 4.1 - - If somebody were to write a tie into top's source code that would - generate output every X minutes to a text file or even RRD files, - then Orca could put it together into a nice package. - - In line with this di - (ftp://ftp.pz.pirmasens.de/pub/unix/utilities/), a freely - available disk usage program that could be used to generate disk - usage plots loaded by Orca. + I've given this a little thought and one good solution to this is + use other publically available tools that gather host information. + The one that came to mind is top (ftp://ftp.groupsys.com/pub/top). + Looking at the configure script for top, it runs on the following + OSes: + + 386bsd For a 386BSD system + aix32 POWER and POWER2 running AIX 3.2.5.0 + aix41 PowerPC running AIX 4.1.2.0 + aux3 a Mac running A/UX version 3.x + bsd386 For a BSD/386 system + bsd43 any generic 4.3BSD system + bsd44 For a 4.4BSD system + bsd44a For a pre-release 4.4BSD system + bsdos2 For a BSD/OS 2.X system (based on the 4.4BSD Lite system) + convex any C2XX running Convex OS 11.X. + dcosx For Pyramid DC/OSX + decosf1 DEC Alpha AXP running OSF/1 or Digital Unix 4.0. + dgux for DG AViiON with DG/UX 5.4+ + dynix any Sequent Running Dynix 3.0.x + dynix32 any Sequent Running Dynix 3.2.x + freebsd20 For a FreeBSD-2.0 (4.4BSD) system + ftx For FTX based System V Release 4 + hpux10 any hp9000 running hpux version 10.x + hpux7 any hp9000 running hpux version 7 or earlier + hpux8 any hp9000 running hpux version 8 (may work with 9) + hpux9 any hp9000 running hpux version 9 + irix5 any uniprocessor, 32 bit SGI machine running IRIX 5.3 + irix62 any uniprocessor, SGI machine running IRIX 6.2 + linux Linux 1.2.x, 1.3.x, using the /proc filesystem + mtxinu any VAX Running Mt. Xinu MORE/bsd + ncr3000 For NCR 3000 series systems Release 2.00.02 and above - + netbsd08 For a NetBSD system + netbsd10 For a NetBSD-1.0 (4.4BSD) system + netbsd132 For a NetBSD-1.3.2 (4.4BSD) system + next32 any m68k or intel NEXTSTEP v3.x system + next40 any hppa or sparc NEXTSTEP v3.3 system + osmp41a any Solbourne running OS/MP 4.1A + sco SCO UNIX + sco5 SCO UNIX OpenServer5 + sunos4 any Sun running SunOS version 4.x + sunos4mp any multi-processor Sun running SunOS versions 4.1.2 or later + sunos5 Any Sun running SunOS 5.x (Solaris 2.x) + svr4 Intel based System V Release 4 + svr42 For Intel based System V Release 4.2 (DESTINY) + ultrix4 any DEC running ULTRIX V4.2 or later + umax Encore Multimax running any release of UMAX 4.3 + utek Tektronix 43xx running UTek 4.1 + + If somebody were to write a tie into top's source code that would + generate output every X minutes to a text file or even RRD files, + then Orca could put it together into a nice package. + + In line with this di + (ftp://ftp.pz.pirmasens.de/pub/unix/utilities/), a freely + available disk usage program that could be used to generate disk + usage plots loaded by Orca. * orcallator.se: Dump directly to RRD files. - A separate RRD file would be created for each measurement. - I do not want all the data stored in a single RRD, since people - commonly add or remove hardware from the system, which will cause - more or less data to be stored. Also, this currently would not - work with RRDtool, since you cannot dynamically add more RRAs - to a RRD file. Saving each measurement in a separate RRD file - removes this issue. - - Pros: - 1) Disk space savings. For an old host using over 70 - megabytes of storage for text output, the RRD files - consume 3.5 megabytes of storage. - 2) Orca processing time. Orca spends a large amount of - kernel and CPU time in finding files and getting - the column headers from these files. By storing - the data in RRD files, this is no longer a problem. - Also, Orca itself would not need to move the data - from text to RRD form, speeding up the process of - generating the final plots. - - Cons: - 1) Potential slowdown in updating the data files. - It is easier to write a single text line using fprintf - than using rrd_update. What is the impact on a single - orcallator.se process? - 2) RRDtool format changes and upgrading the data files. - Text files do not change, but if RRDtool does change, - then the data files will need to be upgraded somehow. - 3) Loss of data over time. Due to the consolidation - function of RRD, older data will not be as precise - in case it needs to be examined. - 4) You cannot grep or simply parse the text files for - particular data for ad-hoc studies. - 5) The RRD creation parameters would be set by - orcallator.se and not by Orca, making modifications - harder. - - Question: Do the pros outweigh the cons? - - Work to do: Get RRDtool to build a librrd.so that orcallator.se - would attach to. The RRDs.so that gets built in the perl-shared - directory has RRDs.o included in it with references to Perl - variables, so this shared library cannot be loaded by anybody - else. Two things can be done. One is to modify the perl-shared - Makefile.PL to build a librrd.so without RRDs.so. The other is - to somehow make librrd.so with libtool. Either libtool can be - integrated into RRDtool as a whole, or probably simpler would - be to add another directory to RRDtool and use libtool in there - to make the shared library. The first libtool solution would - allow RRDtool to make shared libraries on almost any host without - requiring that gcc be installed, since currently the Makefile's - look for gcc to use the -fPIC flags. + A separate RRD file would be created for each measurement. + I do not want all the data stored in a single RRD, since people + commonly add or remove hardware from the system, which will cause + more or less data to be stored. Also, this currently would not + work with RRDtool, since you cannot dynamically add more RRAs + to a RRD file. Saving each measurement in a separate RRD file + removes this issue. + + Pros: + 1) Disk space savings. For an old host using over 70 + megabytes of storage for text output, the RRD files + consume 3.5 megabytes of storage. + 2) Orca processing time. Orca spends a large amount of + kernel and CPU time in finding files and getting + the column headers from these files. By storing + the data in RRD files, this is no longer a problem. + Also, Orca itself would not need to move the data + from text to RRD form, speeding up the process of + generating the final plots. + + Cons: + 1) Potential slowdown in updating the data files. + It is easier to write a single text line using fprintf + than using rrd_update. What is the impact on a single + orcallator.se process? + 2) RRDtool format changes and upgrading the data files. + Text files do not change, but if RRDtool does change, + then the data files will need to be upgraded somehow. + 3) Loss of data over time. Due to the consolidation + function of RRD, older data will not be as precise + in case it needs to be examined. + 4) You cannot grep or simply parse the text files for + particular data for ad-hoc studies. + 5) The RRD creation parameters would be set by + orcallator.se and not by Orca, making modifications + harder. + + Question: Do the pros outweigh the cons? + + Work to do: Get RRDtool to build a librrd.so that orcallator.se + would attach to. The RRDs.so that gets built in the perl-shared + directory has RRDs.o included in it with references to Perl + variables, so this shared library cannot be loaded by anybody + else. Two things can be done. One is to modify the perl-shared + Makefile.PL to build a librrd.so without RRDs.so. The other is + to somehow make librrd.so with libtool. Either libtool can be + integrated into RRDtool as a whole, or probably simpler would + be to add another directory to RRDtool and use libtool in there + to make the shared library. The first libtool solution would + allow RRDtool to make shared libraries on almost any host without + requiring that gcc be installed, since currently the Makefile's + look for gcc to use the -fPIC flags. * Orca: Potentially use Cricket's configuration ConfigTree Module. - Given more complex Orca installations where many different Orca - configuration files are used, maintaining them will start to be - complicated. For example, in Yahoo!/GeoCities I have 9 different - configurations to split up the hosts for our site I found that - for the number of hosts and the number of data files require this - for reasonable generating of the resulting HTML and PNG files. - - It looks like using ConfigTree would allow Orca to use the same - inheritance that Cricket uses. I don't know enough about the - Cricket config tree setup to know if it would work well with Orca. + Given more complex Orca installations where many different Orca + configuration files are used, maintaining them will start to be + complicated. For example, in Yahoo!/GeoCities I have 9 different + configurations to split up the hosts for our site I found that + for the number of hosts and the number of data files require this + for reasonable generating of the resulting HTML and PNG files. + + It looks like using ConfigTree would allow Orca to use the same + inheritance that Cricket uses. I don't know enough about the + Cricket config tree setup to know if it would work well with Orca. - Work to do: Review the ConfigTree code. + Work to do: Review the ConfigTree code. * Orca: Allow different group sources in the same plot. - Currently Orca only allows data sources from one group. Expand - the code to list the group in each data line. Initially, however - only data from one group would be allowed in one data statement. + Currently Orca only allows data sources from one group. Expand + the code to list the group in each data line. Initially, however + only data from one group would be allowed in one data statement. * Orca: Put the last update time for each host in an HTML file somewhere. - This could be done simply up updating a file that gets included - by the real HTML file. This way the main HTML files do not - have to get rewritten all the time. On large installations, - writing the HTML files is lengthy. + This could be done simply up updating a file that gets included + by the real HTML file. This way the main HTML files do not + have to get rewritten all the time. On large installations, + writing the HTML files is lengthy. * Orca: Turn off HTML creation via command line option. - Add a command line option to turn off HTML file creation. + Add a command line option to turn off HTML file creation. * Orca: Update the HTML files is new data is found. - Currently Orca will only update the HTML files if new source - files are found, but not if new data in existing files is found. - Change this. + Currently Orca will only update the HTML files if new source + files are found, but not if new data in existing files is found. + Change this. * orcallator.se: Put HTTP proxy and caching statistics into orcallator.cfg. - Since orcallator.se measures HTTP proxy and caching statistics, - update orcallator.cfg.in to display these data sets. + Since orcallator.se measures HTTP proxy and caching statistics, + update orcallator.cfg.in to display these data sets. * orcallator.se: Temperature measurements - Since /usr/platform/sun4u/sbin/prtdiag -v measures the ambient - and CPU temperature, get orcallator.se to measure this data. + Since /usr/platform/sun4u/sbin/prtdiag -v measures the ambient + and CPU temperature, get orcallator.se to measure this data. * Orca: - Do what it takes to remove the same Ethernet port listings in - orcallator.cfg.in. They seem redundant, but are not totally, - since different interfaces have different maximum data transfer - rates. + Do what it takes to remove the same Ethernet port listings in + orcallator.cfg.in. They seem redundant, but are not totally, + since different interfaces have different maximum data transfer + rates. * Orca: - Add some error checking code for the maximum number of available - colors so undefined errors do not arise. + Add some error checking code for the maximum number of available + colors so undefined errors do not arise. * Other: - Mention the AIX tool nmon. + Mention the AIX tool nmon. Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-01-03 15:08:22.000000000 -0800 @@ -139,13 +139,13 @@ Orca requires the following Perl modules at the specified versions: - Name Required Version Included With Orca + Name Required Version Included With Orca ---------------------------------------------------------------------- - Data::Dumper 2.101 or greater 2.101 - Digest::MD5 2.21 or greater 2.21 - Math::IntervalSearch 1.05 or greater 1.05 - RRDs 1.0.33 or greater 1.0.33 - Storable 2.06 or greater 2.06 + Data::Dumper 2.101 or greater 2.101 + Digest::MD5 2.21 or greater 2.21 + Math::IntervalSearch 1.05 or greater 1.05 + RRDs 1.0.33 or greater 1.0.33 + Storable 2.06 or greater 2.06 All five of these modules are included with the Orca distribution in the packages directory. When you configure Orca in step 3), @@ -226,7 +226,7 @@ To make Orca and these Perl modules run the following command: - % make [ To optimize: make CFLAGS=-O or CFLAGS=-O3 ] + % make [ To optimize: make CFLAGS=-O or CFLAGS=-O3 ] 6) Test if the Perl modules properly compiled. From blair at orcaware.com Fri Jan 3 16:17:29 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Fri, 3 Jan 2003 16:17:29 -0800 Subject: [Orca-checkins] rev 180 - trunk/orca Message-ID: <200301040017.h040HTT8022432@orcaware.com> Author: blair Date: 2003-01-03 16:17:17 -0800 (Fri, 03 Jan 2003) New Revision: 180 Modified: trunk/orca/TODO Log: * TODO (orcallator.se: Dump directly to RRD files): Remove the discussion of getting RRDtool to build a shared library version of librrd. It's been able to do that since RRDtool 1.0.5 when I contributed a patch to RRDtool way back in 1999. :) Modified: trunk/orca/TODO ============================================================================== --- trunk/orca/TODO (original) +++ trunk/orca/TODO 2003-01-03 16:17:27.000000000 -0800 @@ -208,20 +208,6 @@ Question: Do the pros outweigh the cons? - Work to do: Get RRDtool to build a librrd.so that orcallator.se - would attach to. The RRDs.so that gets built in the perl-shared - directory has RRDs.o included in it with references to Perl - variables, so this shared library cannot be loaded by anybody - else. Two things can be done. One is to modify the perl-shared - Makefile.PL to build a librrd.so without RRDs.so. The other is - to somehow make librrd.so with libtool. Either libtool can be - integrated into RRDtool as a whole, or probably simpler would - be to add another directory to RRDtool and use libtool in there - to make the shared library. The first libtool solution would - allow RRDtool to make shared libraries on almost any host without - requiring that gcc be installed, since currently the Makefile's - look for gcc to use the -fPIC flags. - * Orca: Potentially use Cricket's configuration ConfigTree Module. Given more complex Orca installations where many different Orca From blair at orcaware.com Fri Jan 3 17:12:38 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Fri, 3 Jan 2003 17:12:38 -0800 Subject: [Orca-checkins] rev 181 - in trunk/orca: . config Message-ID: <200301040112.h041CcLd006129@orcaware.com> Author: blair Date: 2003-01-03 17:12:27 -0800 (Fri, 03 Jan 2003) New Revision: 181 Added: trunk/orca/autogen.sh Removed: trunk/orca/config/aclocal.m4 trunk/orca/configure Modified: trunk/orca/HACKING trunk/orca/Makefile.in trunk/orca/configure.in Log: Now that Orca and RRDtool are a in revision control system, it's problematic to maintain the autoconf, automake and libtool generated build system files (configure, aclocal.m4, etc.) in the repository. When Orca is checked out, the source build files (e.g. configure.in) may have a time stamp newer than the generated files (e.g. configure). When the user runs `make' then, depending upon the Makefile, make may try to regenerate the generated build files, which is a pain. This isn't true of Orca's build, but it is true of RRDtool's build. The solution is the following: 1) Delete Orca's generated build files: configure and config/aclocal.m4. 2) Have a script that generates configure and config/aclocal.m4. This script is named autogen.sh. 3) Have autogen.sh touch the build files in RRDtool in the proper chronological order to maintain the relative timestamps to prevent spurious rebuilding. * autogen.sh: New script. Check if autoconf 2.53 is available and quits if it isn't. Touch RRDtool's build files in the correct chronological order to maintain the relative timestamps to prevent spurious rebuilding. Add property svn:executable set to on. * configure.in: Require autoconf 2.53. * Makefile.in (distclean): Delete configure and config/aclocal.m4. * HACKING (Getting the source): Update the URLs to the Orca Subversion repository to use port 8000 instead of port 80. Add additional instructions with the Subversion command to check out Orca HEAD and that you need to run autogen.sh to create the configure script. * config/aclocal.m4: Delete, now created by autogen.sh. * configure. Delete, now created by autogen.sh. Modified: trunk/orca/Makefile.in ============================================================================== --- trunk/orca/Makefile.in (original) +++ trunk/orca/Makefile.in 2003-01-03 17:12:37.000000000 -0800 @@ -69,8 +69,8 @@ (cd $$dir && $(MAKE) distclean); \ done $(RM) -r autom4te*.cache - $(RM) config/PerlHead1 config/PerlHead2 - $(RM) config.cache config.log config.status Makefile + $(RM) config/aclocal.m4 config/PerlHead1 config/PerlHead2 + $(RM) configure config.cache config.log config.status Makefile to-autoconf: aclocal -I config --output=config/aclocal.m4 Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-03 17:12:37.000000000 -0800 @@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM # Minimum Autoconf version required. -AC_PREREQ(2.52) +AC_PREREQ(2.53) # Remember the command line arguments to configure for use when # configure is run again. Also create the command line options for Modified: trunk/orca/HACKING ============================================================================== --- trunk/orca/HACKING (original) +++ trunk/orca/HACKING 2003-01-03 17:12:37.000000000 -0800 @@ -59,11 +59,11 @@ The Orca Subversion repository is located at - http://svn.orcaware.com/repos/trunk/orca/ + http://svn.orcaware.com:8000/repos/trunk/orca/ with tagged releases located at - http://svn.orcaware.com/repos/tags/orca/ + http://svn.orcaware.com:8000/repos/tags/orca/ The Subversion home page is at @@ -86,6 +86,25 @@ http://svn.collab.net/repos/svn/trunk/INSTALL http://subversion.tigris.org/project_source.html +Once you've downloaded and installed Subversion, run the following +command to check out Orca HEAD: + + % svn co http://svn.orcaware.com:8000/repos/trunk/orca/ + +This will create a directory named `orca' in the current working +directory. + +You will then need to create the `configure' script by running: + + % cd orca + % ./autogen.sh + +Running this will check if you have the proper version of autoconf on +your system and build `configure'. + +At this point, you will have the `configure' script in the `orca' +directory and you can configure and build Orca normally as described +in the `INSTALL' file. What to read Deleted: trunk/orca/config/aclocal.m4 Added: trunk/orca/autogen.sh ============================================================================== --- trunk/orca/autogen.sh (original) +++ trunk/orca/autogen.sh 2003-01-03 17:12:38.000000000 -0800 @@ -0,0 +1,39 @@ +#!/bin/sh + +echo "$0: checking installation..." + +# Check for autoconf 2.53 or newer. +ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` +if test -z "$ac_version"; then + echo "$0: autoconf not found." + echo " You need autoconf version 2.53 or newer installed" + echo " to build Orca from Subversion." + exit 1 +fi +IFS=.; set $ac_version; IFS=' ' +if test "$1" = "2" -a "$2" -lt "53" || test "$1" -lt "2"; then + echo "$0: autoconf version $ac_version found." + echo " You need autoconf version 2.53 or newer installed" + echo " to build Orca from Subversion." + exit 1 +else + echo "$0: autoconf version $ac_version (ok)" +fi + +# The Orca Subversion repository contains RRDtool, which has its own +# automake, autoconf and libtool setup. When checking out Orca from +# Subversion, it does not preserve the relative timestamps of the +# build environment, which can cause `make' to rebuild RRDtool's build +# environment. +# +# To work around this, touch the build files in chronological order. +echo "$0: touching RRDtool build files to preserve relative timestamps" +find packages -name configure.in -o -name Makefile.am | xargs touch +sleep 2 +find packages -name configure -o -name Makefile.in -o -name stamp-h\* | xargs touch + +echo "$0: building configuration files" + +aclocal -I config --output=config/aclocal.m4 +autoconf --include=config +rm -fr autom4te*.cache Deleted: trunk/orca/configure From blair at orcaware.com Fri Jan 3 17:28:49 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Fri, 3 Jan 2003 17:28:49 -0800 Subject: [Orca-checkins] rev 182 - trunk/orca Message-ID: <200301040128.h041SnfB013458@orcaware.com> Author: blair Date: 2003-01-03 17:28:37 -0800 (Fri, 03 Jan 2003) New Revision: 182 Modified: trunk/orca/autogen.sh Log: * autogen.sh: Print any messages that shows the script doing some work with trailing `...'s and make output more consistent with what the script is doing. Modified: trunk/orca/autogen.sh ============================================================================== --- trunk/orca/autogen.sh (original) +++ trunk/orca/autogen.sh 2003-01-03 17:28:48.000000000 -0800 @@ -1,8 +1,7 @@ #!/bin/sh -echo "$0: checking installation..." - # Check for autoconf 2.53 or newer. +echo "$0: checking for autoconf 2.53 or newer..." ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` if test -z "$ac_version"; then echo "$0: autoconf not found." @@ -27,13 +26,13 @@ # environment. # # To work around this, touch the build files in chronological order. -echo "$0: touching RRDtool build files to preserve relative timestamps" +echo "$0: touching RRDtool build files to preserve relative timestamps..." find packages -name configure.in -o -name Makefile.am | xargs touch sleep 2 find packages -name configure -o -name Makefile.in -o -name stamp-h\* | xargs touch -echo "$0: building configuration files" - +# Now create configure and it's associated build files. +echo "$0: creating configure and associated build files..." aclocal -I config --output=config/aclocal.m4 autoconf --include=config rm -fr autom4te*.cache From blair at orcaware.com Fri Jan 3 17:47:34 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Fri, 3 Jan 2003 17:47:34 -0800 Subject: [Orca-checkins] rev 183 - in trunk/orca: . orcallator Message-ID: <200301040147.h041lYX0016223@orcaware.com> Author: blair Date: 2003-01-03 17:47:23 -0800 (Fri, 03 Jan 2003) New Revision: 183 Modified: trunk/orca/INSTALL trunk/orca/configure.in trunk/orca/orcallator/orcallator.cfg.in Log: Given that there will be more key Orca configuration files beyond orcallator.cfg, in particular procallator.cfg, that will need to be configured, start to place some of the customization options into configure so common settings can be applied to multiple Orca configuration files. This first one adds a new configure option --with-warn-email which is used to set Orca's warn_email configuration file in orcallator.cfg. * configure.in: New --with-warn-email command line option which sets WARN_EMAIL. Defaults to `root at localhost' if not set. Comment out setting $ALWAYS_BUILD_PERL_MODULES so that it can be set in the environment and be used to build all of the Perl modules. * orcallator/orcallator.cfg.in: Replace `root at localhost' with @WARN_EMAIL@ to the replaced by config.status. * INSTALL (Configure Orca): Break this section into smaller subsections, where each subsection describes a related group of configure command line options. Add a description of --with-warn-email. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-03 17:47:32.000000000 -0800 @@ -19,8 +19,8 @@ # Set this to yes to have configure always build all of the required # Perl Orca modules. This is used to test the build more than # anything else. -ALWAYS_BUILD_PERL_MODULES=yes -ALWAYS_BUILD_PERL_MODULES= +# ALWAYS_BUILD_PERL_MODULES=yes +# ALWAYS_BUILD_PERL_MODULES= # Define the directories containing packages that Orca makes use of here. # The directory name packages where these packages are distributed with @@ -181,6 +181,21 @@ AC_SUBST(WATCH_WEB) AC_SUBST(WEB_LOG) +AC_ARG_WITH(warn-email, + [ --with-warn-email=ADDR email address to send warnings to [[root at localhost]]], + [ + case "$withval" in + "" | y | ye | yes | n | no) + AC_MSG_ERROR([*** You must supply an argument to the --with-warn-email option.]) + ;; + *) WARN_EMAIL="$withval" + ;; + esac + ], + : ${WARN_EMAIL=root at localhost} +) +AC_SUBST(WARN_EMAIL) + # To get a default CFLAGS for this build, check for a C compiler. This # is also needed to be ready to compile any Perl modules. AC_PROG_CC Modified: trunk/orca/orcallator/orcallator.cfg.in ============================================================================== --- trunk/orca/orcallator/orcallator.cfg.in (original) +++ trunk/orca/orcallator/orcallator.cfg.in 2003-01-03 17:47:32.000000000 -0800 @@ -38,7 +38,7 @@ # being updated constantly stops being updated. For mathematical # expressions use the word `interval' to get the interval number for # the data source. -warn_email root at localhost +warn_email @WARN_EMAIL@ late_interval interval + 30 # These parameters specify which plots to generate. Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-01-03 17:47:32.000000000 -0800 @@ -96,32 +96,50 @@ 3) Configure Orca. - Now that you have decided where the RRD, HTML, and optionally the - orcallator data files and the web server access logs, are located, - run the configure script with the following arguments: - - % ./configure --prefix=ORCA_PREFIX_DIRECTORY \ - --with-var-dir=VAR_DIR_LOCATION \ - --with-rrd-dir=RRD_DIR_LOCATION \ - --with-html-dir=HTML_DIR_LOCATION \ - --with-TYPE-log=LOG_LOCATION - - If you choose nothing else, the --with-html-dir must always be - used, otherwise configure will fail. - - If you use a web, proxy, or Squid server, you can have orcallator - gather statistics from the log file. Use this table to decide - which configure option to use. Note that the Apache and NCSA - servers use the Common Log Format. - - Log Type Configure Option - ---------------------------------------------------------------- - Common Log Format --with-ncsa-log=FILE - Common Log Format with Proxy Information --with-proxy-log=FILE - Squid Log Format --with-squid-log=FILE - - Configure will let you use only one of these --with-TYPE-log - options. + --prefix=DIR + --with-var-dir=DIR + --with-rrd-dir=DIR + --with-html-dir=DIR + + Now that you have decided where the RRD, HTML, and optionally + the orcallator data files and the web server access logs, are + located, the configure script can be passed the following + arguments: + + --prefix=ORCA_PREFIX_DIRECTORY + --with-var-dir=VAR_DIR_LOCATION + --with-rrd-dir=RRD_DIR_LOCATION + --with-html-dir=HTML_DIR_LOCATION + + If you choose nothing else, the --with-html-dir must always be + used, otherwise configure will fail. + + --with-ncsa-log=LOG_FILENAME + --with-proxy-log=LOG_FILENAME + --with-squid-log=LOG_FILENAME + + If you use a web, proxy, or Squid server, you can have + orcallator gather statistics from the log file. Use this table + to determine the appropriate configure command line option to + use. LOG_FILENAME should be the location of the log file to + monitor. Note that Apache and NCSA servers use the Common Log + Format. + + Log Type Configure Option + ----------------------------------------------------------- + Common Log Format --with-ncsa-log + Common Log Format with Proxy Information --with-proxy-log + Squid Log Format --with-squid-log + + Configure will let you use only one of these options. + + --with-warn-email + + Orca has a `warn_email' configuration setting which is set to + an email address where Orca should send its warning messages. + By default this address is `root at localhost'. You can use this + configure option to change the default email address to use in + the Orca configuration scripts in this distribution. The configure script will find where your version of Perl and some other assorted programs are located. It will also determine if From blair at orcaware.com Fri Jan 3 18:13:38 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Fri, 3 Jan 2003 18:13:38 -0800 Subject: [Orca-checkins] rev 184 - in trunk/orca: . packages packages/Time-HiRes-1.41 Message-ID: <200301040213.h042DciV020213@orcaware.com> Author: blair Date: 2003-01-03 18:13:16 -0800 (Fri, 03 Jan 2003) New Revision: 184 Added: trunk/orca/packages/Time-HiRes-1.41/ Removed: trunk/orca/packages/Time-HiRes-1.39/ Modified: trunk/orca/configure.in trunk/orca/packages/Time-HiRes-1.41/Changes trunk/orca/packages/Time-HiRes-1.41/HiRes.pm trunk/orca/packages/Time-HiRes-1.41/Makefile.PL Log: Upgrade Time::HiRes from 1.39 to 1.41. * configure.in: Bump Time::HiRes' version number to 1.41. * packages/Time-HiRes-1.41: Renamed from packages/Time-HiRes-1.39. Directory contents updated from Time-HiRes-1.41.tar.gz. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-03 18:13:35.000000000 -0800 @@ -39,8 +39,8 @@ RRDTOOL_VER=1.000401 STORABLE_DIR=Storable-2.06 STORABLE_VER=2.06 -TIME_HIRES_DIR=Time-HiRes-1.39 -TIME_HIRES_VER=1.39 +TIME_HIRES_DIR=Time-HiRes-1.41 +TIME_HIRES_VER=1.41 AC_SUBST(COMPRESS_ZLIB_DIR) AC_SUBST(DATA_DUMPER_DIR) Copied: Time-HiRes-1.41 (from rev 183, trunk/orca/packages/Time-HiRes-1.39) Modified: trunk/orca/packages/Time-HiRes-1.41/HiRes.pm ============================================================================== --- trunk/orca/packages/Time-HiRes-1.39/HiRes.pm (original) +++ trunk/orca/packages/Time-HiRes-1.41/HiRes.pm 2003-01-03 18:13:35.000000000 -0800 @@ -15,7 +15,7 @@ d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer d_nanosleep); -$VERSION = '1.39'; +$VERSION = '1.41'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; Modified: trunk/orca/packages/Time-HiRes-1.41/Makefile.PL ============================================================================== --- trunk/orca/packages/Time-HiRes-1.39/Makefile.PL (original) +++ trunk/orca/packages/Time-HiRes-1.41/Makefile.PL 2003-01-03 18:13:35.000000000 -0800 @@ -7,10 +7,18 @@ use Config; use ExtUtils::MakeMaker; - -# Perls 5.002 and 5.003 did not have File::Spec, fake what we need. +use strict; my $VERBOSE = $ENV{VERBOSE}; +my $DEFINE; +my $LIBS; +my $XSOPT; + +unless($ENV{PERL_CORE}) { # This trick from Encode/Makefile.PL. + $ENV{PERL_CORE} = 1 if ($^X =~ m{\bminiperl[^/\\\]>:]*$}o); +} + +# Perls 5.002 and 5.003 did not have File::Spec, fake what we need. sub my_dirsep { $^O eq 'VMS' ? '.' : @@ -22,7 +30,7 @@ sub my_catdir { shift; my $catdir = join(my_dirsep, @_); - $^O eq 'VMS' ? "[$dirsep]" : $dirsep; + $^O eq 'VMS' ? "[$catdir]" : $catdir; } sub my_updir { @@ -38,6 +46,10 @@ } } +# Avoid 'used only once' warnings. +my $nop1 = *File::Spec::catdir; +my $nop2 = *File::Spec::updir; + # if you have 5.004_03 (and some slightly older versions?), xsubpp # tries to generate line numbers in the C code generated from the .xs. # unfortunately, it is a little buggy around #ifdef'd code. @@ -50,8 +62,7 @@ my $TMPDIR = (grep(defined $_ && -d $_ && -w _, ((defined $ENV{'TMPDIR'} ? $ENV{'TMPDIR'} : undef), - qw(/var/tmp /usr/tmp /tmp))))[0] - unless defined $TMPDIR; + qw(/var/tmp /usr/tmp /tmp))))[0]; $TMPDIR || die "Cannot find writable temporary directory.\n"; } @@ -59,7 +70,7 @@ my ($c, %args) = @_; my ($ok) = 0; - my ($tmp) = (($^O eq 'VMS') ? "sys\$scratch:tmp$$" : TMPDIR . '/' . "tmp$$"); + my ($tmp) = (($^O eq 'VMS') ? "sys\$scratch:tmp$$" : TMPDIR() . '/' . "tmp$$"); local(*TMPC); my $obj_ext = $Config{obj_ext} || ".o"; @@ -69,18 +80,21 @@ print TMPC $c; close(TMPC); - $cccmd = $args{cccmd}; + my $cccmd = $args{cccmd}; my $errornull; my $COREincdir; + if ($ENV{PERL_CORE}) { my $updir = File::Spec->updir; $COREincdir = File::Spec->catdir(($updir) x 3); } else { $COREincdir = File::Spec->catdir($Config{'archlibexp'}, 'CORE'); } + my $ccflags = $Config{'ccflags'} . ' ' . "-I$COREincdir"; + if ($^O eq 'VMS') { if ($ENV{PERL_CORE}) { # Fragile if the extensions change hierachy within @@ -89,7 +103,7 @@ } else { my $perl_core = $Config{'installarchlib'}; $perl_core =~ s/\]$/.CORE]/; - $cccmd = "$Config{'cc'} /include=(perl_root:[000000],$perl_core) $tmp.c"; + $cccmd = "$Config{'cc'} /include=(perl_root:[000000],$perl_core) $tmp.c"; } } @@ -99,18 +113,19 @@ $errornull = ''; } - $cccmd = "$Config{'cc'} -o $tmp $ccflags $tmp.c @$LIBS $errornull" + $cccmd = "$Config{'cc'} -o $tmp $ccflags $tmp.c @$LIBS $errornull" unless defined $cccmd; + if ($^O eq 'VMS') { open( CMDFILE, ">$tmp.com" ); print CMDFILE "\$ SET MESSAGE/NOFACILITY/NOSEVERITY/NOIDENT/NOTEXT\n"; print CMDFILE "\$ $cccmd\n"; - print CMDFILE "\$ IF \$SEVERITY .NE. 1 THEN EXIT 44\n"; # escalate + print CMDFILE "\$ IF \$SEVERITY .NE. 1 THEN EXIT 44\n"; # escalate close CMDFILE; system("\@ $tmp.com"); $ok = $?==0; for ("$tmp.c", "$tmp$obj_ext", "$tmp.com", "$tmp$Config{exe_ext}") { - 1 while unlink $_; + 1 while unlink $_; } } else @@ -128,7 +143,7 @@ sub has_gettimeofday { # confusing but true (if condition true ==> -DHAS_GETTIMEOFDAY already) return 0 if $Config{'d_gettimeod'} eq 'define'; - return 1 if try_compile_and_link(<= 5.005) { push (@makefileopts, @@ -380,11 +402,7 @@ } sub main { - print < Author: blair Date: 2003-01-04 11:57:51 -0800 (Sat, 04 Jan 2003) New Revision: 185 Modified: trunk/orca/Makefile.in trunk/orca/contrib/Makefile.in trunk/orca/contrib/orca_services/Makefile.in trunk/orca/docs/Makefile.in trunk/orca/lib/Makefile.in trunk/orca/orcallator/Makefile.in trunk/orca/packages/Makefile.in trunk/orca/src/Makefile.in Log: * Makefile.in, * contrib/Makefile.in, * contrib/orca_services/Makefile.in, * docs/Makefile.in, * lib/Makefile.in, * orcallator/Makefile.in, * packages/Makefile.in, * src/Makefile.in: Consistency cleanup. Replace all unnecessary tabs with spaces. Never begin the first line of a target command with more than one tab. In a target command that continues to the next line, place the continuation \ just after the end of the line, not way over to the right. This makes it easier to read, since your eye doesn't have to move to the left to see if the \ is there. In a target command that continues to the next line and is indented itself with respect to the previous line, use two spaces as an indent, not a tab. Modified: trunk/orca/Makefile.in ============================================================================== --- trunk/orca/Makefile.in (original) +++ trunk/orca/Makefile.in 2003-01-04 11:58:00.000000000 -0800 @@ -1,29 +1,35 @@ @SET_MAKE@ -SUBDIRS = packages lib src @ORCALLATOR_SUBDIR@ docs contrib -prefix = @prefix@ -MKDIR = @MKDIR@ -MAKE_RRDTOOL = @MAKE_RRDTOOL@ -RRD_DIR = @RRD_DIR@ -VAR_DIR = @VAR_DIR@ -ORCALLATOR_DIR = $(VAR_DIR)/orcallator -CFLAGS = @CFLAGS@ - -all: configure config/PerlHead1 config/PerlHead2 Makefile - @for dir in $(SUBDIRS); do \ - if test -d $$dir; then \ - echo "cd $$dir"; \ - cd $$dir || exit 1; \ - echo "$(MAKE) CFLAGS=$(CFLAGS) || exit 1"; \ - $(MAKE) CFLAGS="$(CFLAGS)" || exit 1; \ - echo "cd .."; \ - cd ..; \ - else \ - exit 1; \ - fi \ +prefix = @prefix@ +MKDIR = @MKDIR@ +MAKE_RRDTOOL = @MAKE_RRDTOOL@ +RRD_DIR = @RRD_DIR@ +VAR_DIR = @VAR_DIR@ +ORCALLATOR_DIR = $(VAR_DIR)/orcallator +CFLAGS = @CFLAGS@ + +SUBDIRS = packages \ + lib \ + src \ + @ORCALLATOR_SUBDIR@ \ + docs \ + contrib + +all: configure config/PerlHead1 config/PerlHead2 Makefile + @for dir in $(SUBDIRS); do \ + if test -d $$dir; then \ + echo "cd $$dir"; \ + cd $$dir || exit 1; \ + echo "$(MAKE) CFLAGS=$(CFLAGS) || exit 1"; \ + $(MAKE) CFLAGS="$(CFLAGS)" || exit 1; \ + echo "cd .."; \ + cd ..; \ + else \ + exit 1; \ + fi \ done -test: configure Makefile +test: configure Makefile upgrade: cd src && $(MAKE) upgrade_installation @@ -32,17 +38,17 @@ $(MKDIR) $(VAR_DIR) $(MKDIR) $(ORCALLATOR_DIR) $(MKDIR) $(RRD_DIR)/orcallator - @for dir in $(SUBDIRS); do \ - if test -d $$dir; then \ - echo "cd $$dir"; \ - cd $$dir || exit 1; \ - echo "$(MAKE) CFLAGS=$(CFLAGS) install || exit 1"; \ - $(MAKE) CFLAGS="$(CFLAGS)" install || exit 1; \ - echo "cd .."; \ - cd ..; \ - else \ - exit 1; \ - fi \ + @for dir in $(SUBDIRS); do \ + if test -d $$dir; then \ + echo "cd $$dir"; \ + cd $$dir || exit 1; \ + echo "$(MAKE) CFLAGS=$(CFLAGS) install || exit 1"; \ + $(MAKE) CFLAGS="$(CFLAGS)" install || exit 1; \ + echo "cd .."; \ + cd ..; \ + else \ + exit 1; \ + fi \ done install_contrib: @@ -58,15 +64,15 @@ cd packages && $(MAKE) CFLAGS="$(CFLAGS)" install_modules clean: $(CLEAN_RRDTOOL) - @for dir in $(SUBDIRS); do \ - echo "cd $$dir && $(MAKE) clean"; \ - (cd $$dir && $(MAKE) clean); \ + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) clean"; \ + (cd $$dir && $(MAKE) clean); \ done distclean: $(DISTCLEAN_RRDTOOL) - @for dir in $(SUBDIRS); do \ - echo "cd $$dir && $(MAKE) distclean"; \ - (cd $$dir && $(MAKE) distclean); \ + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) distclean"; \ + (cd $$dir && $(MAKE) distclean); \ done $(RM) -r autom4te*.cache $(RM) config/aclocal.m4 config/PerlHead1 config/PerlHead2 Modified: trunk/orca/src/Makefile.in ============================================================================== --- trunk/orca/src/Makefile.in (original) +++ trunk/orca/src/Makefile.in 2003-01-04 11:58:00.000000000 -0800 @@ -1,48 +1,49 @@ @SET_MAKE@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -INSTALL = @INSTALL@ -MKDIR = @MKDIR@ -PERL_HEAD = @PERL_HEAD@ -RRD_DIR = @RRD_DIR@ -VAR_DIR = @VAR_DIR@ -ORCALLATOR_DIR = $(VAR_DIR)/orcallator -PERL_SCRIPTS = orca upgrade_installation -SHELL_SCRIPTS = -TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ +PERL_HEAD = @PERL_HEAD@ +RRD_DIR = @RRD_DIR@ +VAR_DIR = @VAR_DIR@ +ORCALLATOR_DIR = $(VAR_DIR)/orcallator +PERL_SCRIPTS = orca \ + upgrade_installation +SHELL_SCRIPTS = +TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) -all: Makefile $(TARGETS) +all: Makefile $(TARGETS) install: all - $(MKDIR) $(bindir) - @for file in $(TARGETS); do \ - echo $(INSTALL) $$file $(bindir); \ - $(INSTALL) $$file $(bindir); \ - done + $(MKDIR) $(bindir) + @for file in $(TARGETS); do \ + echo $(INSTALL) $$file $(bindir); \ + $(INSTALL) $$file $(bindir); \ + done -upgrade: upgrade_installation - ./upgrade_installation $(prefix) $(exec_prefix) $(bindir) $(libdir) $(ORCALLATOR_DIR) $(RRD_DIR) +upgrade: upgrade_installation + ./upgrade_installation $(prefix) $(exec_prefix) $(bindir) $(libdir) $(ORCALLATOR_DIR) $(RRD_DIR) clean: - $(RM) $(TARGETS) + $(RM) $(TARGETS) -distclean: clean - $(RM) *.sh orca.pl Makefile +distclean: clean + $(RM) *.sh orca.pl Makefile -.SUFFIXES: .pl .sh +.SUFFIXES: .pl .sh -.pl: $(PERL_HEAD) - cat $(PERL_HEAD) $< > $@ - chmod 0755 $@ +.pl: $(PERL_HEAD) + cat $(PERL_HEAD) $< > $@ + chmod 0755 $@ .sh: - cp $< $@ - chmod 0755 $@ + cp $< $@ + chmod 0755 $@ -Makefile: Makefile.in - cd .. && CONFIG_FILES=src/Makefile ./config.status +Makefile: Makefile.in + cd .. && CONFIG_FILES=src/Makefile ./config.status -orca.pl: orca.pl.in - cd .. && CONFIG_FILES=src/orca.pl ./config.status +orca.pl: orca.pl.in + cd .. && CONFIG_FILES=src/orca.pl ./config.status Modified: trunk/orca/docs/Makefile.in ============================================================================== --- trunk/orca/docs/Makefile.in (original) +++ trunk/orca/docs/Makefile.in 2003-01-04 11:58:00.000000000 -0800 @@ -1,17 +1,19 @@ @SET_MAKE@ -prefix = @prefix@ -mandir = @mandir@/man1 -INSTALL = @INSTALL@ -MKDIR = @MKDIR@ -ORCA = ../src/orca.pl -POD2HTML = @POD2HTML@ -POD2MAN = @POD2MAN@ -POD2TEXT = @POD2TEXT@ +prefix = @prefix@ +mandir = @mandir@/man1 +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ +ORCA = ../src/orca.pl +POD2HTML = @POD2HTML@ +POD2MAN = @POD2MAN@ +POD2TEXT = @POD2TEXT@ + +TARGETS = orca.html \ + orca.man \ + orca.txt -TARGETS = orca.html orca.man orca.txt - -all: Makefile $(TARGETS) +all: Makefile $(TARGETS) orca.html: $(ORCA) $(POD2HTML) $(ORCA) > $@ Modified: trunk/orca/contrib/Makefile.in ============================================================================== --- trunk/orca/contrib/Makefile.in (original) +++ trunk/orca/contrib/Makefile.in 2003-01-04 11:58:00.000000000 -0800 @@ -1,32 +1,33 @@ @SET_MAKE@ -SUBDIRS = orca_services rotate_orca_graphs +SUBDIRS = orca_services \ + rotate_orca_graphs all: Makefile $(TARGETS) - @for dir in $(SUBDIRS); do \ - echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS)"; \ - (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)"); \ + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS)"; \ + (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)"); \ done # Users will need to install the contributed programs by hand. install: install_contrib: - @for dir in $(SUBDIRS); do \ - echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) install"; \ - (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)" install); \ + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) install"; \ + (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)" install); \ done clean: - @for dir in $(SUBDIRS); do \ - echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) clean"; \ - (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)" clean); \ + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) clean"; \ + (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)" clean); \ done distclean: clean - @for dir in $(SUBDIRS); do \ - echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) distclean"; \ - (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)" distclean); \ + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) distclean"; \ + (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)" distclean); \ done $(RM) Makefile Modified: trunk/orca/contrib/orca_services/Makefile.in ============================================================================== --- trunk/orca/contrib/orca_services/Makefile.in (original) +++ trunk/orca/contrib/orca_services/Makefile.in 2003-01-04 11:58:00.000000000 -0800 @@ -1,85 +1,88 @@ @SET_MAKE@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -INSTALL = @INSTALL@ -MKDIR = @MKDIR@ -PERL_HEAD = @PERL_HEAD@ -VAR_DIR = @VAR_DIR@ -RRD_DIR = @RRD_DIR@ -RRDTOOL_DIR = @RRDTOOL_DIR@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ +PERL_HEAD = @PERL_HEAD@ +VAR_DIR = @VAR_DIR@ +RRD_DIR = @RRD_DIR@ +RRDTOOL_DIR = @RRDTOOL_DIR@ ORCA_SERVICES_DIR = $(VAR_DIR)/orca_services -PERL_SCRIPTS = orca_services_running orca_services.pl -SHELL_SCRIPTS = restart_orca_services stop_orca_services start_orca_services \ - S99orca_services -TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) +PERL_SCRIPTS = orca_services_running \ + orca_services.pl +SHELL_SCRIPTS = restart_orca_services \ + stop_orca_services \ + start_orca_services \ + S99orca_services +TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) -all: Makefile $(TARGETS) orca_services.cfg +all: Makefile $(TARGETS) orca_services.cfg install: all - $(MKDIR) $(bindir) - $(MKDIR) $(libdir) - $(MKDIR) $(RRD_DIR)/orca_services - @for file in $(TARGETS); do \ - echo $(INSTALL) $$file $(bindir); \ - $(INSTALL) $$file $(bindir); \ - done - if test -r $(libdir)/orca_services.cfg; then \ - cp -p $(libdir)/orca_services.cfg $(libdir)/orca_services.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ - fi - $(INSTALL) -m 0644 orca_services.cfg $(libdir) - $(INSTALL) -m 0755 orca_services.pl $(libdir) + $(MKDIR) $(bindir) + $(MKDIR) $(libdir) + $(MKDIR) $(RRD_DIR)/orca_services + @for file in $(TARGETS); do \ + echo $(INSTALL) $$file $(bindir); \ + $(INSTALL) $$file $(bindir); \ + done + if test -r $(libdir)/orca_services.cfg; then \ + cp -p $(libdir)/orca_services.cfg $(libdir)/orca_services.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ + fi + $(INSTALL) -m 0644 orca_services.cfg $(libdir) + $(INSTALL) -m 0755 orca_services.pl $(libdir) orca_services_run_at_boot: all - -$(RM) /etc/init.d/orca_services /etc/rc0.d/K01orca_services - -$(RM) /etc/rc1.d/K01orca_services /etc/rc3.d/S99orca_services - $(INSTALL) -m 0744 S99orca_services /etc/init.d/orca_services - ln /etc/init.d/orca_services /etc/rc0.d/K01orca_services - ln /etc/init.d/orca_services /etc/rc1.d/K01orca_services - ln /etc/init.d/orca_services /etc/rc3.d/S99orca_services + -$(RM) /etc/init.d/orca_services /etc/rc0.d/K01orca_services + -$(RM) /etc/rc1.d/K01orca_services /etc/rc3.d/S99orca_services + $(INSTALL) -m 0744 S99orca_services /etc/init.d/orca_services + ln /etc/init.d/orca_services /etc/rc0.d/K01orca_services + ln /etc/init.d/orca_services /etc/rc1.d/K01orca_services + ln /etc/init.d/orca_services /etc/rc3.d/S99orca_services clean: - $(RM) $(TARGETS) + $(RM) $(TARGETS) -distclean: clean - $(RM) *.sh orca_services.cfg orca_services_running.pl Makefile +distclean: clean + $(RM) *.sh orca_services.cfg orca_services_running.pl Makefile -.SUFFIXES: .pl .sh +.SUFFIXES: .pl .sh -.pl: $(PERL_HEAD) - cat $(PERL_HEAD) $< > $@ - chmod 0755 $@ +.pl: $(PERL_HEAD) + cat $(PERL_HEAD) $< > $@ + chmod 0755 $@ .sh: - cp $< $@ - chmod 0755 $@ + cp $< $@ + chmod 0755 $@ -Makefile: Makefile.in - cd ../.. && CONFIG_FILES=contrib/orca_services/Makefile ./config.status - $(MAKE) +Makefile: Makefile.in + cd ../.. && CONFIG_FILES=contrib/orca_services/Makefile ./config.status + $(MAKE) -orca_services.cfg: orca_services.cfg.in - cd ../.. && CONFIG_FILES=contrib/orca_services/orca_services.cfg ./config.status +orca_services.cfg: orca_services.cfg.in + cd ../.. && CONFIG_FILES=contrib/orca_services/orca_services.cfg ./config.status -orca_services.pl: orca_services.pl.in $(PERL_HEAD) - cd ../.. && CONFIG_FILES=contrib/orca_services/orca_services.pl ./config.status - cat $(PERL_HEAD) orca_services.pl > orca_services.perl - mv orca_services.perl orca_services.pl - chmod 0755 orca_services.pl +orca_services.pl: orca_services.pl.in $(PERL_HEAD) + cd ../.. && CONFIG_FILES=contrib/orca_services/orca_services.pl ./config.status + cat $(PERL_HEAD) orca_services.pl > orca_services.perl + mv orca_services.perl orca_services.pl + chmod 0755 orca_services.pl -orca_services_running.pl: orca_services_running.pl.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/orca_services_running.pl ./config.status +orca_services_running.pl: orca_services_running.pl.in + cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/orca_services_running.pl ./config.status -restart_orca_services.sh: restart_orca_services.sh.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/restart_orca_services.sh ./config.status +restart_orca_services.sh: restart_orca_services.sh.in + cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/restart_orca_services.sh ./config.status -start_orca_services.sh: start_orca_services.sh.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/start_orca_services.sh ./config.status +start_orca_services.sh: start_orca_services.sh.in + cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/start_orca_services.sh ./config.status -stop_orca_services.sh: stop_orca_services.sh.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/stop_orca_services.sh ./config.status +stop_orca_services.sh: stop_orca_services.sh.in + cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/stop_orca_services.sh ./config.status -S99orca_services.sh: S99orca_services.sh.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/S99orca_services.sh ./config.status +S99orca_services.sh: S99orca_services.sh.in + cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/S99orca_services.sh ./config.status Modified: trunk/orca/orcallator/Makefile.in ============================================================================== --- trunk/orca/orcallator/Makefile.in (original) +++ trunk/orca/orcallator/Makefile.in 2003-01-04 11:58:00.000000000 -0800 @@ -1,76 +1,80 @@ @SET_MAKE@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -INSTALL = @INSTALL@ -MKDIR = @MKDIR@ -PERL_HEAD = @PERL_HEAD@ -VAR_DIR = @VAR_DIR@ -RRD_DIR = @RRD_DIR@ -RRDTOOL_DIR = @RRDTOOL_DIR@ -PERL_SCRIPTS = orcallator_column orcallator_running -SHELL_SCRIPTS = restart_orcallator stop_orcallator start_orcallator \ - S99orcallator -TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ +PERL_HEAD = @PERL_HEAD@ +VAR_DIR = @VAR_DIR@ +RRD_DIR = @RRD_DIR@ +RRDTOOL_DIR = @RRDTOOL_DIR@ +ORCALLATOR_DIR = $(VAR_DIR)/orcallator +PERL_SCRIPTS = orcallator_column \ + orcallator_running +SHELL_SCRIPTS = restart_orcallator \ + stop_orcallator \ + start_orcallator \ + S99orcallator +TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) -all: Makefile $(TARGETS) orcallator.cfg +all: Makefile $(TARGETS) orcallator.cfg install: all - $(MKDIR) $(bindir) - $(MKDIR) $(libdir) - @for file in $(TARGETS); do \ - echo $(INSTALL) $$file $(bindir); \ - $(INSTALL) $$file $(bindir); \ - done - if test -r $(libdir)/orcallator.cfg; then \ - cp -p $(libdir)/orcallator.cfg $(libdir)/orcallator.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ - fi - $(INSTALL) -m 0644 orcallator.cfg $(libdir) - $(INSTALL) -m 0644 orcallator.se $(libdir) + $(MKDIR) $(bindir) + $(MKDIR) $(libdir) + @for file in $(TARGETS); do \ + echo $(INSTALL) $$file $(bindir); \ + $(INSTALL) $$file $(bindir); \ + done + if test -r $(libdir)/orcallator.cfg; then \ + cp -p $(libdir)/orcallator.cfg $(libdir)/orcallator.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ + fi + $(INSTALL) -m 0644 orcallator.cfg $(libdir) + $(INSTALL) -m 0644 orcallator.se $(libdir) orcallator_run_at_boot: all - -$(RM) /etc/init.d/orcallator /etc/rc0.d/K01orcallator - -$(RM) /etc/rc1.d/K01orcallator /etc/rc3.d/S99orcallator - $(INSTALL) -m 0744 S99orcallator /etc/init.d/orcallator - ln /etc/init.d/orcallator /etc/rc0.d/K01orcallator - ln /etc/init.d/orcallator /etc/rc1.d/K01orcallator - ln /etc/init.d/orcallator /etc/rc3.d/S99orcallator + -$(RM) /etc/init.d/orcallator /etc/rc0.d/K01orcallator + -$(RM) /etc/rc1.d/K01orcallator /etc/rc3.d/S99orcallator + $(INSTALL) -m 0744 S99orcallator /etc/init.d/orcallator + ln /etc/init.d/orcallator /etc/rc0.d/K01orcallator + ln /etc/init.d/orcallator /etc/rc1.d/K01orcallator + ln /etc/init.d/orcallator /etc/rc3.d/S99orcallator clean: - $(RM) $(TARGETS) + $(RM) $(TARGETS) -distclean: clean - $(RM) *.sh orcallator.cfg orcallator_running.pl Makefile +distclean: clean + $(RM) *.sh orcallator.cfg orcallator_running.pl Makefile -.SUFFIXES: .pl .sh +.SUFFIXES: .pl .sh -.pl: $(PERL_HEAD) - cat $(PERL_HEAD) $< > $@ - chmod 0755 $@ +.pl: $(PERL_HEAD) + cat $(PERL_HEAD) $< > $@ + chmod 0755 $@ .sh: - cp $< $@ - chmod 0755 $@ + cp $< $@ + chmod 0755 $@ -Makefile: Makefile.in - cd .. && CONFIG_FILES=orcallator/Makefile ./config.status +Makefile: Makefile.in + cd .. && CONFIG_FILES=orcallator/Makefile ./config.status -orcallator.cfg: orcallator.cfg.in - cd .. && CONFIG_FILES=orcallator/orcallator.cfg ./config.status +orcallator.cfg: orcallator.cfg.in + cd .. && CONFIG_FILES=orcallator/orcallator.cfg ./config.status -orcallator_running.pl: orcallator_running.pl.in - cd .. && CONFIG_FILES=orcallator/orcallator_running.pl ./config.status +orcallator_running.pl: orcallator_running.pl.in + cd .. && CONFIG_FILES=orcallator/orcallator_running.pl ./config.status -restart_orcallator.sh: restart_orcallator.sh.in - cd .. && CONFIG_FILES=orcallator/restart_orcallator.sh ./config.status +restart_orcallator.sh: restart_orcallator.sh.in + cd .. && CONFIG_FILES=orcallator/restart_orcallator.sh ./config.status -start_orcallator.sh: start_orcallator.sh.in - cd .. && CONFIG_FILES=orcallator/start_orcallator.sh ./config.status +start_orcallator.sh: start_orcallator.sh.in + cd .. && CONFIG_FILES=orcallator/start_orcallator.sh ./config.status -stop_orcallator.sh: stop_orcallator.sh.in - cd .. && CONFIG_FILES=orcallator/stop_orcallator.sh ./config.status +stop_orcallator.sh: stop_orcallator.sh.in + cd .. && CONFIG_FILES=orcallator/stop_orcallator.sh ./config.status -S99orcallator.sh: S99orcallator.sh.in - cd .. && CONFIG_FILES=orcallator/S99orcallator.sh ./config.status +S99orcallator.sh: S99orcallator.sh.in + cd .. && CONFIG_FILES=orcallator/S99orcallator.sh ./config.status Modified: trunk/orca/lib/Makefile.in ============================================================================== --- trunk/orca/lib/Makefile.in (original) +++ trunk/orca/lib/Makefile.in 2003-01-04 11:58:00.000000000 -0800 @@ -1,15 +1,15 @@ @SET_MAKE@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -libdir = @libdir@ -INSTALL = @INSTALL@ -MKDIR = @MKDIR@ - -all: Makefile \ - orca_logo.gif.hex \ - rrdtool_logo.gif.hex \ - rothschild_image_logo.png.hex +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ + +all: Makefile \ + orca_logo.gif.hex \ + rrdtool_logo.gif.hex \ + rothschild_image_logo.png.hex # Create a hex file representation of orca_logo.gif that can be stored # inside orca.pl. @@ -28,16 +28,16 @@ install: all $(MKDIR) $(libdir)/Orca - @for f in Orca/*.pm; do \ - $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ - echo $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ + @for f in Orca/*.pm; do \ + $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ + echo $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ done - @if test -d Orca/Config; then \ - $(MKDIR) $(libdir)/Orca/Config; \ - for f in Orca/Config/*.pm; do \ - $(INSTALL) -m 0644 $$f $(libdir)/Orca/Config; \ - echo $(INSTALL) -m 0644 $$f $(libdir)/Orca/Config; \ - done; \ + @if test -d Orca/Config; then \ + $(MKDIR) $(libdir)/Orca/Config; \ + for f in Orca/Config/*.pm; do \ + $(INSTALL) -m 0644 $$f $(libdir)/Orca/Config; \ + echo $(INSTALL) -m 0644 $$f $(libdir)/Orca/Config; \ + done; \ fi clean: Modified: trunk/orca/packages/Makefile.in ============================================================================== --- trunk/orca/packages/Makefile.in (original) +++ trunk/orca/packages/Makefile.in 2003-01-04 11:58:00.000000000 -0800 @@ -1,65 +1,95 @@ @SET_MAKE@ -PERL = @PERL@ -CFLAGS = @CFLAGS@ +PERL = @PERL@ +CFLAGS = @CFLAGS@ -compress_zlib_dir = @COMPRESS_ZLIB_DIR@ -data_dumper_dir = @DATA_DUMPER_DIR@ -date_parse_dir = @DATE_PARSE_DIR@ -digest_md5_dir = @DIGEST_MD5_DIR@ -math_intervalsearch_dir = @MATH_INTERVALSEARCH_DIR@ -rrdtool_dir = @RRDTOOL_DIR@ -storable_dir = @STORABLE_DIR@ - -MAKE_COMPRESS_ZLIB = @MAKE_COMPRESS_ZLIB@ -MAKE_DATA_DUMPER = @MAKE_DATA_DUMPER@ -MAKE_DATE_PARSE = @MAKE_DATE_PARSE@ -MAKE_DIGEST_MD5 = @MAKE_DIGEST_MD5@ -MAKE_MATH_INTERVALSEARCH = @MAKE_MATH_INTERVALSEARCH@ -MAKE_RRDTOOL = @MAKE_RRDTOOL@ -MAKE_STORABLE = @MAKE_STORABLE@ -MAKE_TARGETS = $(MAKE_COMPRESS_ZLIB) $(MAKE_DATA_DUMPER) $(MAKE_DATE_PARSE) $(MAKE_DIGEST_MD5) $(MAKE_MATH_INTERVALSEARCH) $(MAKE_RRDTOOL) $(MAKE_STORABLE) - -TEST_COMPRESS_ZLIB = @TEST_COMPRESS_ZLIB@ -TEST_DATA_DUMPER = @TEST_DATA_DUMPER@ -TEST_DATE_PARSE = @TEST_DATE_PARSE@ -TEST_DIGEST_MD5 = @TEST_DIGEST_MD5@ -TEST_MATH_INTERVALSEARCH = @TEST_MATH_INTERVALSEARCH@ -TEST_RRDTOOL = @TEST_RRDTOOL@ -TEST_STORABLE = @TEST_STORABLE@ -TEST_TARGETS = $(TEST_COMPRESS_ZLIB) $(TEST_DATA_DUMPER) $(TEST_DATE_PARSE) $(TEST_DIGEST_MD5) $(TEST_MATH_INTERVALSEARCH) $(TEST_RRDTOOL) $(TEST_STORABLE) - -INSTALL_PERL_COMPRESS_ZLIB = @INSTALL_PERL_COMPRESS_ZLIB@ -INSTALL_PERL_DATA_DUMPER = @INSTALL_PERL_DATA_DUMPER@ -INSTALL_PERL_DATE_PARSE = @INSTALL_PERL_DATE_PARSE@ -INSTALL_PERL_DIGEST_MD5 = @INSTALL_PERL_DIGEST_MD5@ -INSTALL_PERL_MATH_INTERVALSEARCH= @INSTALL_PERL_MATH_INTERVALSEARCH@ -INSTALL_PERL_RRDTOOL = @INSTALL_PERL_RRDTOOL@ -INSTALL_PERL_STORABLE = @INSTALL_PERL_STORABLE@ -INSTALL_PERL_TARGETS = $(INSTALL_PERL_COMPRESS_ZLIB) $(INSTALL_PERL_DATA_DUMPER) $(INSTALL_PERL_DATE_PARSE) $(INSTALL_PERL_DIGEST_MD5) $(INSTALL_PERL_MATH_INTERVALSEARCH) $(INSTALL_PERL_RRDTOOL) $(INSTALL_PERL_STORABLE) - -INSTALL_LIB_RRDTOOL = @INSTALL_LIB_RRDTOOL@ -INSTALL_LIB_TARGETS = $(INSTALL_LIB_RRDTOOL) - -CLEAN_COMPRESS_ZLIB = @CLEAN_COMPRESS_ZLIB@ -CLEAN_DATA_DUMPER = @CLEAN_DATA_DUMPER@ -CLEAN_DATE_PARSE = @CLEAN_DATE_PARSE@ -CLEAN_DIGEST_MD5 = @CLEAN_DIGEST_MD5@ -CLEAN_MATH_INTERVALSEARCH = @CLEAN_MATH_INTERVALSEARCH@ -CLEAN_RRDTOOL = @CLEAN_RRDTOOL@ -CLEAN_STORABLE = @CLEAN_STORABLE@ -CLEAN_TARGETS = $(CLEAN_COMPRESS_ZLIB) $(CLEAN_DATA_DUMPER) $(CLEAN_DATE_PARSE) $(CLEAN_DIGEST_MD5) $(CLEAN_MATH_INTERVALSEARCH) $(CLEAN_RRDTOOL) $(CLEAN_STORABLE) - -DISTCLEAN_COMPRESS_ZLIB = @DISTCLEAN_COMPRESS_ZLIB@ -DISTCLEAN_DATA_DUMPER = @DISTCLEAN_DATA_DUMPER@ -DISTCLEAN_DATE_PARSE = @DISTCLEAN_DATE_PARSE@ -DISTCLEAN_DIGEST_MD5 = @DISTCLEAN_DIGEST_MD5@ -DISTCLEAN_MATH_INTERVALSEARCH = @DISTCLEAN_MATH_INTERVALSEARCH@ -DISTCLEAN_RRDTOOL = @DISTCLEAN_RRDTOOL@ -DISTCLEAN_STORABLE = @DISTCLEAN_STORABLE@ -DISTCLEAN_TARGETS = $(DISTCLEAN_COMPRESS_ZLIB) $(DISTCLEAN_DATA_DUMPER) $(DISTCLEAN_DATE_PARSE) $(DISTCLEAN_DIGEST_MD5) $(DISTCLEAN_MATH_INTERVALSEARCH) $(DISTCLEAN_RRDTOOL) $(DISTCLEAN_STORABLE) +compress_zlib_dir = @COMPRESS_ZLIB_DIR@ +data_dumper_dir = @DATA_DUMPER_DIR@ +date_parse_dir = @DATE_PARSE_DIR@ +digest_md5_dir = @DIGEST_MD5_DIR@ +math_intervalsearch_dir = @MATH_INTERVALSEARCH_DIR@ +rrdtool_dir = @RRDTOOL_DIR@ +storable_dir = @STORABLE_DIR@ + +MAKE_COMPRESS_ZLIB = @MAKE_COMPRESS_ZLIB@ +MAKE_DATA_DUMPER = @MAKE_DATA_DUMPER@ +MAKE_DATE_PARSE = @MAKE_DATE_PARSE@ +MAKE_DIGEST_MD5 = @MAKE_DIGEST_MD5@ +MAKE_MATH_INTERVALSEARCH = @MAKE_MATH_INTERVALSEARCH@ +MAKE_RRDTOOL = @MAKE_RRDTOOL@ +MAKE_STORABLE = @MAKE_STORABLE@ +MAKE_TARGETS = $(MAKE_COMPRESS_ZLIB) \ + $(MAKE_DATA_DUMPER) \ + $(MAKE_DATE_PARSE) \ + $(MAKE_DIGEST_MD5) \ + $(MAKE_MATH_INTERVALSEARCH) \ + $(MAKE_RRDTOOL) \ + $(MAKE_STORABLE) + +TEST_COMPRESS_ZLIB = @TEST_COMPRESS_ZLIB@ +TEST_DATA_DUMPER = @TEST_DATA_DUMPER@ +TEST_DATE_PARSE = @TEST_DATE_PARSE@ +TEST_DIGEST_MD5 = @TEST_DIGEST_MD5@ +TEST_MATH_INTERVALSEARCH = @TEST_MATH_INTERVALSEARCH@ +TEST_RRDTOOL = @TEST_RRDTOOL@ +TEST_STORABLE = @TEST_STORABLE@ +TEST_TARGETS = $(TEST_COMPRESS_ZLIB) \ + $(TEST_DATA_DUMPER) \ + $(TEST_DATE_PARSE) \ + $(TEST_DIGEST_MD5) \ + $(TEST_MATH_INTERVALSEARCH) \ + $(TEST_RRDTOOL) \ + $(TEST_STORABLE) + +INSTALL_PERL_COMPRESS_ZLIB = @INSTALL_PERL_COMPRESS_ZLIB@ +INSTALL_PERL_DATA_DUMPER = @INSTALL_PERL_DATA_DUMPER@ +INSTALL_PERL_DATE_PARSE = @INSTALL_PERL_DATE_PARSE@ +INSTALL_PERL_DIGEST_MD5 = @INSTALL_PERL_DIGEST_MD5@ +INSTALL_PERL_MATH_INTERVALSEARCH = @INSTALL_PERL_MATH_INTERVALSEARCH@ +INSTALL_PERL_RRDTOOL = @INSTALL_PERL_RRDTOOL@ +INSTALL_PERL_STORABLE = @INSTALL_PERL_STORABLE@ +INSTALL_PERL_TARGETS = $(INSTALL_PERL_COMPRESS_ZLIB) \ + $(INSTALL_PERL_DATA_DUMPER) \ + $(INSTALL_PERL_DATE_PARSE) \ + $(INSTALL_PERL_DIGEST_MD5) \ + $(INSTALL_PERL_MATH_INTERVALSEARCH) \ + $(INSTALL_PERL_RRDTOOL) \ + $(INSTALL_PERL_STORABLE) + +INSTALL_LIB_RRDTOOL = @INSTALL_LIB_RRDTOOL@ +INSTALL_LIB_TARGETS = $(INSTALL_LIB_RRDTOOL) + +CLEAN_COMPRESS_ZLIB = @CLEAN_COMPRESS_ZLIB@ +CLEAN_DATA_DUMPER = @CLEAN_DATA_DUMPER@ +CLEAN_DATE_PARSE = @CLEAN_DATE_PARSE@ +CLEAN_DIGEST_MD5 = @CLEAN_DIGEST_MD5@ +CLEAN_MATH_INTERVALSEARCH = @CLEAN_MATH_INTERVALSEARCH@ +CLEAN_RRDTOOL = @CLEAN_RRDTOOL@ +CLEAN_STORABLE = @CLEAN_STORABLE@ +CLEAN_TARGETS = $(CLEAN_COMPRESS_ZLIB) \ + $(CLEAN_DATA_DUMPER) \ + $(CLEAN_DATE_PARSE) \ + $(CLEAN_DIGEST_MD5) \ + $(CLEAN_MATH_INTERVALSEARCH) \ + $(CLEAN_RRDTOOL) \ + $(CLEAN_STORABLE) + +DISTCLEAN_COMPRESS_ZLIB = @DISTCLEAN_COMPRESS_ZLIB@ +DISTCLEAN_DATA_DUMPER = @DISTCLEAN_DATA_DUMPER@ +DISTCLEAN_DATE_PARSE = @DISTCLEAN_DATE_PARSE@ +DISTCLEAN_DIGEST_MD5 = @DISTCLEAN_DIGEST_MD5@ +DISTCLEAN_MATH_INTERVALSEARCH = @DISTCLEAN_MATH_INTERVALSEARCH@ +DISTCLEAN_RRDTOOL = @DISTCLEAN_RRDTOOL@ +DISTCLEAN_STORABLE = @DISTCLEAN_STORABLE@ +DISTCLEAN_TARGETS = $(DISTCLEAN_COMPRESS_ZLIB) \ + $(DISTCLEAN_DATA_DUMPER) \ + $(DISTCLEAN_DATE_PARSE) \ + $(DISTCLEAN_DIGEST_MD5) \ + $(DISTCLEAN_MATH_INTERVALSEARCH) \ + $(DISTCLEAN_RRDTOOL) \ + $(DISTCLEAN_STORABLE) -all: Makefile $(MAKE_TARGETS) +all: Makefile $(MAKE_TARGETS) make_compress_zlib: make_rrdtool_zlib $(compress_zlib_dir)/Makefile cd $(compress_zlib_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" @@ -165,61 +195,61 @@ clean: $(CLEAN_TARGETS) clean_compress_zlib: clean_rrdtool - @if test -r $(compress_zlib_dir)/Makefile; then \ - echo 'cd $(compress_zlib_dir) && $(MAKE) clean'; \ - (cd $(compress_zlib_dir) && $(MAKE) clean); \ + @if test -r $(compress_zlib_dir)/Makefile; then \ + echo 'cd $(compress_zlib_dir) && $(MAKE) clean'; \ + (cd $(compress_zlib_dir) && $(MAKE) clean); \ fi clean_data_dumper: - @if test -r $(data_dumper_dir)/Makefile; then \ - echo 'cd $(data_dumper_dir) && $(MAKE) clean'; \ - (cd $(data_dumper_dir) && $(MAKE) clean); \ + @if test -r $(data_dumper_dir)/Makefile; then \ + echo 'cd $(data_dumper_dir) && $(MAKE) clean'; \ + (cd $(data_dumper_dir) && $(MAKE) clean); \ fi clean_date_parse: - @if test -r $(date_parse_dir)/Makefile; then \ - echo 'cd $(date_parse_dir) && $(MAKE) clean'; \ - (cd $(date_parse_dir) && $(MAKE) clean); \ + @if test -r $(date_parse_dir)/Makefile; then \ + echo 'cd $(date_parse_dir) && $(MAKE) clean'; \ + (cd $(date_parse_dir) && $(MAKE) clean); \ fi clean_digest_md5: - @if test -r $(digest_md5_dir)/Makefile; then \ - echo 'cd $(digest_md5_dir) && $(MAKE) clean'; \ - (cd $(digest_md5_dir) && $(MAKE) clean); \ + @if test -r $(digest_md5_dir)/Makefile; then \ + echo 'cd $(digest_md5_dir) && $(MAKE) clean'; \ + (cd $(digest_md5_dir) && $(MAKE) clean); \ fi clean_math_intervalsearch: - @if test -r $(math_intervalsearch_dir)/Makefile; then \ - echo 'cd $(math_intervalsearch_dir) && $(MAKE) clean'; \ - (cd $(math_intervalsearch_dir) && $(MAKE) clean); \ + @if test -r $(math_intervalsearch_dir)/Makefile; then \ + echo 'cd $(math_intervalsearch_dir) && $(MAKE) clean'; \ + (cd $(math_intervalsearch_dir) && $(MAKE) clean); \ fi clean_rrdtool: (cd $(rrdtool_dir) && $(MAKE) clean) clean_storable: - @if test -r $(storable_dir)/Makefile; then \ - echo 'cd $(storable_dir) && $(MAKE) clean'; \ - (cd $(storable_dir) && $(MAKE) clean); \ + @if test -r $(storable_dir)/Makefile; then \ + echo 'cd $(storable_dir) && $(MAKE) clean'; \ + (cd $(storable_dir) && $(MAKE) clean); \ fi distclean: $(DISTCLEAN_TARGETS) $(RM) Makefile -distclean_compress_zlib: clean_compress_zlib +distclean_compress_zlib: clean_compress_zlib -distclean_data_dumper: clean_data_dumper +distclean_data_dumper: clean_data_dumper -distclean_date_parse: clean_date_parse +distclean_date_parse: clean_date_parse -distclean_digest_md5: clean_digest_md5 +distclean_digest_md5: clean_digest_md5 -distclean_math_intervalsearch: clean_math_intervalsearch +distclean_math_intervalsearch: clean_math_intervalsearch -distclean_rrdtool: clean_rrdtool +distclean_rrdtool: clean_rrdtool cd $(rrdtool_dir) && $(MAKE) distclean -distclean_storable: clean_storable +distclean_storable: clean_storable Makefile: Makefile.in cd .. && CONFIG_FILES=packages/Makefile ./config.status From blair at orcaware.com Sat Jan 4 19:42:09 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Sat, 4 Jan 2003 19:42:09 -0800 Subject: [Orca-checkins] rev 186 - in trunk/orca: . orca docs contrib data_gatherers data_gatherers/orcallator data_gatherers/orca_services Message-ID: <200301050342.h053g9n3012040@orcaware.com> Author: blair Date: 2003-01-04 19:38:08 -0800 (Sat, 04 Jan 2003) New Revision: 186 Added: trunk/orca/data_gatherers/ trunk/orca/data_gatherers/Makefile.in trunk/orca/data_gatherers/orca_services/ trunk/orca/data_gatherers/orcallator/ trunk/orca/data_gatherers/procallator/ trunk/orca/orca/ Removed: trunk/orca/contrib/orca_services/ trunk/orca/contrib/procallator/ trunk/orca/orcallator/ trunk/orca/src/ Modified: trunk/orca/Makefile.in trunk/orca/configure.in trunk/orca/contrib/Makefile.in trunk/orca/data_gatherers/orca_services/Makefile.in trunk/orca/data_gatherers/orcallator/Makefile.in trunk/orca/docs/Makefile.in trunk/orca/orca/Makefile.in Log: Restructure the directories to put all the data gathering tools on equal footing. Data gathering tools go into a new directory named data_gatherers. * data_gatherers: New directory. * data_gatherers/Makefile.in: Copied from contrib/Makefile.in and modified to descend into orcallator and orca_services. Procallator support will be added later. * data_gatherers/orcallator: Renamed from orcallator. * data_gatherers/orcallator/Makefile.in: s|orcallator/|data_gatherers/orcallator/|g. s|cd ..|cd ../..|g to find config.status now that orcallator moved down a level. * data_gatherers/orca_services: Renamed from contrib/orca_services. * data_gatherers/orca_services/Makefile.in: Fix a bug where some of the CONFIG_FILES environmental variables contained `contrib/contrib/', which doesn't exist. s|contrib/|data_gatherers/|g. * data_gatherers/procallator: Renamed from contrib/procallator. * orca: Renamed from src. * orca/Makefie.in: s|src/|orca/|g. * contrib/Makefile.in: (SUBDIRS): Remove orca_services. (Makefile): Cd only up one directory to find config.status, not two. * docs/Makefile.in: s|src/orca.pl|orca/orca.pl|g. * Makefile.in: (SUBDIRS): Descend into orca instead of src and into data_gatherers. No longer descend conditionally into orcallator. (orcallator_run_at_boot): s|orcallator/|data_gatherers/orcallator|. * configure.in: Sort the config.status generated files alphabetically. s|src/orca.pl.in|orca/orca.pl.in|g. s|orcallator|data_gatherers/orcallator|g. Modified: trunk/orca/Makefile.in ============================================================================== --- trunk/orca/Makefile.in (original) +++ trunk/orca/Makefile.in 2003-01-04 19:42:09.000000000 -0800 @@ -10,8 +10,8 @@ SUBDIRS = packages \ lib \ - src \ - @ORCALLATOR_SUBDIR@ \ + orca \ + data_gatherers \ docs \ contrib @@ -55,7 +55,7 @@ cd contrib && $(MAKE) install_contrib orcallator_run_at_boot: - cd orcallator && $(MAKE) orcallator_run_at_boot + cd data_gatherers/orcallator && $(MAKE) orcallator_run_at_boot test_modules: cd packages && $(MAKE) CFLAGS="$(CFLAGS)" test_modules Copied: orca (from rev 185, trunk/orca/src) Modified: trunk/orca/orca/Makefile.in ============================================================================== --- trunk/orca/src/Makefile.in (original) +++ trunk/orca/orca/Makefile.in 2003-01-04 19:42:09.000000000 -0800 @@ -43,7 +43,7 @@ chmod 0755 $@ Makefile: Makefile.in - cd .. && CONFIG_FILES=src/Makefile ./config.status + cd .. && CONFIG_FILES=orca/Makefile ./config.status orca.pl: orca.pl.in - cd .. && CONFIG_FILES=src/orca.pl ./config.status + cd .. && CONFIG_FILES=orca/orca.pl ./config.status Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-04 19:42:09.000000000 -0800 @@ -1,7 +1,7 @@ # This file is an input file used by the GNU "autoconf" program to # generate the file "configure", which is run during Orca installation # to configure the system for the local environment. -AC_INIT(src/orca.pl.in) +AC_INIT(orca/orca.pl.in) AC_CONFIG_AUX_DIR(config) AC_CANONICAL_SYSTEM @@ -274,7 +274,7 @@ # Always build the orcallator files regardless of the operating system. BUILD_ORCALLATOR=yes -ORCALLATOR_SUBDIR=orcallator +ORCALLATOR_SUBDIR=data_gatherers/orcallator INSTALL_LIB_RRDTOOL= AC_SUBST(ORCALLATOR_SUBDIR) AC_SUBST(INSTALL_LIB_RRDTOOL) @@ -444,35 +444,37 @@ # variable substitutions. #-------------------------------------------------------------------- if test "$BUILD_ORCALLATOR" = yes; then - ORCALLATOR_OUTPUT="orcallator/orcallator.cfg - orcallator/orcallator_running.pl - orcallator/restart_orcallator.sh - orcallator/start_orcallator.sh - orcallator/stop_orcallator.sh - orcallator/S99orcallator.sh - orcallator/Makefile" + ORCALLATOR_OUTPUT="data_gatherers/orcallator/Makefile + data_gatherers/orcallator/orcallator.cfg + data_gatherers/orcallator/orcallator_running.pl + data_gatherers/orcallator/restart_orcallator.sh + data_gatherers/orcallator/start_orcallator.sh + data_gatherers/orcallator/stop_orcallator.sh + data_gatherers/orcallator/S99orcallator.sh" fi AC_OUTPUT(Makefile config/PerlHead1 config/PerlHead2 - lib/Makefile - packages/Makefile - src/Makefile - src/orca.pl - $ORCALLATOR_OUTPUT - docs/Makefile contrib/Makefile contrib/rotate_orca_graphs/Makefile contrib/rotate_orca_graphs/rotate_orca_graphs.sh - contrib/orca_services/Makefile - contrib/orca_services/orca_services.cfg - contrib/orca_services/orca_services.pl - contrib/orca_services/orca_services_running.pl - contrib/orca_services/restart_orca_services.sh - contrib/orca_services/start_orca_services.sh - contrib/orca_services/stop_orca_services.sh - contrib/orca_services/S99orca_services.sh) + data_gatherers/Makefile + $ORCALLATOR_OUTPUT + data_gatherers/orca_services/Makefile + data_gatherers/orca_services/orca_services.cfg + data_gatherers/orca_services/orca_services.pl + data_gatherers/orca_services/orca_services_running.pl + data_gatherers/orca_services/restart_orca_services.sh + data_gatherers/orca_services/start_orca_services.sh + data_gatherers/orca_services/stop_orca_services.sh + data_gatherers/orca_services/S99orca_services.sh + docs/Makefile + lib/Makefile + packages/Makefile + orca/Makefile + orca/orca.pl + ) echo echo "----------------------------------------------------------------" Modified: trunk/orca/docs/Makefile.in ============================================================================== --- trunk/orca/docs/Makefile.in (original) +++ trunk/orca/docs/Makefile.in 2003-01-04 19:42:09.000000000 -0800 @@ -4,7 +4,7 @@ mandir = @mandir@/man1 INSTALL = @INSTALL@ MKDIR = @MKDIR@ -ORCA = ../src/orca.pl +ORCA = ../orca/orca.pl POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ POD2TEXT = @POD2TEXT@ Modified: trunk/orca/contrib/Makefile.in ============================================================================== --- trunk/orca/contrib/Makefile.in (original) +++ trunk/orca/contrib/Makefile.in 2003-01-04 19:42:09.000000000 -0800 @@ -1,7 +1,6 @@ @SET_MAKE@ -SUBDIRS = orca_services \ - rotate_orca_graphs +SUBDIRS = rotate_orca_graphs all: Makefile $(TARGETS) @for dir in $(SUBDIRS); do \ @@ -32,4 +31,4 @@ $(RM) Makefile Makefile: Makefile.in - cd ../.. && CONFIG_FILES=contrib/Makefile ./config.status + cd .. && CONFIG_FILES=contrib/Makefile ./config.status Copied: procallator (from rev 185, trunk/orca/contrib/procallator) Copied: Makefile.in (from rev 185, trunk/orca/contrib/Makefile.in) ============================================================================== --- trunk/orca/contrib/Makefile.in (original) +++ trunk/orca/data_gatherers/Makefile.in 2003-01-04 19:42:09.000000000 -0800 @@ -0,0 +1,32 @@ + at SET_MAKE@ + +SUBDIRS = orcallator \ + orca_services + +all: Makefile $(TARGETS) + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS)"; \ + (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)"); \ + done + +install: + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) install"; \ + (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)" install); \ + done + +clean: + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) clean"; \ + (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)" clean); \ + done + +distclean: clean + @for dir in $(SUBDIRS); do \ + echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) distclean"; \ + (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)" distclean); \ + done + $(RM) Makefile + +Makefile: Makefile.in + cd .. && CONFIG_FILES=data_gatherers/Makefile ./config.status Copied: orcallator (from rev 185, trunk/orca/orcallator) Modified: trunk/orca/data_gatherers/orcallator/Makefile.in ============================================================================== --- trunk/orca/orcallator/Makefile.in (original) +++ trunk/orca/data_gatherers/orcallator/Makefile.in 2003-01-04 19:42:09.000000000 -0800 @@ -59,22 +59,22 @@ chmod 0755 $@ Makefile: Makefile.in - cd .. && CONFIG_FILES=orcallator/Makefile ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orcallator/Makefile ./config.status orcallator.cfg: orcallator.cfg.in - cd .. && CONFIG_FILES=orcallator/orcallator.cfg ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orcallator/orcallator.cfg ./config.status orcallator_running.pl: orcallator_running.pl.in - cd .. && CONFIG_FILES=orcallator/orcallator_running.pl ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orcallator/orcallator_running.pl ./config.status restart_orcallator.sh: restart_orcallator.sh.in - cd .. && CONFIG_FILES=orcallator/restart_orcallator.sh ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orcallator/restart_orcallator.sh ./config.status start_orcallator.sh: start_orcallator.sh.in - cd .. && CONFIG_FILES=orcallator/start_orcallator.sh ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orcallator/start_orcallator.sh ./config.status stop_orcallator.sh: stop_orcallator.sh.in - cd .. && CONFIG_FILES=orcallator/stop_orcallator.sh ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orcallator/stop_orcallator.sh ./config.status S99orcallator.sh: S99orcallator.sh.in - cd .. && CONFIG_FILES=orcallator/S99orcallator.sh ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orcallator/S99orcallator.sh ./config.status Copied: orca_services (from rev 185, trunk/orca/contrib/orca_services) Modified: trunk/orca/data_gatherers/orca_services/Makefile.in ============================================================================== --- trunk/orca/contrib/orca_services/Makefile.in (original) +++ trunk/orca/data_gatherers/orca_services/Makefile.in 2003-01-04 19:42:09.000000000 -0800 @@ -60,29 +60,29 @@ chmod 0755 $@ Makefile: Makefile.in - cd ../.. && CONFIG_FILES=contrib/orca_services/Makefile ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orca_services/Makefile ./config.status $(MAKE) orca_services.cfg: orca_services.cfg.in - cd ../.. && CONFIG_FILES=contrib/orca_services/orca_services.cfg ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services.cfg ./config.status orca_services.pl: orca_services.pl.in $(PERL_HEAD) - cd ../.. && CONFIG_FILES=contrib/orca_services/orca_services.pl ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services.pl ./config.status cat $(PERL_HEAD) orca_services.pl > orca_services.perl mv orca_services.perl orca_services.pl chmod 0755 orca_services.pl orca_services_running.pl: orca_services_running.pl.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/orca_services_running.pl ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services_running.pl ./config.status restart_orca_services.sh: restart_orca_services.sh.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/restart_orca_services.sh ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orca_services/restart_orca_services.sh ./config.status start_orca_services.sh: start_orca_services.sh.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/start_orca_services.sh ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orca_services/start_orca_services.sh ./config.status stop_orca_services.sh: stop_orca_services.sh.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/stop_orca_services.sh ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orca_services/stop_orca_services.sh ./config.status S99orca_services.sh: S99orca_services.sh.in - cd ../.. && CONFIG_FILES=contrib/contrib/orca_services/S99orca_services.sh ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/orca_services/S99orca_services.sh ./config.status From blair at orcaware.com Sat Jan 4 23:53:41 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Sat, 4 Jan 2003 23:53:41 -0800 Subject: [Orca-checkins] rev 187 - trunk/orca Message-ID: <200301050753.h057rf52030146@orcaware.com> Author: blair Date: 2003-01-04 23:53:31 -0800 (Sat, 04 Jan 2003) New Revision: 187 Modified: trunk/orca/configure.in Log: * configure.in: Determine where the boot init.d directory on the system. Currently /etc/rc.d/init.d and /etc/init.d are checked. This value is saved in INIT_D_DIR and substituted via config.status. Determine the directory that contains the boot rcX.d directories on the system. Currently /etc/rc.d and /etc are checked if they contain rc3.d. This value is saved in RCX_D_CONTAINING_DIR and substituted via config.status. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-04 23:53:40.000000000 -0800 @@ -439,6 +439,36 @@ AC_SUBST(INSTALL) AC_SUBST(MKDIR) +# Determine the appropriate init.d directory on the system. +AC_MSG_CHECKING([where the boot init.d directory is]) +for dir in /etc/rc.d/init.d /etc/init.d; do + if test -d "$dir"; then + INIT_D_DIR="$dir" + break + fi +done +if test "$INIT_D_DIR"; then + AC_MSG_RESULT([$INIT_D_DIR]) +else + AC_MSG_RESULT([none found]) +fi +AC_SUBST(INIT_D_DIR) + +# Determine the directory that contains the rcX.d directories. +AC_MSG_CHECKING([which directory contains the boot rcX.d directories]) +for dir in /etc/rc.d/rc3.d /etc/rc3.d; do + if test -d "$dir"; then + RCX_D_CONTAINING_DIR="`dirname $dir`" + break + fi +done +if test "$RCX_D_CONTAINING_DIR"; then + AC_MSG_RESULT([$RCX_D_CONTAINING_DIR]) +else + AC_MSG_RESULT([none found]) +fi +AC_SUBST(RCX_D_CONTAINING_DIR) + #-------------------------------------------------------------------- # Generate the Makefiles and shell scripts with the # variable substitutions. From blair at orcaware.com Mon Jan 6 11:50:36 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Mon, 6 Jan 2003 11:50:36 -0800 Subject: [Orca-checkins] rev 188 - in trunk/orca: . packages packages/Digest-MD5-2.22 packages/Digest-MD5-2.22/t Message-ID: <200301061950.h06Joaer015246@orcaware.com> Author: blair Date: 2003-01-06 11:50:23 -0800 (Mon, 06 Jan 2003) New Revision: 188 Added: trunk/orca/packages/Digest-MD5-2.22/ trunk/orca/packages/Digest-MD5-2.22/t/clone.t Removed: trunk/orca/packages/Digest-MD5-2.21/ Modified: trunk/orca/INSTALL trunk/orca/configure.in trunk/orca/packages/Digest-MD5-2.22/Changes trunk/orca/packages/Digest-MD5-2.22/MANIFEST trunk/orca/packages/Digest-MD5-2.22/MD5.pm trunk/orca/packages/Digest-MD5-2.22/MD5.xs trunk/orca/packages/Digest-MD5-2.22/README trunk/orca/packages/Digest-MD5-2.22/t/files.t Log: Upgrade Digest::MD5 from 2.21 to 2.22 and require the new version for Orca. * INSTALL: Update all references to Digest::MD5's version number from 2.21 to 2.22. * configure.in: Bump Digest::MD5's version number to 2.22. * packages/Digest-MD5-2.22: Renamed from packages/Digest-MD5-2.21. Directory contents updated from Digest-MD5-2.22.tar.gz. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-06 11:50:35.000000000 -0800 @@ -31,8 +31,8 @@ DATA_DUMPER_VER=2.101 DATE_PARSE_DIR=TimeDate-1.14 DATE_PARSE_VER=2.24 -DIGEST_MD5_DIR=Digest-MD5-2.21 -DIGEST_MD5_VER=2.21 +DIGEST_MD5_DIR=Digest-MD5-2.22 +DIGEST_MD5_VER=2.22 MATH_INTERVALSEARCH_DIR=Math-Interpolate-1.05 MATH_INTERVALSEARCH_VER=1.05 RRDTOOL_DIR=rrdtool-1.0.40 Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-01-06 11:50:35.000000000 -0800 @@ -160,7 +160,7 @@ Name Required Version Included With Orca ---------------------------------------------------------------------- Data::Dumper 2.101 or greater 2.101 - Digest::MD5 2.21 or greater 2.21 + Digest::MD5 2.22 or greater 2.22 Math::IntervalSearch 1.05 or greater 1.05 RRDs 1.0.33 or greater 1.0.33 Storable 2.06 or greater 2.06 @@ -191,10 +191,10 @@ Digest::MD5 - http://www.perl.com/CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.21.tar.gz + http://www.perl.com/CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.22.tar.gz - % gunzip -c Digest-MD5-2.21.tar.gz | tar xvf - - % cd Digest-MD5-2.21 + % gunzip -c Digest-MD5-2.22.tar.gz | tar xvf - + % cd Digest-MD5-2.22 % perl Makefile.PL % make % make test Copied: Digest-MD5-2.22 (from rev 187, trunk/orca/packages/Digest-MD5-2.21) Modified: trunk/orca/packages/Digest-MD5-2.22/MD5.pm ============================================================================== --- trunk/orca/packages/Digest-MD5-2.21/MD5.pm (original) +++ trunk/orca/packages/Digest-MD5-2.22/MD5.pm 2003-01-06 11:50:35.000000000 -0800 @@ -3,7 +3,7 @@ use strict; use vars qw($VERSION @ISA @EXPORT_OK); -$VERSION = '2.21'; # $Date: 2002/12/28 05:30:03 $ +$VERSION = '2.22'; # $Date: 2003/01/05 00:56:14 $ require Exporter; *import = \&Exporter::import; @@ -117,6 +117,14 @@ state the object to the state of a newly created object. No new object is created in this case. +=item $md5->clone + +This is a copy constructor returning a clone of the $md5 object. It is +useful when you do not want to destroy the digests state, but need an +intermediate value of the digest, e.g. when calculating digests +iteratively on a continuous data stream in order to obtain a copy which +may be destroyed. + =item $md5->reset This is just an alias for $md5->new. @@ -142,7 +150,8 @@ Note that the C operation is effectively a destructive, read-once operation. Once it has been performed, the C object is automatically C and can be used to calculate another -digest value. +digest value. Call $md5->clone->digest if you want to calculate the +digest without reseting the digest state. =item $md5->hexdigest @@ -253,7 +262,7 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - Copyright 1998-2002 Gisle Aas. + Copyright 1998-2003 Gisle Aas. Copyright 1995-1996 Neil Winton. Copyright 1991-1992 RSA Data Security, Inc. Added: trunk/orca/packages/Digest-MD5-2.22/t/clone.t ============================================================================== --- trunk/orca/packages/Digest-MD5-2.21/t/clone.t (original) +++ trunk/orca/packages/Digest-MD5-2.22/t/clone.t 2003-01-06 11:50:35.000000000 -0800 @@ -0,0 +1,41 @@ +#!perl -w + +print "1..6\n"; + +use strict; +use Digest::MD5 qw(md5_hex); + +my $a = Digest::MD5->new; +$a->add("a"); +my $b = $a->clone; + +print "not " unless $b->clone->hexdigest eq md5_hex("a"); +print "ok 1\n"; + +$a->add("a"); +print "not " unless $a->hexdigest eq md5_hex("aa"); +print "ok 2\n"; + +print "not " unless $a->hexdigest eq md5_hex(""); +print "ok 3\n"; + +$b->add("b"); +print "not " unless $b->clone->hexdigest eq md5_hex("ab"); +print "ok 4\n"; + +$b->add("c"); +print "not " unless $b->clone->hexdigest eq md5_hex("abc"); +print "ok 5\n"; + +# Test that cloning picks up the correct class for subclasses. +{ + package MD5; + @MD5::ISA = qw(Digest::MD5); +} + +$a = MD5->new; +$a->add("a"); +$b = $a->clone; + +print "not " unless ref($b) eq "MD5" && $b->add("b")->hexdigest eq md5_hex("ab"); +print "ok 6\n"; Modified: trunk/orca/packages/Digest-MD5-2.22/t/files.t ============================================================================== --- trunk/orca/packages/Digest-MD5-2.21/t/files.t (original) +++ trunk/orca/packages/Digest-MD5-2.22/t/files.t 2003-01-06 11:50:35.000000000 -0800 @@ -20,27 +20,27 @@ my $EXPECT; if (ord "A" == 193) { # EBCDIC $EXPECT = < + + Release 2.22. + + Added clone method. + Contributed by Holger Smolinski + + + 2002-12-27 Gisle Aas Release 2.21 Modified: trunk/orca/packages/Digest-MD5-2.22/README ============================================================================== --- trunk/orca/packages/Digest-MD5-2.21/README (original) +++ trunk/orca/packages/Digest-MD5-2.22/README 2003-01-06 11:50:35.000000000 -0800 @@ -6,7 +6,7 @@ You will need perl version 5.004 or better to install this module. -Copyright 1998-2002 Gisle Aas. +Copyright 1998-2003 Gisle Aas. Copyright 1995-1996 Neil Winton. Copyright 1990-1992 RSA Data Security, Inc. Modified: trunk/orca/packages/Digest-MD5-2.22/MD5.xs ============================================================================== --- trunk/orca/packages/Digest-MD5-2.21/MD5.xs (original) +++ trunk/orca/packages/Digest-MD5-2.22/MD5.xs 2003-01-06 11:50:35.000000000 -0800 @@ -1,4 +1,4 @@ -/* $Id: MD5.xs,v 1.34 2002/05/01 23:30:28 gisle Exp $ */ +/* $Id: MD5.xs,v 1.35 2003/01/05 00:54:17 gisle Exp $ */ /* * This library is free software; you can redistribute it and/or @@ -562,6 +562,22 @@ XSRETURN(1); void +clone(self) + SV* self + PREINIT: + MD5_CTX* cont = get_md5_ctx(self); + char *myname = sv_reftype(SvRV(self),TRUE); + MD5_CTX* context; + PPCODE: + STRLEN my_na; + New(55, context, 1, MD5_CTX); + ST(0) = sv_newmortal(); + sv_setref_pv(ST(0), myname , (void*)context); + SvREADONLY_on(SvRV(ST(0))); + memcpy(context,cont,sizeof(MD5_CTX)); + XSRETURN(1); + +void DESTROY(context) MD5_CTX* context CODE: From blair at orcaware.com Mon Jan 6 18:02:56 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Mon, 6 Jan 2003 18:02:56 -0800 Subject: [Orca-checkins] rev 189 - in trunk/orca: . orca contrib lib data_gatherers data_gatherers/orcallator data_gatherers/orca_services Message-ID: <200301070202.h0722uVI022240@orcaware.com> Author: blair Date: 2003-01-06 18:02:43 -0800 (Mon, 06 Jan 2003) New Revision: 189 Modified: trunk/orca/Makefile.in trunk/orca/contrib/Makefile.in trunk/orca/data_gatherers/Makefile.in trunk/orca/data_gatherers/orca_services/Makefile.in trunk/orca/data_gatherers/orca_services/README trunk/orca/data_gatherers/orca_services/start_orca_services.sh.in trunk/orca/data_gatherers/orca_services/stop_orca_services.sh.in trunk/orca/data_gatherers/orcallator/Makefile.in trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in trunk/orca/lib/Makefile.in trunk/orca/orca/Makefile.in Log: When installing Orca, be more consistent where things are installed. For reference, here are the default values of the variables used in configure and the Makefile.in's: Variable name Default setting ------------------------------------------------------- $prefix /usr/local $exec_prefix $prefix $bindir $exec_prefix/bin $libdir $exec_prefix/lib $libexecdir $exec_prefix/libexec $sysconfdir $prefix/etc Here are the old and new locations of files: Old location New location ------------------------------------------------------- $bindir/orca_services.pl $libexecdir/orca_services $bindir/S99orcallator no longer installed $bindir/S99orca_services no longer installed $bindir/upgrade_installation no longer installed $libdir/orcallator.cfg $sysconfdir/orcallator.cfg $libdir/orca_services.cfg $sysconfdir/orca_services.cfg $libdir/orca_services.pl no longer installed, as it's in $bindir already Also, distinguish between where VAR_DIR and RRD_DIR is used. VAR_DIR is the base directory for the raw orcallator and orca_services output files and RRD_DIR is the base directory where the RRD files are kept. * Makefile.in (orca_services_run_at_boot): New rule to descend into data_gatherers/orca_services and install orca_services to run at boot time. (install): No longer mkdir any directories, let the subdirectories do that. This allows `make install' in subdirectories to properly mkdir all the directories so that the install goes smoothly. * orca/Makefile.in, * data_gatherers/orca_services/Makefile.in, * data_gatherers/orcallator/Makefile.in: Permit more general handling of where to install Perl and shell scripts. This has the feel of automake's variables. (BIN_PERL_SCRIPTS, LIBEXEC_PERL_SCRIPTS, NOINST_PERL_SCRIPTS): New variables that specify where the Perl scripts are installed. $(PERL_SCRIPTS) is now the concatenation of these three variables. (BIN_SHELL_SCRIPTS, LIBEXEC_SHELL_SCRIPTS, NOINST_SHELL_SCRIPTS): New variables that specify where the shell scripts are installed. $(SHELL_SCRIPTS) is now the concatenation of these three variables. (BIN_TARGETS): New variable, concatenation of $(BIN_PERL_SCRIPTS) and $(BIN_SHELL_SCRIPTS). (LIBEXEC_TARGETS): New variable, concatenation of $(LIBEXEC_PERL_SCRIPTS) and $(LIBEXEC_SHELL_SCRIPTS). (install): Install $(BIN_TARGETS) into $bindir and $(LIBEXEC_TARGETS) to $libexecdir. * orca/Makefile.in: (RAW_ORCALLATOR_DIR): Renamed from ORCALLATOR_DIR. * data_gatherers/Makefile.in Spacing changes to be consistent with our Makefile.in's. (orcallator_run_at_boot): New rule to descend into orcallator and install orcallator to run at boot time. (orca_services_run_at_boot): New rule to descend into orca_services and install orca_services to run at boot time. * data_gatherers/orca_services/Makefile.in, * data_gatherers/orcallator/Makefile.in, (install): Build and install all the files and directories as listed in the table above. (orca_services_run_at_boot): Use $(INIT_D_DIR) and $(RCX_D_CONTAINING_DIR) instead of hardwired /etc/init.d and /etc/rcX.d to install the boot files. Ensure that $(INIT_D_DIR) and $(RCX_D_CONTAINING_DIR) are set before installing the boot scripts. Fix a typo that would always cause the test for $(RCX_D_CONTAINING_DIR) to pass. * data_gatherers/orca_services/Makefile.in (orca_services.pl): Create using just config.status. Let the rest of the steps that used to create orca_services.pl be used by the .pl: rule. * data_gatherers/orca_services/README, * data_gatherers/orca_services/stop_orca_services.sh.in: s/orca_services.pl/orca_services/g. * data_gatherers/orca_services/start_orca_services.sh.in: Look for the host specific arguments to orca_services in $sysconfdir not $libdir. Run orca_services out of $libexecdir, not $libdir. s/orca_services.pl/orca_services/g. (RAW_ORCA_SERVICES_DIR): Renamed from ORCA_SERVICES_DIR. Write the orca_services.pid file out to be consistent with orcallator. No telling who may need it. * data_gatherers/orcallator/start_orcallator.sh.in: (RAW_ORCALLATOR_DIR): Renamed from ORCALLATOR_DIR. * contrib/Makefile.in, lib/Makefile.in: Spacing changes to be consistent with our Makefile.in's. Modified: trunk/orca/Makefile.in ============================================================================== --- trunk/orca/Makefile.in (original) +++ trunk/orca/Makefile.in 2003-01-06 18:02:55.000000000 -0800 @@ -2,10 +2,6 @@ prefix = @prefix@ MKDIR = @MKDIR@ -MAKE_RRDTOOL = @MAKE_RRDTOOL@ -RRD_DIR = @RRD_DIR@ -VAR_DIR = @VAR_DIR@ -ORCALLATOR_DIR = $(VAR_DIR)/orcallator CFLAGS = @CFLAGS@ SUBDIRS = packages \ @@ -34,10 +30,7 @@ upgrade: cd src && $(MAKE) upgrade_installation -install: $(INSTALL_RRDTOOL) - $(MKDIR) $(VAR_DIR) - $(MKDIR) $(ORCALLATOR_DIR) - $(MKDIR) $(RRD_DIR)/orcallator +install: @for dir in $(SUBDIRS); do \ if test -d $$dir; then \ echo "cd $$dir"; \ @@ -57,19 +50,22 @@ orcallator_run_at_boot: cd data_gatherers/orcallator && $(MAKE) orcallator_run_at_boot +orca_services_run_at_boot: + cd data_gatherers/orca_services && $(MAKE) orca_services_run_at_boot + test_modules: cd packages && $(MAKE) CFLAGS="$(CFLAGS)" test_modules install_modules: cd packages && $(MAKE) CFLAGS="$(CFLAGS)" install_modules -clean: $(CLEAN_RRDTOOL) +clean: @for dir in $(SUBDIRS); do \ echo "cd $$dir && $(MAKE) clean"; \ (cd $$dir && $(MAKE) clean); \ done -distclean: $(DISTCLEAN_RRDTOOL) +distclean: @for dir in $(SUBDIRS); do \ echo "cd $$dir && $(MAKE) distclean"; \ (cd $$dir && $(MAKE) distclean); \ Modified: trunk/orca/orca/Makefile.in ============================================================================== --- trunk/orca/orca/Makefile.in (original) +++ trunk/orca/orca/Makefile.in 2003-01-06 18:02:55.000000000 -0800 @@ -1,30 +1,53 @@ @SET_MAKE@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -INSTALL = @INSTALL@ -MKDIR = @MKDIR@ -PERL_HEAD = @PERL_HEAD@ -RRD_DIR = @RRD_DIR@ -VAR_DIR = @VAR_DIR@ -ORCALLATOR_DIR = $(VAR_DIR)/orcallator -PERL_SCRIPTS = orca \ - upgrade_installation -SHELL_SCRIPTS = -TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ +PERL_HEAD = @PERL_HEAD@ +RRD_DIR = @RRD_DIR@ +VAR_DIR = @VAR_DIR@ +RAW_ORCALLATOR_DIR = $(VAR_DIR)/orcallator + +BIN_PERL_SCRIPTS = orca +LIBEXEC_PERL_SCRIPTS = +NOINST_PERL_SCRIPTS = upgrade_installation +PERL_SCRIPTS = $(BIN_PERL_SCRIPTS) \ + $(LIBEXEC_PERL_SCRIPTS) \ + $(NOINST_PERL_SCRIPTS) + +BIN_SHELL_SCRIPTS = +LIBEXEC_SHELL_SCRIPTS = +NOINST_SHELL_SCRIPTS = +SHELL_SCRIPTS = $(BIN_SHELL_SCRIPTS) \ + $(LIBEXEC_SHELL_SCRIPTS) \ + $(NOINST_SHELL_SCRIPTS) + +TARGETS = $(PERL_SCRIPTS) \ + $(SHELL_SCRIPTS) +BIN_TARGETS = $(BIN_PERL_SCRIPTS) \ + $(BIN_SHELL_SCRIPTS) +LIBEXEC_TARGETS = $(LIBEXEC_PERL_SCRIPTS) \ + $(LIBEXEC_SHELL_SCRIPTS) all: Makefile $(TARGETS) install: all $(MKDIR) $(bindir) - @for file in $(TARGETS); do \ + @for file in $(BIN_TARGETS); do \ echo $(INSTALL) $$file $(bindir); \ $(INSTALL) $$file $(bindir); \ done upgrade: upgrade_installation - ./upgrade_installation $(prefix) $(exec_prefix) $(bindir) $(libdir) $(ORCALLATOR_DIR) $(RRD_DIR) + ./upgrade_installation \ + $(prefix) \ + $(exec_prefix) \ + $(bindir) \ + $(libdir) \ + $(RAW_ORCALLATOR_DIR) \ + $(RRD_DIR) clean: $(RM) $(TARGETS) Modified: trunk/orca/contrib/Makefile.in ============================================================================== --- trunk/orca/contrib/Makefile.in (original) +++ trunk/orca/contrib/Makefile.in 2003-01-06 18:02:55.000000000 -0800 @@ -1,6 +1,6 @@ @SET_MAKE@ -SUBDIRS = rotate_orca_graphs +SUBDIRS = rotate_orca_graphs all: Makefile $(TARGETS) @for dir in $(SUBDIRS); do \ Modified: trunk/orca/lib/Makefile.in ============================================================================== --- trunk/orca/lib/Makefile.in (original) +++ trunk/orca/lib/Makefile.in 2003-01-06 18:02:55.000000000 -0800 @@ -1,10 +1,10 @@ @SET_MAKE@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -libdir = @libdir@ -INSTALL = @INSTALL@ -MKDIR = @MKDIR@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ all: Makefile \ orca_logo.gif.hex \ Modified: trunk/orca/data_gatherers/orcallator/Makefile.in ============================================================================== --- trunk/orca/data_gatherers/orcallator/Makefile.in (original) +++ trunk/orca/data_gatherers/orcallator/Makefile.in 2003-01-06 18:02:55.000000000 -0800 @@ -1,46 +1,74 @@ @SET_MAKE@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -INSTALL = @INSTALL@ -MKDIR = @MKDIR@ -PERL_HEAD = @PERL_HEAD@ -VAR_DIR = @VAR_DIR@ -RRD_DIR = @RRD_DIR@ -RRDTOOL_DIR = @RRDTOOL_DIR@ -ORCALLATOR_DIR = $(VAR_DIR)/orcallator -PERL_SCRIPTS = orcallator_column \ - orcallator_running -SHELL_SCRIPTS = restart_orcallator \ - stop_orcallator \ - start_orcallator \ - S99orcallator -TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +sysconfdir = @sysconfdir@ +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ +PERL_HEAD = @PERL_HEAD@ +VAR_DIR = @VAR_DIR@ +RRD_DIR = @RRD_DIR@ +INIT_D_DIR = @INIT_D_DIR@ +RCX_D_CONTAINING_DIR = @RCX_D_CONTAINING_DIR@ +RAW_ORCALLATOR_DIR = $(VAR_DIR)/orcallator +RRD_ORCALLATOR_DIR = $(RRD_DIR)/orcallator + +BIN_PERL_SCRIPTS = orcallator_column \ + orcallator_running +LIBEXEC_PERL_SCRIPTS = +NOINST_PERL_SCRIPTS = +PERL_SCRIPTS = $(BIN_PERL_SCRIPTS) \ + $(LIBEXEC_PERL_SCRIPTS) \ + $(NOINST_PERL_SCRIPTS) + +BIN_SHELL_SCRIPTS = restart_orcallator \ + stop_orcallator \ + start_orcallator +LIBEXEC_SHELL_SCRIPTS = +NOINST_SHELL_SCRIPTS = S99orcallator +SHELL_SCRIPTS = $(BIN_SHELL_SCRIPTS) \ + $(LIBEXEC_SHELL_SCRIPTS) \ + $(NOINST_SHELL_SCRIPTS) + +TARGETS = $(PERL_SCRIPTS) \ + $(SHELL_SCRIPTS) +BIN_TARGETS = $(BIN_PERL_SCRIPTS) \ + $(BIN_SHELL_SCRIPTS) +LIBEXEC_TARGETS = $(LIBEXEC_PERL_SCRIPTS) \ + $(LIBEXEC_SHELL_SCRIPTS) all: Makefile $(TARGETS) orcallator.cfg install: all $(MKDIR) $(bindir) $(MKDIR) $(libdir) - @for file in $(TARGETS); do \ + $(MKDIR) $(sysconfdir) + $(MKDIR) $(RAW_ORCALLATOR_DIR) + $(MKDIR) $(RRD_ORCALLATOR_DIR) + @for file in $(BIN_TARGETS); do \ echo $(INSTALL) $$file $(bindir); \ $(INSTALL) $$file $(bindir); \ done - if test -r $(libdir)/orcallator.cfg; then \ - cp -p $(libdir)/orcallator.cfg $(libdir)/orcallator.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ - fi - $(INSTALL) -m 0644 orcallator.cfg $(libdir) $(INSTALL) -m 0644 orcallator.se $(libdir) + if test -r $(sysconfdir)/orcallator.cfg; then \ + cp -p $(sysconfdir)/orcallator.cfg $(sysconfdir)/orcallator.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ + fi + $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir) orcallator_run_at_boot: all - -$(RM) /etc/init.d/orcallator /etc/rc0.d/K01orcallator - -$(RM) /etc/rc1.d/K01orcallator /etc/rc3.d/S99orcallator - $(INSTALL) -m 0744 S99orcallator /etc/init.d/orcallator - ln /etc/init.d/orcallator /etc/rc0.d/K01orcallator - ln /etc/init.d/orcallator /etc/rc1.d/K01orcallator - ln /etc/init.d/orcallator /etc/rc3.d/S99orcallator + test "$(INIT_D_DIR)" + test "$(RCX_D_CONTAINING_DIR)" + -$(RM) $(INIT_D_DIR)/orcallator + -$(RM) $(RCX_D_CONTAINING_DIR)/rc0.d/K01orcallator + -$(RM) $(RCX_D_CONTAINING_DIR)/rc1.d/K01orcallator + -$(RM) $(RCX_D_CONTAINING_DIR)/rc3.d/S99orcallator + $(INSTALL) -m 0744 S99orcallator $(INIT_D_DIR)/orcallator + ln $(INIT_D_DIR)/orcallator $(RCX_D_CONTAINING_DIR)/rc0.d/K01orcallator + ln $(INIT_D_DIR)/orcallator $(RCX_D_CONTAINING_DIR)/rc1.d/K01orcallator + ln $(INIT_D_DIR)/orcallator $(RCX_D_CONTAINING_DIR)/rc3.d/S99orcallator clean: $(RM) $(TARGETS) Modified: trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in ============================================================================== --- trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in (original) +++ trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in 2003-01-06 18:02:55.000000000 -0800 @@ -11,7 +11,7 @@ CUT=@CUT@ EXPR=@EXPR@ UNAME=@UNAME@ -ORCALLATOR_DIR=@VAR_DIR@/orcallator +RAW_ORCALLATOR_DIR=@VAR_DIR@/orcallator SE=@SE@ # WEB_LOG contains the location of the web server log file that @@ -69,8 +69,8 @@ exit 1 fi -# The directory these files go into is $ORCALLATOR_DIR/HOSTNAME -OUTDIR=$ORCALLATOR_DIR/$uname +# The directory these files go into is $RAW_ORCALLATOR_DIR/HOSTNAME +OUTDIR=$RAW_ORCALLATOR_DIR/$uname # Export the environmental variables. export COMPRESSOR OUTDIR WEB_LOG WEB_SERVER WEB_SERVER_SECURE @@ -109,5 +109,6 @@ pid=$! echo $pid > $OUTDIR/orcallator.pid -# Sleep for a couple of seconds to allow any orcallator warnings to appear. +# Sleep for a couple of seconds to allow any orcallator startup +# warnings to appear on the terminal before exiting. sleep 5 Modified: trunk/orca/data_gatherers/Makefile.in ============================================================================== --- trunk/orca/data_gatherers/Makefile.in (original) +++ trunk/orca/data_gatherers/Makefile.in 2003-01-06 18:02:56.000000000 -0800 @@ -1,7 +1,7 @@ @SET_MAKE@ -SUBDIRS = orcallator \ - orca_services +SUBDIRS = orcallator \ + orca_services all: Makefile $(TARGETS) @for dir in $(SUBDIRS); do \ @@ -9,6 +9,12 @@ (cd $$dir && $(MAKE) CFLAGS="$(CFLAGS)"); \ done +orcallator_run_at_boot: + cd orcallator && $(MAKE) orcallator_run_at_boot + +orca_services_run_at_boot: + cd orca_services && $(MAKE) orca_services_run_at_boot + install: @for dir in $(SUBDIRS); do \ echo "cd $$dir && $(MAKE) CFLAGS=$(CFLAGS) install"; \ Modified: trunk/orca/data_gatherers/orca_services/Makefile.in ============================================================================== --- trunk/orca/data_gatherers/orca_services/Makefile.in (original) +++ trunk/orca/data_gatherers/orca_services/Makefile.in 2003-01-06 18:02:56.000000000 -0800 @@ -1,47 +1,76 @@ @SET_MAKE@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -INSTALL = @INSTALL@ -MKDIR = @MKDIR@ -PERL_HEAD = @PERL_HEAD@ -VAR_DIR = @VAR_DIR@ -RRD_DIR = @RRD_DIR@ -RRDTOOL_DIR = @RRDTOOL_DIR@ -ORCA_SERVICES_DIR = $(VAR_DIR)/orca_services -PERL_SCRIPTS = orca_services_running \ - orca_services.pl -SHELL_SCRIPTS = restart_orca_services \ - stop_orca_services \ - start_orca_services \ - S99orca_services -TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +sysconfdir = @sysconfdir@ +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ +PERL_HEAD = @PERL_HEAD@ +VAR_DIR = @VAR_DIR@ +RRD_DIR = @RRD_DIR@ +INIT_D_DIR = @INIT_D_DIR@ +RCX_D_CONTAINING_DIR = @RCX_D_CONTAINING_DIR@ +RAW_ORCA_SERVICES_DIR = $(VAR_DIR)/orca_services +RRD_ORCA_SERVICES_DIR = $(RRD_DIR)/orca_services + +BIN_PERL_SCRIPTS = orca_services_running +LIBEXEC_PERL_SCRIPTS = orca_services +NOINST_PERL_SCRIPTS = +PERL_SCRIPTS = $(BIN_PERL_SCRIPTS) \ + $(LIBEXEC_PERL_SCRIPTS) \ + $(NOINST_PERL_SCRIPTS) + +BIN_SHELL_SCRIPTS = restart_orca_services \ + stop_orca_services \ + start_orca_services +LIBEXEC_SHELL_SCRIPTS = orca_services +NOINST_SHELL_SCRIPTS = S99orca_services +SHELL_SCRIPTS = $(BIN_SHELL_SCRIPTS) \ + $(LIBEXEC_SHELL_SCRIPTS) \ + $(NOINST_SHELL_SCRIPTS) + +TARGETS = $(PERL_SCRIPTS) \ + $(SHELL_SCRIPTS) +BIN_TARGETS = $(BIN_PERL_SCRIPTS) \ + $(BIN_SHELL_SCRIPTS) +LIBEXEC_TARGETS = $(LIBEXEC_PERL_SCRIPTS) \ + $(LIBEXEC_SHELL_SCRIPTS) all: Makefile $(TARGETS) orca_services.cfg install: all $(MKDIR) $(bindir) - $(MKDIR) $(libdir) - $(MKDIR) $(RRD_DIR)/orca_services - @for file in $(TARGETS); do \ + $(MKDIR) $(libexecdir) + $(MKDIR) $(sysconfdir) + $(MKDIR) $(RAW_ORCA_SERVICES_DIR) + $(MKDIR) $(RRD_ORCA_SERVICES_DIR) + @for file in $(BIN_TARGETS); do \ echo $(INSTALL) $$file $(bindir); \ $(INSTALL) $$file $(bindir); \ done - if test -r $(libdir)/orca_services.cfg; then \ - cp -p $(libdir)/orca_services.cfg $(libdir)/orca_services.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ + @for file in $(LIBEXEC_TARGETS); do \ + echo $(INSTALL) $$file $(libexecdir); \ + $(INSTALL) $$file $(libexecdir); \ + done + if test -r $(sysconfdir)/orca_services.cfg; then \ + cp -p $(sysconfdir)/orca_services.cfg $(sysconfdir)/orca_services.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ fi - $(INSTALL) -m 0644 orca_services.cfg $(libdir) - $(INSTALL) -m 0755 orca_services.pl $(libdir) + $(INSTALL) -m 0644 orca_services.cfg $(sysconfdir) orca_services_run_at_boot: all - -$(RM) /etc/init.d/orca_services /etc/rc0.d/K01orca_services - -$(RM) /etc/rc1.d/K01orca_services /etc/rc3.d/S99orca_services - $(INSTALL) -m 0744 S99orca_services /etc/init.d/orca_services - ln /etc/init.d/orca_services /etc/rc0.d/K01orca_services - ln /etc/init.d/orca_services /etc/rc1.d/K01orca_services - ln /etc/init.d/orca_services /etc/rc3.d/S99orca_services + test "$(INIT_D_DIR)" + test "$(RCX_D_CONTAINING_DIR)" + -$(RM) $(INIT_D_DIR)/orca_services + -$(RM) $(RCX_D_CONTAINING_DIR)/rc0.d/K01orca_services + -$(RM) $(RCX_D_CONTAINING_DIR)/rc1.d/K01orca_services + -$(RM) $(RCX_D_CONTAINING_DIR)/rc3.d/S99orca_services + $(INSTALL) -m 0744 S99orca_services $(INIT_D_DIR)/orca_services + ln $(INIT_D_DIR)/orca_services $(RCX_D_CONTAINING_DIR)/rc0.d/K01orca_services + ln $(INIT_D_DIR)/orca_services $(RCX_D_CONTAINING_DIR)/rc1.d/K01orca_services + ln $(INIT_D_DIR)/orca_services $(RCX_D_CONTAINING_DIR)/rc3.d/S99orca_services clean: $(RM) $(TARGETS) @@ -66,11 +95,8 @@ orca_services.cfg: orca_services.cfg.in cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services.cfg ./config.status -orca_services.pl: orca_services.pl.in $(PERL_HEAD) +orca_services.pl: orca_services.pl.in cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services.pl ./config.status - cat $(PERL_HEAD) orca_services.pl > orca_services.perl - mv orca_services.perl orca_services.pl - chmod 0755 orca_services.pl orca_services_running.pl: orca_services_running.pl.in cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services_running.pl ./config.status Modified: trunk/orca/data_gatherers/orca_services/start_orca_services.sh.in ============================================================================== --- trunk/orca/data_gatherers/orca_services/start_orca_services.sh.in (original) +++ trunk/orca/data_gatherers/orca_services/start_orca_services.sh.in 2003-01-06 18:02:56.000000000 -0800 @@ -1,29 +1,30 @@ #!/bin/sh -# This script runs orca_services.pl with the proper options for your +# This script runs orca_services with the proper options for your # site. # Define program locations that will be needed. prefix=@prefix@ exec_prefix=@exec_prefix@ -libdir=@libdir@ +libexecdir=@libexecdir@ +sysconfdir=@sysconfdir@ AWK=@AWK@ CUT=@CUT@ UNAME=@UNAME@ -ORCA_SERVICES_DIR=@VAR_DIR@/orca_services +RAW_ORCA_SERVICES_DIR=@VAR_DIR@/orca_services # Get the hostname without the fully qualified part; that is, trim off # anything past the first `.'. uname=`$UNAME -n | $CUT -d. -f1` -# The directory these files go into is $ORCA_SERVICES_DIR/HOSTNAME. -OUTDIR=$ORCA_SERVICES_DIR/$uname +# The directory these files go into is $RAW_ORCA_SERVICES_DIR/HOSTNAME. +OUTDIR=$RAW_ORCA_SERVICES_DIR/$uname # Export the environmental variables. export OUTDIR # Check if orca_services is already running. -pids=`/usr/ucb/ps auxww | $AWK '/orca_services.pl/ && !/awk/ {print $2}'` +pids=`/usr/ucb/ps auxww | $AWK '/orca_services/ && !/awk/ {print $2}'` if test "$pids" != ""; then echo "Orca_services already running. Exiting." exit 1 @@ -48,16 +49,16 @@ # Now start the logging. echo "Starting logging" HOSTNAME=`hostname` -if test -f "$libdir/orca_services.$HOSTNAME"; then - $libdir/orca_services.pl `cat $libdir/orca_services.$HOSTNAME` +if test -f "$libexecdir/orca_services.$HOSTNAME"; then + $libexecdir/orca_services `cat $sysconfdir/orca_services.$HOSTNAME` else - $libdir/orca_services.pl + $libexecdir/orca_services fi -### # Write the PID of orca_services to a file to make killing easier. -### pid=$! -### echo $pid > $OUTDIR/orca_services.pid +# Write the PID of orca_services to a file to make killing easier. +pid=$! +echo $pid > $OUTDIR/orca_services.pid -# Sleep for a couple of seconds to allow any orca_services warnings to -# appear. +# Sleep for a couple of seconds to allow any orca_services startup +# warnings to appear on the terminal before exiting. sleep 5 Modified: trunk/orca/data_gatherers/orca_services/stop_orca_services.sh.in ============================================================================== --- trunk/orca/data_gatherers/orca_services/stop_orca_services.sh.in (original) +++ trunk/orca/data_gatherers/orca_services/stop_orca_services.sh.in 2003-01-06 18:02:56.000000000 -0800 @@ -3,16 +3,16 @@ AWK=@AWK@ # Kill any running orca_services. -pids=`/usr/ucb/ps auxww | $AWK '/orca_services.pl/ && !/awk/ {print $2}'` +pids=`/usr/ucb/ps auxww | $AWK '/orca_services/ && !/awk/ {print $2}'` if test "$pids" != ""; then echo "Killing pids $pids." kill -HUP $pids sleep 1 - pids=`/usr/ucb/ps auxww | $AWK '/orca_services.pl/ && !/awk/ {print $2}'` + pids=`/usr/ucb/ps auxww | $AWK '/orca_services/ && !/awk/ {print $2}'` if test "$pids" != ""; then kill -TERM $pids sleep 1 - pids=`/usr/ucb/ps auxww | $AWK '/orca_services.pl/ && !/awk/ {print $2}'` + pids=`/usr/ucb/ps auxww | $AWK '/orca_services/ && !/awk/ {print $2}'` if test "$pids" != ""; then kill -9 $pids sleep 1 Modified: trunk/orca/data_gatherers/orca_services/README ============================================================================== --- trunk/orca/data_gatherers/orca_services/README (original) +++ trunk/orca/data_gatherers/orca_services/README 2003-01-06 18:02:56.000000000 -0800 @@ -1,6 +1,6 @@ ## ## -## Orca_services.pl, a log generating services usage monitor +## Orca_services: a log generating services usage monitor ## ## @@ -25,7 +25,7 @@ orca_services_running warn if orca_services files are not up to date. Not changed by canau. - orca_services.pl + orca_services main data collector SHELL_SCRIPTS @@ -82,7 +82,7 @@ Most of the skeleton code of orca_services comes from orcallator. So everything is very similar. -4) You might need to edit orca_services.pl to suit your needs. Look for +4) You might need to edit orca_services to suit your needs. Look for code need the ATTENTION string. You'll probably need to edit orca_services.cfg.in. From blair at orcaware.com Tue Jan 7 23:20:32 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Tue, 7 Jan 2003 23:20:32 -0800 Subject: [Orca-checkins] rev 190 - in trunk/orca: . packages packages/DProf-19990108 packages/DProf-19990108/t Message-ID: <200301080720.h087KWWe017285@orcaware.com> Author: blair Date: 2003-01-07 23:20:14 -0800 (Tue, 07 Jan 2003) New Revision: 190 Added: trunk/orca/packages/DProf-19990108/ trunk/orca/packages/DProf-19990108/Changes trunk/orca/packages/DProf-19990108/DProf.pm trunk/orca/packages/DProf-19990108/DProf.xs trunk/orca/packages/DProf-19990108/MANIFEST trunk/orca/packages/DProf-19990108/Makefile.PL trunk/orca/packages/DProf-19990108/README trunk/orca/packages/DProf-19990108/Todo trunk/orca/packages/DProf-19990108/dprofpp.PL trunk/orca/packages/DProf-19990108/t/ trunk/orca/packages/DProf-19990108/t/V.pm trunk/orca/packages/DProf-19990108/t/test1.pl trunk/orca/packages/DProf-19990108/t/test1.t trunk/orca/packages/DProf-19990108/t/test1.v trunk/orca/packages/DProf-19990108/t/test2.t trunk/orca/packages/DProf-19990108/t/test2.v trunk/orca/packages/DProf-19990108/t/test3.t trunk/orca/packages/DProf-19990108/t/test3.v trunk/orca/packages/DProf-19990108/t/test4.t trunk/orca/packages/DProf-19990108/t/test4.v trunk/orca/packages/DProf-19990108/t/test5.t trunk/orca/packages/DProf-19990108/t/test5.v trunk/orca/packages/DProf-19990108/t/test6.t trunk/orca/packages/DProf-19990108/t/test6.v trunk/orca/packages/DProf-19990108/test.pl Modified: trunk/orca/INSTALL trunk/orca/configure.in trunk/orca/packages/Makefile.in Log: To help profile Orca using Perl's Devel::DProf, include Devel::DProf version 19990108 in the packages directory. Perl versions 5.6.1 and newer come with newer versions of Devel::DProf, so this is to help with older versions of Perl, such as 5.005_03 which is packaged with Solaris 8. * INSTALL (Determine which Perl modules need compiling and installing): Update the table listing the required Perl modules to also list the optional modules, Date::Parse and Devel::DProf. Rename the column "Required Version" to "Required Package Version". Add another column to the table, "Required Module Version". The module version is the version of the module in the module's $VERSION. The package version is the version number in the file name of the .tar.gz that includes the Perl module. Update RRDs's version number to 1.0.40 from 1.0.33 to reflect reality. Include the commands to download, compile and install Date::Parse and Devel::Dprof in the section where the other Perl modules are described. * configure.in: New variables DEVEL_DPROF_DIR, DEVEL_DPROF_VER, MAKE_DEVEL_DPROF, TEST_DEVEL_DPROF, INSTALL_PERL_DEVEL_DPROF, CLEAN_DEVEL_DPROF, DISTCLEAN_DEVEL_DPROF. Check if Devel::DProf version 19990108 is installed in Perl. Set up the Makefile's to build and install it if it isn't already installed. * packages/Makefile.in: Add all the rules to make, test, install, clean and distclean Devel::DProf. * packages/DProf-19990108: Directory contents copied from DProf-19990108.tar.gz. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-07 23:20:26.000000000 -0800 @@ -31,6 +31,8 @@ DATA_DUMPER_VER=2.101 DATE_PARSE_DIR=TimeDate-1.14 DATE_PARSE_VER=2.24 +DEVEL_DPROF_DIR=DProf-19990108 +DEVEL_DPROF_VER=19990108 DIGEST_MD5_DIR=Digest-MD5-2.22 DIGEST_MD5_VER=2.22 MATH_INTERVALSEARCH_DIR=Math-Interpolate-1.05 @@ -45,6 +47,7 @@ AC_SUBST(COMPRESS_ZLIB_DIR) AC_SUBST(DATA_DUMPER_DIR) AC_SUBST(DATE_PARSE_DIR) +AC_SUBST(DEVEL_DPROF_DIR) AC_SUBST(DIGEST_MD5_DIR) AC_SUBST(MATH_INTERVALSEARCH_DIR) AC_SUBST(RRDTOOL_DIR) @@ -53,6 +56,7 @@ AC_SUBST(COMPRESS_ZLIB_VER) AC_SUBST(DATA_DUMPER_VER) AC_SUBST(DATE_PARSE_VER) +AC_SUBST(DEVEL_DPROF_VER) AC_SUBST(DIGEST_MD5_VER) AC_SUBST(MATH_INTERVALSEARCH_VER) AC_SUBST(RRDTOOL_VER) @@ -342,6 +346,21 @@ AC_SUBST(CLEAN_DATE_PARSE) AC_SUBST(DISTCLEAN_DATE_PARSE) +BORP_PERL_MODULE(orca_cv_perl_devel_dprof, $PERL, Devel::DProf, $DEVEL_DPROF_VER) +test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_devel_dprof=no +if test "$orca_cv_perl_devel_dprof" = no; then + MAKE_DEVEL_DPROF=make_devel_dprof + TEST_DEVEL_DPROF=test_devel_dprof + INSTALL_PERL_DEVEL_DPROF=install_perl_devel_dprof + CLEAN_DEVEL_DPROF=clean_devel_dprof + DISTCLEAN_DEVEL_DPROF=distclean_devel_dprof +fi +AC_SUBST(MAKE_DEVEL_DPROF) +AC_SUBST(TEST_DEVEL_DPROF) +AC_SUBST(INSTALL_PERL_DEVEL_DPROF) +AC_SUBST(CLEAN_DEVEL_DPROF) +AC_SUBST(DISTCLEAN_DEVEL_DPROF) + BORP_PERL_MODULE(orca_cv_perl_digest_md5, $PERL, Digest::MD5, $DIGEST_MD5_VER) test "$ALWAYS_BUILD_PERL_MODULES" && orca_cv_perl_digest_md5=no if test "$orca_cv_perl_digest_md5" = no; then Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-01-07 23:20:26.000000000 -0800 @@ -154,25 +154,37 @@ 4) Determine which Perl modules need compiling and installing. Optionally download newer versions of these modules. - Orca requires the following Perl modules at the specified - versions: + The Orca distribution includes the following Perl modules. Some + of them are required for Orca to execute and some are included as + modules that may be needed to help process data loaded by Orca + (such as Date::Parse) or to profile Orca for performance + improvements (Devel::DProf). + + Here, the module version refers to the $VERSION variable in the + Perl module that is loaded by Perl and the package version refers + to the version number in the file name of the .tar.gz that + includes the Perl module. + + Module Required Required Package Version + Name Module Package Included With + Version Version Orca + ------------------------------------------------------------------- + Data::Dumper >= 2.101 >= 2.101 2.101 + Date::Parse Not required by Orca 2.24 + Devel::DProf Not required by Orca 19990108 + Digest::MD5 >= 2.22 >= 2.22 2.22 + Math::IntervalSearch >= 1.05 >= 1.05 1.05 + RRDs >= 1.000401 >= 1.0.40 1.0.40 + Storable >= 2.06 >= 2.06 2.06 - Name Required Version Included With Orca - ---------------------------------------------------------------------- - Data::Dumper 2.101 or greater 2.101 - Digest::MD5 2.22 or greater 2.22 - Math::IntervalSearch 1.05 or greater 1.05 - RRDs 1.0.33 or greater 1.0.33 - Storable 2.06 or greater 2.06 - - All five of these modules are included with the Orca distribution + All seven of these modules are included with the Orca distribution in the packages directory. When you configure Orca in step 3), configure will determine if you need any of these modules compiled and installed. configure will then modify the packages/Makefile file to only build those modules that need to be installed. - All of the modules except for Math::IntervalSearch require a - compiler and generate shared libraries by default. + All of the modules except for Date::Parse and Math::IntervalSearch + require a C compiler and generate shared libraries by default. If you wish to download and install modules that have been updated since this Orca package has been assembled, please use the @@ -189,6 +201,28 @@ % make test % make install + Date::Parse + + http://www.perl.com/CPAN/authors/id/G/GB/GBARR/TimeDate-1.14.tar.gz + + % gunzip -c TimeDate-1.14.tar.gz | tar xvf - + % cd TimeDate-1.14 + % perl Makefile.PL + % make + % make test + % make install + + Devel::DProf + + http://www.perl.com/CPAN/authors/id/I/IL/ILYAZ/modules/DProf-19990108.tar.gz + + % gunzip -c DProf-19990108.tar.gz | tar xvf - + % cd DProf-19990108 + % perl Makefile.PL + % make + % make test + % make install + Digest::MD5 http://www.perl.com/CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.22.tar.gz Modified: trunk/orca/packages/Makefile.in ============================================================================== --- trunk/orca/packages/Makefile.in (original) +++ trunk/orca/packages/Makefile.in 2003-01-07 23:20:26.000000000 -0800 @@ -6,6 +6,7 @@ compress_zlib_dir = @COMPRESS_ZLIB_DIR@ data_dumper_dir = @DATA_DUMPER_DIR@ date_parse_dir = @DATE_PARSE_DIR@ +devel_dprof_dir = @DEVEL_DPROF_DIR@ digest_md5_dir = @DIGEST_MD5_DIR@ math_intervalsearch_dir = @MATH_INTERVALSEARCH_DIR@ rrdtool_dir = @RRDTOOL_DIR@ @@ -14,6 +15,7 @@ MAKE_COMPRESS_ZLIB = @MAKE_COMPRESS_ZLIB@ MAKE_DATA_DUMPER = @MAKE_DATA_DUMPER@ MAKE_DATE_PARSE = @MAKE_DATE_PARSE@ +MAKE_DEVEL_DPROF = @MAKE_DEVEL_DPROF@ MAKE_DIGEST_MD5 = @MAKE_DIGEST_MD5@ MAKE_MATH_INTERVALSEARCH = @MAKE_MATH_INTERVALSEARCH@ MAKE_RRDTOOL = @MAKE_RRDTOOL@ @@ -21,6 +23,7 @@ MAKE_TARGETS = $(MAKE_COMPRESS_ZLIB) \ $(MAKE_DATA_DUMPER) \ $(MAKE_DATE_PARSE) \ + $(MAKE_DEVEL_DPROF) \ $(MAKE_DIGEST_MD5) \ $(MAKE_MATH_INTERVALSEARCH) \ $(MAKE_RRDTOOL) \ @@ -29,6 +32,7 @@ TEST_COMPRESS_ZLIB = @TEST_COMPRESS_ZLIB@ TEST_DATA_DUMPER = @TEST_DATA_DUMPER@ TEST_DATE_PARSE = @TEST_DATE_PARSE@ +TEST_DEVEL_DPROF = @TEST_DEVEL_DPROF@ TEST_DIGEST_MD5 = @TEST_DIGEST_MD5@ TEST_MATH_INTERVALSEARCH = @TEST_MATH_INTERVALSEARCH@ TEST_RRDTOOL = @TEST_RRDTOOL@ @@ -36,6 +40,7 @@ TEST_TARGETS = $(TEST_COMPRESS_ZLIB) \ $(TEST_DATA_DUMPER) \ $(TEST_DATE_PARSE) \ + $(TEST_DEVEL_DPROF) \ $(TEST_DIGEST_MD5) \ $(TEST_MATH_INTERVALSEARCH) \ $(TEST_RRDTOOL) \ @@ -44,6 +49,7 @@ INSTALL_PERL_COMPRESS_ZLIB = @INSTALL_PERL_COMPRESS_ZLIB@ INSTALL_PERL_DATA_DUMPER = @INSTALL_PERL_DATA_DUMPER@ INSTALL_PERL_DATE_PARSE = @INSTALL_PERL_DATE_PARSE@ +INSTALL_PERL_DEVEL_DPROF = @INSTALL_PERL_DEVEL_DPROF@ INSTALL_PERL_DIGEST_MD5 = @INSTALL_PERL_DIGEST_MD5@ INSTALL_PERL_MATH_INTERVALSEARCH = @INSTALL_PERL_MATH_INTERVALSEARCH@ INSTALL_PERL_RRDTOOL = @INSTALL_PERL_RRDTOOL@ @@ -51,6 +57,7 @@ INSTALL_PERL_TARGETS = $(INSTALL_PERL_COMPRESS_ZLIB) \ $(INSTALL_PERL_DATA_DUMPER) \ $(INSTALL_PERL_DATE_PARSE) \ + $(INSTALL_PERL_DEVEL_DPROF) \ $(INSTALL_PERL_DIGEST_MD5) \ $(INSTALL_PERL_MATH_INTERVALSEARCH) \ $(INSTALL_PERL_RRDTOOL) \ @@ -62,6 +69,7 @@ CLEAN_COMPRESS_ZLIB = @CLEAN_COMPRESS_ZLIB@ CLEAN_DATA_DUMPER = @CLEAN_DATA_DUMPER@ CLEAN_DATE_PARSE = @CLEAN_DATE_PARSE@ +CLEAN_DEVEL_DPROF = @CLEAN_DEVEL_DPROF@ CLEAN_DIGEST_MD5 = @CLEAN_DIGEST_MD5@ CLEAN_MATH_INTERVALSEARCH = @CLEAN_MATH_INTERVALSEARCH@ CLEAN_RRDTOOL = @CLEAN_RRDTOOL@ @@ -69,6 +77,7 @@ CLEAN_TARGETS = $(CLEAN_COMPRESS_ZLIB) \ $(CLEAN_DATA_DUMPER) \ $(CLEAN_DATE_PARSE) \ + $(CLEAN_DEVEL_DPROF) \ $(CLEAN_DIGEST_MD5) \ $(CLEAN_MATH_INTERVALSEARCH) \ $(CLEAN_RRDTOOL) \ @@ -77,6 +86,7 @@ DISTCLEAN_COMPRESS_ZLIB = @DISTCLEAN_COMPRESS_ZLIB@ DISTCLEAN_DATA_DUMPER = @DISTCLEAN_DATA_DUMPER@ DISTCLEAN_DATE_PARSE = @DISTCLEAN_DATE_PARSE@ +DISTCLEAN_DEVEL_DPROF = @DISTCLEAN_DEVEL_DPROF@ DISTCLEAN_DIGEST_MD5 = @DISTCLEAN_DIGEST_MD5@ DISTCLEAN_MATH_INTERVALSEARCH = @DISTCLEAN_MATH_INTERVALSEARCH@ DISTCLEAN_RRDTOOL = @DISTCLEAN_RRDTOOL@ @@ -84,6 +94,7 @@ DISTCLEAN_TARGETS = $(DISTCLEAN_COMPRESS_ZLIB) \ $(DISTCLEAN_DATA_DUMPER) \ $(DISTCLEAN_DATE_PARSE) \ + $(DISTCLEAN_DEVEL_DPROF) \ $(DISTCLEAN_DIGEST_MD5) \ $(DISTCLEAN_MATH_INTERVALSEARCH) \ $(DISTCLEAN_RRDTOOL) \ @@ -109,6 +120,12 @@ $(date_parse_dir)/Makefile: $(date_parse_dir)/Makefile.PL $(PERL) cd $(date_parse_dir) && $(PERL) Makefile.PL +make_devel_dprof: $(devel_dprof_dir)/Makefile + cd $(devel_dprof_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" + +$(devel_dprof_dir)/Makefile: $(devel_dprof_dir)/Makefile.PL $(PERL) + cd $(devel_dprof_dir) && $(PERL) Makefile.PL + make_digest_md5: $(digest_md5_dir)/Makefile cd $(digest_md5_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" @@ -152,6 +169,9 @@ test_date_parse: $(date_parse_dir)/Makefile cd $(date_parse_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" test +test_devel_dprof: $(devel_dprof_dir)/Makefile + cd $(devel_dprof_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" test + test_digest_md5: $(digest_md5_dir)/Makefile cd $(digest_md5_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" test @@ -180,6 +200,9 @@ install_perl_date_parse: $(date_parse_dir)/Makefile cd $(date_parse_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install +install_perl_devel_dprof: $(devel_dprof_dir)/Makefile + cd $(devel_dprof_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install + install_perl_digest_md5: $(digest_md5_dir)/Makefile cd $(digest_md5_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install @@ -212,6 +235,12 @@ (cd $(date_parse_dir) && $(MAKE) clean); \ fi +clean_devel_dprof: + @if test -r $(devel_dprof_dir)/Makefile; then \ + echo 'cd $(devel_dprof_dir) && $(MAKE) clean'; \ + (cd $(devel_dprof_dir) && $(MAKE) clean); \ + fi + clean_digest_md5: @if test -r $(digest_md5_dir)/Makefile; then \ echo 'cd $(digest_md5_dir) && $(MAKE) clean'; \ @@ -242,6 +271,8 @@ distclean_date_parse: clean_date_parse +distclean_devel_dprof: clean_devel_dprof + distclean_digest_md5: clean_digest_md5 distclean_math_intervalsearch: clean_math_intervalsearch Added: trunk/orca/packages/DProf-19990108/DProf.xs ============================================================================== --- trunk/orca/packages/DProf-19990108/DProf.xs (original) +++ trunk/orca/packages/DProf-19990108/DProf.xs 2003-01-07 23:20:26.000000000 -0800 @@ -0,0 +1,703 @@ +#define PERL_POLLUTE + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +/* For older Perls */ +#ifndef dTHR +# define dTHR int dummy_thr +#endif /* dTHR */ + +/*#define DBG_SUB 1 /* */ +/*#define DBG_TIMER 1 /* */ + +#ifdef DBG_SUB +# define DBG_SUB_NOTIFY(A,B) warn( A, B ) +#else +# define DBG_SUB_NOTIFY(A,B) /* nothing */ +#endif + +#ifdef DBG_TIMER +# define DBG_TIMER_NOTIFY(A) warn( A ) +#else +# define DBG_TIMER_NOTIFY(A) /* nothing */ +#endif + +static U32 dprof_ticks; + +/* HZ == clock ticks per second */ +#ifdef VMS +# define HZ CLK_TCK +# define DPROF_HZ HZ +# include /* prototype for sys$gettim() */ + clock_t dprof_times(struct tms *bufptr) { + clock_t retval; + /* Get wall time and convert to 10 ms intervals to + * produce the return value dprof expects */ +# if defined(__DECC) && defined (__ALPHA) +# include + uint64 vmstime; + _ckvmssts(sys$gettim(&vmstime)); + vmstime /= 100000; + retval = vmstime & 0x7fffffff; +# else + /* (Older hw or ccs don't have an atomic 64-bit type, so we + * juggle 32-bit ints (and a float) to produce a time_t result + * with minimal loss of information.) */ + long int vmstime[2],remainder,divisor = 100000; + _ckvmssts(sys$gettim((unsigned long int *)vmstime)); + vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */ + _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder)); +# endif + /* Fill in the struct tms using the CRTL routine . . .*/ + times((tbuffer_t *)bufptr); + return (clock_t) retval; + } +# define Times(ptr) (dprof_times(ptr)) +#else +# ifndef HZ +# ifdef CLK_TCK +# define HZ CLK_TCK +# else +# define HZ 60 +# endif +# endif +# ifdef OS2 /* times() has significant overhead */ +# define Times(ptr) (dprof_times(ptr)) +# define INCL_DOSPROFILE +# define INCL_DOSERRORS +# include +# define toLongLong(arg) (*(long long*)&(arg)) +# define DPROF_HZ dprof_ticks + +static ULONG frequ; +static long long start_cnt; +clock_t +dprof_times(struct tms *t) +{ + ULONG rc; + QWORD cnt; + + if (!frequ) { + if (CheckOSError(DosTmrQueryFreq(&frequ))) + croak("DosTmrQueryFreq: %s", SvPV(perl_get_sv("!",TRUE),na)); + else + frequ = frequ/DPROF_HZ; /* count per tick */ + if (CheckOSError(DosTmrQueryTime(&cnt))) + croak("DosTmrQueryTime: %s", + SvPV(perl_get_sv("!",TRUE),na)); + start_cnt = toLongLong(cnt); + } + + if (CheckOSError(DosTmrQueryTime(&cnt))) + croak("DosTmrQueryTime: %s", SvPV(perl_get_sv("!",TRUE),na)); + t->tms_stime = 0; + return (t->tms_utime = (toLongLong(cnt) - start_cnt)/frequ); +} +# else +# define Times(ptr) (times(ptr)) +# define DPROF_HZ HZ +# endif +#endif + +XS(XS_Devel__DProf_END); /* used by prof_mark() */ + +static SV * Sub; /* pointer to $DB::sub */ +static FILE *fp; /* pointer to tmon.out file */ + +/* Added -JH */ +static long TIMES_LOCATION=42;/* Where in the file to store the time totals */ +static int SAVE_STACK = 1<<14; /* How much data to buffer until */ + /* end of run */ + +static int prof_pid; /* pid of profiled process */ + +/* Everything is built on times(2). See its manpage for a description + * of the timings. + */ + +static +struct tms prof_start, + prof_end; + +static +clock_t rprof_start, /* elapsed real time, in ticks */ + rprof_end, + wprof_u, wprof_s, wprof_r; + +union prof_any { + clock_t tms_utime; /* cpu time spent in user space */ + clock_t tms_stime; /* cpu time spent in system */ + clock_t realtime; /* elapsed real time, in ticks */ + char *name; + U32 id; + opcode ptype; +}; + +typedef union prof_any PROFANY; + +static PROFANY *profstack; +static int profstack_max = 128; +static int profstack_ix = 0; + +static void +prof_dump(opcode ptype, char *name) +{ + if(ptype == OP_LEAVESUB){ + fprintf(fp,"- & %s\n", name ); + } else if(ptype == OP_ENTERSUB) { + fprintf(fp,"+ & %s\n", name ); + } else if(ptype == OP_DIE) { + fprintf(fp,"/ & %s\n", name ); + } else { + fprintf(fp,"Profiler unknown prof code %d\n", ptype); + } + safefree(name); +} + +static void +prof_dumpa(opcode ptype, U32 id) +{ + if(ptype == OP_LEAVESUB){ + fprintf(fp,"- %lx\n", id ); + } else if(ptype == OP_ENTERSUB) { + fprintf(fp,"+ %lx\n", id ); + } else if(ptype == OP_GOTO) { + fprintf(fp,"* %lx\n", id ); + } else if(ptype == OP_DIE) { + fprintf(fp,"/ %lx\n", id ); + } else { + fprintf(fp,"Profiler unknown prof code %d\n", ptype); + } +} + +static void +prof_dumps(U32 id, char *pname, char *gname) +{ + fprintf(fp,"& %lx %s %s\n", id, pname, gname); +} + +static clock_t otms_utime, otms_stime, orealtime; + +static void +prof_dumpt(long tms_utime, long tms_stime, long realtime) +{ + fprintf(fp,"@ %ld %ld %ld\n", tms_utime, tms_stime, realtime); +} + +static void +prof_dump_until(long ix) +{ + long base = 0; + struct tms t1, t2; + clock_t realtime1, realtime2; + + realtime1 = Times(&t1); + + while( base < ix ){ + opcode ptype = profstack[base++].ptype; + if (ptype == OP_TIME) { + long tms_utime = profstack[base++].tms_utime; + long tms_stime = profstack[base++].tms_stime; + long realtime = profstack[base++].realtime; + + prof_dumpt(tms_utime, tms_stime, realtime); + } else if (ptype == OP_GV) { + U32 id = profstack[base++].id; + char *pname = profstack[base++].name; + char *gname = profstack[base++].name; + + prof_dumps(id, pname, gname); + } else { +#ifdef PERLDBf_NONAME + U32 id = profstack[base++].id; + prof_dumpa(ptype, id); +#else + char *name = profstack[base++].name; + prof_dump(ptype, name); +#endif + } + } + fflush(fp); + realtime2 = Times(&t2); + if (realtime2 != realtime1 || t1.tms_utime != t2.tms_utime + || t1.tms_stime != t2.tms_stime) { + wprof_r += realtime2 - realtime1; + wprof_u += t2.tms_utime - t1.tms_utime; + wprof_s += t2.tms_stime - t1.tms_stime; + + fprintf(fp,"+ & Devel::DProf::write\n" ); + fprintf(fp,"@ %ld %ld %ld\n", + t2.tms_utime - t1.tms_utime, t2.tms_stime - t1.tms_stime, + realtime2 - realtime1); + fprintf(fp,"- & Devel::DProf::write\n" ); + otms_utime = t2.tms_utime; + otms_stime = t2.tms_stime; + orealtime = realtime2; + fflush(fp); + } +} + +static HV* cv_hash; +static U32 total = 0; + +static void +prof_mark( ptype ) +opcode ptype; +{ + struct tms t; + clock_t realtime, rdelta, udelta, sdelta; + char *name, *pv; + char *hvname; + STRLEN len; + SV *sv; + U32 id; + + if( SAVE_STACK ){ + if( profstack_ix + 5 > profstack_max ){ + profstack_max = profstack_max * 3 / 2; + Renew( profstack, profstack_max, PROFANY ); + } + } + + realtime = Times(&t); + rdelta = realtime - orealtime; + udelta = t.tms_utime - otms_utime; + sdelta = t.tms_stime - otms_stime; + if (rdelta || udelta || sdelta) { + if (SAVE_STACK) { + profstack[profstack_ix++].ptype = OP_TIME; + profstack[profstack_ix++].tms_utime = udelta; + profstack[profstack_ix++].tms_stime = sdelta; + profstack[profstack_ix++].realtime = rdelta; + } else { /* Write it to disk now so's not to eat up core */ + if (prof_pid == (int)getpid()) { + prof_dumpt(udelta, sdelta, rdelta); + fflush(fp); + } + } + orealtime = realtime; + otms_stime = t.tms_stime; + otms_utime = t.tms_utime; + } + +#ifdef PERLDBf_NONAME + { + SV **svp; + char *gname, *pname; + static U32 lastid; + CV *cv; + + cv = (CV*)SvIVX(Sub); + svp = hv_fetch(cv_hash, (char*)&cv, sizeof(CV*), TRUE); + if (!SvOK(*svp)) { + GV *gv = CvGV(cv); + + sv_setiv(*svp, id = ++lastid); + pname = ((GvSTASH(gv) && HvNAME(GvSTASH(gv))) + ? HvNAME(GvSTASH(gv)) + : "(null)"); + gname = GvNAME(gv); + if (CvXSUB(cv) == XS_Devel__DProf_END) + return; + if (SAVE_STACK) { /* Store it for later recording -JH */ + profstack[profstack_ix++].ptype = OP_GV; + profstack[profstack_ix++].id = id; + profstack[profstack_ix++].name = pname; + profstack[profstack_ix++].name = gname; + } else { /* Write it to disk now so's not to eat up core */ + + /* Only record the parent's info */ + if (prof_pid == (int)getpid()) { + prof_dumps(id, pname, gname); + fflush(fp); + } else + perldb = 0; /* Do not debug the kid. */ + } + } else { + id = SvIV(*svp); + } + } +#else + pv = SvPV( Sub, len ); + + if( SvROK(Sub) ){ + /* Attempt to make CODE refs slightly identifiable by + * including their package name. + */ + sv = (SV*)SvRV(Sub); + if( sv && SvTYPE(sv) == SVt_PVCV ){ + if( CvSTASH(sv) ){ + hvname = HvNAME(CvSTASH(sv)); + } + else if( CvXSUB(sv) == &XS_Devel__DProf_END ){ + /*warn( "prof_mark() found dprof::end");*/ + return; /* don't profile Devel::DProf::END */ + } + else{ + croak( "DProf prof_mark() lost on CODE ref %s\n", pv ); + } + len += strlen( hvname ) + 2; /* +2 for ::'s */ + + } + else{ + croak( "DProf prof_mark() lost on supposed CODE ref %s.\n", pv ); + } + name = (char *)safemalloc( len * sizeof(char) + 1 ); + strcpy( name, hvname ); + strcat( name, "::" ); + strcat( name, pv ); + } + else{ + if( *(pv+len-1) == 'D' ){ + /* It could be an &AUTOLOAD. */ + + /* I measured a bunch of *.pl and *.pm (from Perl + * distribution and other misc things) and found + * 780 fully-qualified names. They averaged + * about 19 chars each. Only 1 of those names + * ended with 'D' and wasn't an &AUTOLOAD--it + * was &overload::OVERLOAD. + * --dmr 2/19/96 + */ + + if( strcmp( pv+len-9, ":AUTOLOAD" ) == 0 ){ + /* The sub name is in $AUTOLOAD */ + sv = perl_get_sv( pv, 0 ); + if( sv == NULL ){ + croak("DProf prof_mark() lost on AUTOLOAD (%s).\n", pv ); + } + pv = SvPV( sv, na ); + DBG_SUB_NOTIFY( " AUTOLOAD(%s)\n", pv ); + } + } + name = savepv( pv ); + } +#endif /* PERLDBf_NONAME */ + + total++; + if (SAVE_STACK) { /* Store it for later recording -JH */ + profstack[profstack_ix++].ptype = ptype; +#ifdef PERLDBf_NONAME + profstack[profstack_ix++].id = id; +#else + profstack[profstack_ix++].name = name; +#endif + /* Only record the parent's info */ + if (SAVE_STACK < profstack_ix) { + if (prof_pid == (int)getpid()) + prof_dump_until(profstack_ix); + else + perldb = 0; /* Do not debug the kid. */ + profstack_ix = 0; + } + } else { /* Write it to disk now so's not to eat up core */ + + /* Only record the parent's info */ + if (prof_pid == (int)getpid()) { +#ifdef PERLDBf_NONAME + prof_dumpa(ptype, id); +#else + prof_dump(ptype, name); +#endif + fflush(fp); + } else + perldb = 0; /* Do not debug the kid. */ + } +} + +static U32 default_perldb; + +#ifdef PL_NEEDED +# define defstash PL_defstash +#endif + +/* Counts overhead of prof_mark and extra XS call. */ +static void +test_time(clock_t *r, clock_t *u, clock_t *s) +{ + dTHR; + CV *cv = perl_get_cv("Devel::DProf::NONESUCH_noxs", FALSE); + int i, j, k = 0; + HV *oldstash = curstash; + struct tms t1, t2; + clock_t realtime1, realtime2; + U32 ototal = total; + U32 ostack = SAVE_STACK; + U32 operldb = perldb; + + SAVE_STACK = 1000000; + realtime1 = Times(&t1); + + while (k < 2) { + i = 0; + /* Disable debugging of perl_call_sv on second pass: */ + curstash = (k == 0 ? defstash : debstash); + perldb = default_perldb; + while (++i <= 100) { + j = 0; + profstack_ix = 0; /* Do not let the stack grow */ + while (++j <= 100) { +/* prof_mark( OP_ENTERSUB ); */ + + PUSHMARK( stack_sp ); + perl_call_sv( (SV*)cv, G_SCALAR ); + stack_sp--; +/* prof_mark( OP_LEAVESUB ); */ + } + } + curstash = oldstash; + if (k == 0) { /* Put time with debugging */ + realtime2 = Times(&t2); + *r = realtime2 - realtime1; + *u = t2.tms_utime - t1.tms_utime; + *s = t2.tms_stime - t1.tms_stime; + } else { /* Subtract time without debug */ + realtime1 = Times(&t1); + *r -= realtime1 - realtime2; + *u -= t1.tms_utime - t2.tms_utime; + *s -= t1.tms_stime - t2.tms_stime; + } + k++; + } + total = ototal; + SAVE_STACK = ostack; + perldb = operldb; +} + +static void +prof_recordheader() +{ + clock_t r, u, s; + + /* fp is opened in the BOOT section */ + fprintf(fp, "#fOrTyTwO\n" ); + fprintf(fp, "$hz=%d;\n", DPROF_HZ ); + fprintf(fp, "$XS_VERSION='DProf %s';\n", XS_VERSION ); + fprintf(fp, "# All values are given in HZ\n" ); + test_time(&r, &u, &s); + fprintf(fp, "$over_utime=%ld; $over_stime=%ld; $over_rtime=%ld;\n", + u, s, r); + fprintf(fp, "$over_tests=10000;\n"); + + TIMES_LOCATION = ftell(fp); + + /* Pad with whitespace. */ + /* This should be enough even for very large numbers. */ + fprintf(fp, "%*s\n", 240 , ""); + + fprintf(fp, "\n"); + fprintf(fp, "PART2\n" ); + + fflush(fp); +} + +static void +prof_record() +{ + /* fp is opened in the BOOT section */ + + /* Now that we know the runtimes, fill them in at the recorded + location -JH */ + + clock_t r, u, s; + + if(SAVE_STACK){ + prof_dump_until(profstack_ix); + } + fseek(fp, TIMES_LOCATION, SEEK_SET); + /* Write into reserved 240 bytes: */ + fprintf(fp, "$rrun_utime=%ld; $rrun_stime=%ld; $rrun_rtime=%ld;", + prof_end.tms_utime - prof_start.tms_utime - wprof_u, + prof_end.tms_stime - prof_start.tms_stime - wprof_s, + rprof_end - rprof_start - wprof_r ); + fprintf(fp, "\n$total_marks=%ld;", total); + + fclose( fp ); +} + +#define NONESUCH() + +static U32 depth = 0; + +static void +check_depth(void *foo) +{ + U32 need_depth = (U32)foo; + if (need_depth != depth) { + if (need_depth > depth) { + warn("garbled call depth when profiling"); + } else { + I32 marks = depth - need_depth; + +/* warn("Check_depth: got %d, expected %d\n", depth, need_depth); */ + while (marks--) { + prof_mark( OP_DIE ); + } + depth = need_depth; + } + } +} + +#define for_real +#ifdef for_real + +XS(XS_DB_sub) +{ + dXSARGS; + dORIGMARK; + HV *oldstash = curstash; + + SP -= items; + + DBG_SUB_NOTIFY( "XS DBsub(%s)\n", SvPV(Sub, na) ); + +#ifndef PERLDBf_NONAME /* Was needed on older Perls */ + sv_setiv( DBsingle, 0 ); /* disable DB single-stepping */ +#endif + + SAVEDESTRUCTOR(check_depth, (void*)depth); + depth++; + + prof_mark( OP_ENTERSUB ); + PUSHMARK( ORIGMARK ); + +#ifdef G_NODEBUG + perl_call_sv( (SV*)SvIV(Sub), GIMME | G_NODEBUG); +#else + curstash = debstash; /* To disable debugging of perl_call_sv */ +#ifdef PERLDBf_NONAME + perl_call_sv( (SV*)SvIV(Sub), GIMME ); +#else + perl_call_sv( Sub, GIMME ); +#endif + curstash = oldstash; +#endif + + prof_mark( OP_LEAVESUB ); + depth--; + + SPAGAIN; + PUTBACK; + return; +} + +XS(XS_DB_goto) +{ + prof_mark( OP_GOTO ); + return; +} + +#endif /* for_real */ + +#ifdef testing + + MODULE = Devel::DProf PACKAGE = DB + + void + sub(...) + PPCODE: + + dORIGMARK; + HV *oldstash = curstash; + /* SP -= items; added by xsubpp */ + DBG_SUB_NOTIFY( "XS DBsub(%s)\n", SvPV(Sub, na) ); + + sv_setiv( DBsingle, 0 ); /* disable DB single-stepping */ + + prof_mark( OP_ENTERSUB ); + PUSHMARK( ORIGMARK ); + + curstash = debstash; /* To disable debugging of perl_call_sv +*/ + perl_call_sv( Sub, GIMME ); + curstash = oldstash; + + prof_mark( OP_LEAVESUB ); + SPAGAIN; + /* PUTBACK; added by xsubpp */ + +#endif /* testing */ + +MODULE = Devel::DProf PACKAGE = Devel::DProf + +void +END() + PPCODE: + if( DBsub ){ + /* maybe the process forked--we want only + * the parent's profile. + */ + if( prof_pid == (int)getpid() ){ + rprof_end = Times(&prof_end); + DBG_TIMER_NOTIFY("Profiler timer is off.\n"); + prof_record(); + } + } + +void +NONESUCH() + +BOOT: + /* Before we go anywhere make sure we were invoked + * properly, else we'll dump core. + */ + if( ! DBsub ) + croak("DProf: run perl with -d to use DProf.\n"); + + /* When we hook up the XS DB::sub we'll be redefining + * the DB::sub from the PM file. Turn off warnings + * while we do this. + */ + { + I32 warn_tmp = dowarn; + dowarn = 0; + newXS("DB::sub", XS_DB_sub, file); + newXS("DB::goto", XS_DB_goto, file); + dowarn = warn_tmp; + } + + Sub = GvSV(DBsub); /* name of current sub */ + sv_setiv( DBsingle, 0 ); /* disable DB single-stepping */ + + { + char *buffer = getenv("PERL_DPROF_BUFFER"); + + if (buffer) { + SAVE_STACK = atoi(buffer); + } + + buffer = getenv("PERL_DPROF_TICKS"); + + if (buffer) { + dprof_ticks = atoi(buffer); /* Used under OS/2 only */ + } else { + dprof_ticks = HZ; + } + } + + if( (fp = fopen( "tmon.out", "w" )) == NULL ) + croak("DProf: unable to write tmon.out, errno = %d\n", errno ); +#ifdef PERLDBf_NONAME + default_perldb = PERLDBf_NONAME | PERLDBf_SUB; /* no name needed. */ +#ifdef PERLDBf_GOTO + default_perldb = default_perldb | PERLDBf_GOTO; +#endif + cv_hash = newHV(); +#else +# ifdef PERLDBf_SUB + default_perldb = PERLDBf_SUB; /* debug subroutines only. */ +# endif +#endif + prof_pid = (int)getpid(); + + New( 0, profstack, profstack_max, PROFANY ); + + prof_recordheader(); + + DBG_TIMER_NOTIFY("Profiler timer is on.\n"); + orealtime = rprof_start = Times(&prof_start); + otms_utime = prof_start.tms_utime; + otms_stime = prof_start.tms_stime; + perldb = default_perldb; Added: trunk/orca/packages/DProf-19990108/t/V.pm ============================================================================== --- trunk/orca/packages/DProf-19990108/t/V.pm (original) +++ trunk/orca/packages/DProf-19990108/t/V.pm 2003-01-07 23:20:26.000000000 -0800 @@ -0,0 +1,65 @@ +package V; + +use Getopt::Std 'getopts'; +getopts('vp:'); + +require Exporter; + at ISA = 'Exporter'; + + at EXPORT = qw( dprofpp $opt_v $results $expected report @results ); + at EXPORT_OK = qw( notok ok $num ); + +my $out = 0; +$num = 0; +$results = $expected = ''; +$perl = $opt_p || $^X; + +print "\nperl: $perl\n" if $opt_v; +if( ! -f $perl ){ die "Where's Perl?" } + +sub dprofpp { + my $switches = shift; + + open( D, "$perl ../dprofpp $switches 2> err |" ) || warn "$0: Can't run. $!\n"; + @results = ; + close D; + + open( D, "; + close D; + push( @results, @err ) if @err; + + $results = qq{@results}; + # ignore Loader (Dyna/Auto etc), leave newline + $results =~ s/^\w+Loader::import//; + $results =~ s/\n /\n/gm; + $results; +} + +sub report { + $num = shift; + my $sub = shift; + my $x; + + $x = &$sub; + $x ? &ok : ¬ok; +} + +sub ok { + ++$out; + print "ok $num, "; +} + +sub notok { + ++$out; + print "not ok $num, "; + if( $opt_v ){ + print "\nResult\n{$results}\n"; + print "Expected\n{$expected}\n"; + } +} + +END { print "\n" if $out } + + +1; Added: trunk/orca/packages/DProf-19990108/t/test1.t ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test1.t (original) +++ trunk/orca/packages/DProf-19990108/t/test1.t 2003-01-07 23:20:26.000000000 -0800 @@ -0,0 +1,18 @@ +sub foo { + print "in sub foo\n"; + bar(); +} + +sub bar { + print "in sub bar\n"; +} + +sub baz { + print "in sub baz\n"; + bar(); + foo(); +} + +bar(); +baz(); +foo(); Added: trunk/orca/packages/DProf-19990108/t/test2.t ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test2.t (original) +++ trunk/orca/packages/DProf-19990108/t/test2.t 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,21 @@ +sub foo { + print "in sub foo\n"; + bar(); +} + +sub bar { + print "in sub bar\n"; +} + +sub baz { + print "in sub baz\n"; + bar(); + bar(); + bar(); + foo(); +} + +bar(); +bar(); +baz(); +foo(); Added: trunk/orca/packages/DProf-19990108/t/test3.t ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test3.t (original) +++ trunk/orca/packages/DProf-19990108/t/test3.t 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,19 @@ +sub foo { + print "in sub foo\n"; + exit(0); + bar(); +} + +sub bar { + print "in sub bar\n"; +} + +sub baz { + print "in sub baz\n"; + bar(); + foo(); +} + +bar(); +baz(); +foo(); Added: trunk/orca/packages/DProf-19990108/t/test1.v ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test1.v (original) +++ trunk/orca/packages/DProf-19990108/t/test1.v 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,24 @@ +# perl + +use V; + +dprofpp( '-T' ); +$expected = +qq{main::bar +main::baz + main::bar + main::foo + main::bar +main::foo + main::bar +}; +report 1, sub { $expected eq $results }; + +dprofpp('-TF'); +report 2, sub { $expected eq $results }; + +dprofpp( '-t' ); +report 3, sub { $expected eq $results }; + +dprofpp('-tF'); +report 4, sub { $expected eq $results }; Added: trunk/orca/packages/DProf-19990108/t/test4.t ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test4.t (original) +++ trunk/orca/packages/DProf-19990108/t/test4.t 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,24 @@ +sub foo { + print "in sub foo\n"; + bar(); +} + +sub bar { + print "in sub bar\n"; +} + +sub baz { + print "in sub baz\n"; + bar(); + bar(); + bar(); + foo(); +} + +bar(); + +fork; + +bar(); +baz(); +foo(); Added: trunk/orca/packages/DProf-19990108/t/test2.v ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test2.v (original) +++ trunk/orca/packages/DProf-19990108/t/test2.v 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,36 @@ +# perl + +use V; + +dprofpp( '-T' ); +$expected = +qq{main::bar +main::bar +main::baz + main::bar + main::bar + main::bar + main::foo + main::bar +main::foo + main::bar +}; +report 1, sub { $expected eq $results }; + +dprofpp('-TF'); +report 2, sub { $expected eq $results }; + +dprofpp( '-t' ); +$expected = +qq{main::bar (2x) +main::baz + main::bar (3x) + main::foo + main::bar +main::foo + main::bar +}; +report 3, sub { $expected eq $results }; + +dprofpp('-tF'); +report 4, sub { $expected eq $results }; Added: trunk/orca/packages/DProf-19990108/t/test5.t ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test5.t (original) +++ trunk/orca/packages/DProf-19990108/t/test5.t 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,25 @@ +# Test that dprof doesn't break +# &bar; used as &bar(@_); + +sub foo1 { + print "in foo1(@_)\n"; + bar(@_); +} +sub foo2 { + print "in foo2(@_)\n"; + &bar; +} +sub bar { + print "in bar(@_)\n"; + if( @_ > 0 ){ + &yeppers; + } +} +sub yeppers { + print "rest easy\n"; +} + + +&foo1( A ); +&foo2( B ); + Added: trunk/orca/packages/DProf-19990108/t/test3.v ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test3.v (original) +++ trunk/orca/packages/DProf-19990108/t/test3.v 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,29 @@ +# perl + +use V; + +dprofpp( '-T' ); +$e1 = $expected = +qq{main::bar +main::baz + main::bar + main::foo +}; +report 1, sub { $expected eq $results }; + +dprofpp('-TF'); +$e2 = $expected = +qq{main::bar +main::baz + main::bar + main::foo +}; +report 2, sub { $expected eq $results }; + +dprofpp( '-t' ); +$expected = $e1; +report 3, sub { 1 }; + +dprofpp('-tF'); +$expected = $e2; +report 4, sub { $expected eq $results }; Added: trunk/orca/packages/DProf-19990108/t/test6.t ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test6.t (original) +++ trunk/orca/packages/DProf-19990108/t/test6.t 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,29 @@ +sub foo { + my $x; + my $y; + print "in sub foo\n"; + for( $x = 1; $x < 100; ++$x ){ + bar(); + for( $y = 1; $y < 100; ++$y ){ + } + } +} + +sub bar { + my $x; + print "in sub bar\n"; + for( $x = 1; $x < 100; ++$x ){ + } + die "bar exiting"; +} + +sub baz { + print "in sub baz\n"; + eval { bar(); }; + eval { foo(); }; +} + +eval { bar(); }; +baz(); +eval { foo(); }; + Added: trunk/orca/packages/DProf-19990108/t/test4.v ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test4.v (original) +++ trunk/orca/packages/DProf-19990108/t/test4.v 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,36 @@ +# perl + +use V; + +dprofpp( '-T' ); +$expected = +qq{main::bar +main::bar +main::baz + main::bar + main::bar + main::bar + main::foo + main::bar +main::foo + main::bar +}; +report 1, sub { $expected eq $results }; + +dprofpp('-TF'); +report 2, sub { $expected eq $results }; + +dprofpp( '-t' ); +$expected = +qq{main::bar (2x) +main::baz + main::bar (3x) + main::foo + main::bar +main::foo + main::bar +}; +report 3, sub { $expected eq $results }; + +dprofpp('-tF'); +report 4, sub { $expected eq $results }; Added: trunk/orca/packages/DProf-19990108/t/test5.v ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test5.v (original) +++ trunk/orca/packages/DProf-19990108/t/test5.v 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,15 @@ +# perl + +use V; + +dprofpp( '-T' ); +$expected = +qq{main::foo1 + main::bar + main::yeppers +main::foo2 + main::bar + main::yeppers +}; +report 1, sub { $expected eq $results }; + Added: trunk/orca/packages/DProf-19990108/t/test6.v ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test6.v (original) +++ trunk/orca/packages/DProf-19990108/t/test6.v 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,16 @@ +# perl + +use V; + +dprofpp( '-T' ); +$expected = +qq{main::bar +main::baz + main::bar + main::foo + main::bar +main::foo + main::bar +}; +report 1, sub { $expected eq $results }; + Added: trunk/orca/packages/DProf-19990108/t/test1.pl ============================================================================== --- trunk/orca/packages/DProf-19990108/t/test1.pl (original) +++ trunk/orca/packages/DProf-19990108/t/test1.pl 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,32 @@ +END { print "main:: the end\n" } +sub FOO::END { print "foo:: the end\n" } + + +sub foo { + my $x; + my $y; + print "in sub foo\n"; + for( $x = 1; $x < 100; ++$x ){ + bar(); + for( $y = 1; $y < 100; ++$y ){ + } + } +} + +sub bar { + my $x; + print "in sub bar\n"; + for( $x = 1; $x < 100; ++$x ){ + } +} + +sub baz { + print "in sub baz\n"; + bar(); + foo(); +} + +bar(); +baz(); +foo(); + Added: trunk/orca/packages/DProf-19990108/dprofpp.PL ============================================================================== --- trunk/orca/packages/DProf-19990108/dprofpp.PL (original) +++ trunk/orca/packages/DProf-19990108/dprofpp.PL 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,800 @@ +#!/usr/local/bin/perl + +use Config; +use File::Basename qw(&basename &dirname); + +# List explicitly here the variables you want Configure to +# generate. Metaconfig only looks for shell variables, so you +# have to mention them as if they were shell variables, not +# %Config entries. Thus you write +# $startperl +# to ensure Configure will look for $Config{startperl}. + +# This forces PL files to create target in same directory as PL file. +# This is so that make depend always knows where to find PL derivatives. +chdir(dirname($0)); +($file = basename($0)) =~ s/\.PL$//; +$file =~ s/\.pl$// + if ($Config{'osname'} eq 'VMS' or + $Config{'osname'} eq 'OS2'); # "case-forgiving" + +print "Pulling version from Makefile for dprofpp...\n"; +my $VERSION = 0; +open( MK, "){ + if( /^VERSION\s*=\s*(\d+)/ ){ + $VERSION = $1; + last; + } +} +close MK; +if( $VERSION == 0 ){ + die "Did not find VERSION in Makefile"; +} +print " version is ($VERSION).\n"; + +open OUT,">$file" or die "Can't create $file: $!"; + +print "Extracting $file (with variable substitutions)\n"; + +# In this section, perl variables will be expanded during extraction. +# You can use $Config{...} to use Configure variables. + +print OUT <<"!GROK!THIS!"; +$Config{'startperl'} + eval 'exec perl -S \$0 "\$@"' + if 0; + +require 5.003; + +my \$VERSION = $VERSION; + +!GROK!THIS! + +# In the following, perl variables are not expanded during extraction. + +print OUT <<'!NO!SUBS!'; +=head1 NAME + +dprofpp - display perl profile data + +=head1 SYNOPSIS + +dprofpp [B<-a>|B<-z>|B<-l>|B<-v>|B<-U>] [B<-s>|B<-r>|B<-u>] [B<-q>] [B<-F>] [B<-I|-E>] [B<-O cnt>] [B<-A>] [B<-R>] [B<-S>] [B<-g subroutine>] [profile] + +dprofpp B<-T> [B<-F>] [B<-g subroutine>] [profile] + +dprofpp B<-t> [B<-F>] [B<-g subroutine>] [profile] + +dprofpp B<-p script> [B<-Q>] [other opts] + +dprofpp B<-V> [profile] + +=head1 DESCRIPTION + +The I command interprets profile data produced by a profiler, such +as the Devel::DProf profiler. Dprofpp will read the file F and +will display the 15 subroutines which are using the most time. By default +the times for each subroutine are given exclusive of the times of their +child subroutines. + +To profile a Perl script run the perl interpreter with the B<-d> switch. So +to profile script F with Devel::DProf the following command should +be used. + + $ perl5 -d:DProf test.pl + +Then run dprofpp to analyze the profile. + + $ dprofpp -u + Total Elapsed Time = 1.67 Seconds + User Time = 0.61 Seconds + Exclusive Times + %Time Seconds #Calls sec/call Name + 52.4 0.320 2 0.1600 main::foo + 45.9 0.280 200 0.0014 main::bar + 0.00 0.000 1 0.0000 DynaLoader::import + 0.00 0.000 1 0.0000 main::baz + +The dprofpp tool can also run the profiler before analyzing the profile +data. The above two commands can be executed with one dprofpp command. + + $ dprofpp -u -p test.pl + +Consult L for a description of the raw profile. + +=head1 OPTIONS + +=over 5 + +=item B<-a> + +Sort alphabetically by subroutine names. + +=item B<-A> + +Count timing for autoloaded subroutine as timing for C<*::AUTOLOAD>. +Otherwise the time to autoload it is counted as time of the subroutine +itself (there is no way to separate autoload time from run time). + +This is going to be irrelevant with newer Perls. They will inform +C I the C switches to actual subroutine, +so a separate statistics for C will be collected no matter +whether this option is set. + +=item B<-R> + +Count anonymous subroutines defined in the same package separately. + +=item B<-E> + +(default) Display all subroutine times exclusive of child subroutine times. + +=item B<-F> + +Force the generation of fake exit timestamps if dprofpp reports that the +profile is garbled. This is only useful if dprofpp determines that the +profile is garbled due to missing exit timestamps. You're on your own if +you do this. Consult the BUGS section. + +=item B<-I> + +Display all subroutine times inclusive of child subroutine times. + +=item B<-l> + +Sort by number of calls to the subroutines. This may help identify +candidates for inlining. + +=item B<-O cnt> + +Show only I subroutines. The default is 15. + +=item B<-p script> + +Tells dprofpp that it should profile the given script and then interpret its +profile data. See B<-Q>. + +=item B<-Q> + +Used with B<-p> to tell dprofpp to quit after profiling the script, without +interpreting the data. + +=item B<-q> + +Do not display column headers. + +=item B<-r> + +Display elapsed real times rather than user+system times. + +=item B<-s> + +Display system times rather than user+system times. + +=item B<-T> + +Display subroutine call tree to stdout. Subroutine statistics are +not displayed. + +=item B<-t> + +Display subroutine call tree to stdout. Subroutine statistics are not +displayed. When a function is called multiple consecutive times at the same +calling level then it is displayed once with a repeat count. + +=item B<-S> + +Display I subroutine call tree to stdout. Statistics is +displayed for each branch of the tree. + +When a function is called multiple (I) +times in the same branch then all these calls go into one branch of +the next level. A repeat count is output together with combined +inclusive, exclusive and kids time. + +Branches are sorted w.r.t. inclusive time. + +=item B<-U> + +Do not sort. Display in the order found in the raw profile. + +=item B<-u> + +Display user times rather than user+system times. + +=item B<-V> + +Print dprofpp's version number and exit. If a raw profile is found then its +XS_VERSION variable will be displayed, too. + +=item B<-v> + +Sort by average time spent in subroutines during each call. This may help +identify candidates for inlining. + +=item B<-z> + +(default) Sort by amount of user+system time used. The first few lines +should show you which subroutines are using the most time. + +=item B<-g> C + +Ignore subroutines except C and whatever is called from it. + +=back + +=head1 ENVIRONMENT + +The environment variable B can be set to a string containing +options for dprofpp. You might use this if you prefer B<-I> over B<-E> or +if you want B<-F> on all the time. + +This was added fairly lazily, so there are some undesirable side effects. +Options on the commandline should override options in DPROFPP_OPTS--but +don't count on that in this version. + +=head1 BUGS + +Applications which call _exit() or exec() from within a subroutine +will leave an incomplete profile. See the B<-F> option. + +Any bugs in Devel::DProf, or any profiler generating the profile data, could +be visible here. See L. + +Mail bug reports and feature requests to the perl5-porters mailing list at +Fperl5-porters at perl.orgE>. Bug reports should include the +output of the B<-V> option. + +=head1 FILES + + dprofpp - profile processor + tmon.out - raw profile + +=head1 SEE ALSO + +L, L, times(2) + +=cut + +use Getopt::Std 'getopts'; +use Config '%Config'; + +Setup: { + my $options = 'O:g:lzaAvuTtqrRsUFEIp:QVS'; + + $Monfile = 'tmon.out'; + if( exists $ENV{DPROFPP_OPTS} ){ + my @tmpargv = @ARGV; + @ARGV = split( ' ', $ENV{DPROFPP_OPTS} ); + getopts( $options ); + if( @ARGV ){ + # there was a filename. + $Monfile = shift; + } + @ARGV = @tmpargv; + } + + getopts( $options ); + if( @ARGV ){ + # there was a filename, it overrides any earlier name. + $Monfile = shift; + } + +# -O cnt Specifies maximum number of subroutines to display. +# -a Sort by alphabetic name of subroutines. +# -z Sort by user+system time spent in subroutines. (default) +# -l Sort by number of calls to subroutines. +# -v Sort by average amount of time spent in subroutines. +# -T Show call tree. +# -t Show call tree, compressed. +# -q Do not print column headers. +# -u Use user time rather than user+system time. +# -s Use system time rather than user+system time. +# -r Use real elapsed time rather than user+system time. +# -U Do not sort subroutines. +# -E Sub times are reported exclusive of child times. (default) +# -I Sub times are reported inclusive of child times. +# -V Print dprofpp's version. +# -p script Specifies name of script to be profiled. +# -Q Used with -p to indicate the dprofpp should quit after +# profiling the script, without interpreting the data. +# -A count autoloaded to *AUTOLOAD +# -R count anonyms separately even if from the same package +# -g subr count only those who are SUBR or called from SUBR +# -S Create statistics for all the depths + + if( defined $opt_V ){ + my $fh = 'main::fh'; + print "$0 version: $VERSION\n"; + open( $fh, "<$Monfile" ) && do { + local $XS_VERSION = 'early'; + header($fh); + close( $fh ); + print "XS_VERSION: $XS_VERSION\n"; + }; + exit(0); + } + $cnt = $opt_O || 15; + $sort = 'by_time'; + $sort = 'by_ctime' if defined $opt_I; + $sort = 'by_calls' if defined $opt_l; + $sort = 'by_alpha' if defined $opt_a; + $sort = 'by_avgcpu' if defined $opt_v; + $incl_excl = 'Exclusive'; + $incl_excl = 'Inclusive' if defined $opt_I; + $whichtime = 'User+System'; + $whichtime = 'System' if defined $opt_s; + $whichtime = 'Real' if defined $opt_r; + $whichtime = 'User' if defined $opt_u; + + if( defined $opt_p ){ + my $prof = 'DProf'; + my $startperl = $Config{'startperl'}; + + $startperl =~ s/^#!//; # remove shebang + run_profiler( $opt_p, $prof, $startperl ); + $Monfile = 'tmon.out'; # because that's where it is + exit(0) if defined $opt_Q; + } + elsif( defined $opt_Q ){ + die "-Q is meaningful only when used with -p\n"; + } +} + +Main: { + my $monout = $Monfile; + my $fh = 'main::fh'; + local $names = {}; + local $times = {}; # times in hz + local $ctimes = {}; # Cumulative times in hz + local $calls = {}; + local $persecs = {}; # times in seconds + local $idkeys = []; + local $runtime; # runtime in seconds + my @a = (); + my $a; + local $rrun_utime = 0; # user time in hz + local $rrun_stime = 0; # system time in hz + local $rrun_rtime = 0; # elapsed run time in hz + local $rrun_ustime = 0; # user+system time in hz + local $hz = 0; + local $deep_times = {count => 0 , kids => {}, incl_time => 0}; + local $time_precision = 2; + local $overhead = 0; + + open( $fh, "<$monout" ) || die "Unable to open $monout\n"; + + header($fh); + + $rrun_ustime = $rrun_utime + $rrun_stime; + + $~ = 'STAT'; + if( ! $opt_q ){ + $^ = 'CSTAT_top'; + } + + parsestack( $fh, $names, $calls, $times, $ctimes, $idkeys ); + + settime( \$runtime, $hz ) unless $opt_g; + + exit(0) if $opt_T || $opt_t; + + if( $opt_v ){ + percalc( $calls, ($opt_I ? $ctimes : $times), $persecs, $idkeys ); + } + if( ! $opt_U ){ + @a = sort $sort @$idkeys; + $a = \@a; + } + else { + $a = $idkeys; + } + display( $runtime, $hz, $names, $calls, $times, $ctimes, $cnt, $a, + $deep_times); +} + + +# Sets $runtime to user, system, real, or user+system time. The +# result is given in seconds. +# +sub settime { + my( $runtime, $hz ) = @_; + + if( $opt_r ){ + $$runtime = ($rrun_rtime - $overhead - $over_rtime * $total_marks/$over_tests/2)/$hz; + } + elsif( $opt_s ){ + $$runtime = ($rrun_stime - $overhead - $over_stime * $total_marks/$over_tests/2)/$hz; + } + elsif( $opt_u ){ + $$runtime = ($rrun_utime - $overhead - $over_utime * $total_marks/$over_tests/2)/$hz; + } + else{ + $$runtime = ($rrun_ustime - $overhead - ($over_utime + $over_stime) * $total_marks/$over_tests/2)/$hz; + } + $$runtime = 0 unless $$runtime > 0; +} + +sub exclusives_in_tree { + my( $deep_times ) = @_; + my $kids_time = 0; + my $kid; + # When summing, take into account non-rounded-up kids time. + for $kid (keys %{$deep_times->{kids}}) { + $kids_time += $deep_times->{kids}{$kid}{incl_time}; + } + $kids_time = 0 unless $kids_time >= 0; + $deep_times->{excl_time} = $deep_times->{incl_time} - $kids_time; + $deep_times->{excl_time} = 0 unless $deep_times->{excl_time} >= 0; + for $kid (keys %{$deep_times->{kids}}) { + exclusives_in_tree($deep_times->{kids}{$kid}); + } + $deep_times->{incl_time} = 0 unless $deep_times->{incl_time} >= 0; + $deep_times->{kids_time} = $kids_time; +} + +sub kids_by_incl { $kids{$b}{incl_time} <=> $kids{$a}{excl_time} + or $a cmp $b } + +sub display_tree { + my( $deep_times, $name, $level ) = @_; + exclusives_in_tree($deep_times); + + my $kid; + local *kids = $deep_times->{kids}; # %kids + + my $time; + if (%kids) { + $time = sprintf '%.*fs = (%.*f + %.*f)', + $time_precision, $deep_times->{incl_time}/$hz, + $time_precision, $deep_times->{excl_time}/$hz, + $time_precision, $deep_times->{kids_time}/$hz; + } else { + $time = sprintf '%.*f', $time_precision, $deep_times->{incl_time}/$hz; + } + print ' ' x (2*$level), "$name x $deep_times->{count} \t${time}s\n" + if $deep_times->{count}; + + for $kid (sort kids_by_incl keys %kids) { + display_tree( $deep_times->{kids}{$kid}, $kid, $level + 1 ); + } +} + +# Report the times in seconds. +sub display { + my( $runtime, $hz, $names, $calls, $times, $ctimes, $cnt, + $idkeys, $deep_times ) = @_; + my( $x, $key, $s, $cs ); + #format: $ncalls, $name, $secs, $percall, $pcnt + + if ($opt_S) { + display_tree( $deep_times, 'toplevel', -1 ) + } else { + for( $x = 0; $x < @$idkeys; ++$x ){ + $key = $idkeys->[$x]; + $ncalls = $calls->{$key}; + $name = $names->{$key}; + $s = $times->{$key}/$hz; + $secs = sprintf("%.3f", $s ); + $cs = $ctimes->{$key}/$hz; + $csecs = sprintf("%.3f", $cs ); + $percall = sprintf("%.4f", $s/$ncalls ); + $cpercall = sprintf("%.4f", $cs/$ncalls ); + $pcnt = sprintf("%.2f", + $runtime? ((($opt_I ? $csecs : $secs) / $runtime) * 100.0): 0 ); + write; + $pcnt = $secs = $ncalls = $percall = ""; + write while( length $name ); + last unless --$cnt; + } + } +} + +sub move_keys { + my ($source, $dest) = @_; + my $kid; + + for $kid (keys %$source) { + if (exists $dest->{$kid}) { + $dest->{count} += $source->{count}; + $dest->{incl_time} += $source->{incl_time}; + move_keys($source->{kids},$dest->{kids}); + } else { + $dest->{$kid} = delete $source->{$kid}; + } + } +} + +sub add_to_tree { + my ($curdeep_times, $name, $t) = @_; + if ($name ne $curdeep_times->[-1]{name} and $opt_A) { + $name = $curdeep_times->[-1]{name}; + } + die "Shorted?!" unless @$curdeep_times >= 2; + $curdeep_times->[-2]{kids}{$name} = { count => 0 , kids => {}, + incl_time => 0, + } + unless exists $curdeep_times->[-2]{kids}{$name}; + my $entry = $curdeep_times->[-2]{kids}{$name}; + # Now transfer to the new node (could not do earlier, since name can change) + $entry->{count}++; + $entry->{incl_time} += $t - $curdeep_times->[-1]{enter_stamp}; + # Merge the kids? + move_keys($curdeep_times->[-1]->{kids},$entry->{kids}); + pop @$curdeep_times; +} + +sub parsestack { + my( $fh, $names, $calls, $times, $ctimes, $idkeys ) = @_; + my( $dir, $name ); + my( $t, $syst, $realt, $usert ); + my( $x, $z, $c, $id, $pack ); + my @stack = (); + my @tstack = (); + my $tab = 3; + my $in = 0; + + # remember last call depth and function name + my $l_in = $in; + my $l_name = ''; + my $repcnt = 0; + my $repstr = ''; + my $dprof_t = 0; + my $dprof_stamp; + my %cv_hash; + my $in_level = not defined $opt_g; # Level deep in report grouping + my $curdeep_times = [$deep_times]; + + my $over_per_call; + if ( $opt_u ) { $over_per_call = $over_utime } + elsif( $opt_s ) { $over_per_call = $over_stime } + elsif( $opt_r ) { $over_per_call = $over_rtime } + else { $over_per_call = $over_utime + $over_stime } + $over_per_call /= 2*$over_tests; # distribute over entry and exit + + while(<$fh>){ + next if /^#/; + last if /^PART/; + + chop; + if (/^&/) { + ($dir, $id, $pack, $name) = split; + if ($opt_R and ($name =~ /::(__ANON_|END)$/)) { + $name .= "($id)"; + } + $cv_hash{$id} = "$pack\::$name"; + next; + } + ($dir, $usert, $syst, $realt, $name) = split; + + my $ot = $t; + if ( $dir eq '/' ) { + $syst = $stack[-1][0]; + $usert = '&'; + $dir = '-'; + #warn("Inserted exit for $stack[-1][0].\n") + } + if (defined $realt) { # '+ times nam' '- times nam' or '@ incr' + if ( $opt_u ) { $t = $usert } + elsif( $opt_s ) { $t = $syst } + elsif( $opt_r ) { $t = $realt } + else { $t = $usert + $syst } + $t += $ot, next if $dir eq '@'; # Increments there + } else { + # "- id" or "- & name" + $name = defined $syst ? $syst : $cv_hash{$usert}; + } + + next unless $in_level or $name eq $opt_g or $dir eq '*'; + if ( $dir eq '-' or $dir eq '*' ) { + my $ename = $dir eq '*' ? $stack[-1][0] : $name; + $overhead += $over_per_call; + if ($name eq "Devel::DProf::write") { + $dprof_t += $t - $dprof_stamp; + next; + } elsif (defined $opt_g and $ename eq $opt_g) { + $in_level--; + } + add_to_tree($curdeep_times, $ename, + $t - $dprof_t - $overhead) if $opt_S; + exitstamp( \@stack, \@tstack, + $t - $dprof_t - $overhead, + $times, $ctimes, $ename, \$in, $tab, + $curdeep_times ); + } + next unless $in_level or $name eq $opt_g; + if( $dir eq '+' or $dir eq '*' ){ + if ($name eq "Devel::DProf::write") { + $dprof_stamp = $t; + next; + } elsif (defined $opt_g and $name eq $opt_g) { + $in_level++; + } + $overhead += $over_per_call; + if( $opt_T ){ + print ' ' x $in, "$name\n"; + $in += $tab; + } + elsif( $opt_t ){ + # suppress output on same function if the + # same calling level is called. + if ($l_in == $in and $l_name eq $name) { + $repcnt++; + } else { + $repstr = ' ('.++$repcnt.'x)' + if $repcnt; + print ' ' x $l_in, "$l_name$repstr\n" + if $l_name ne ''; + $repstr = ''; + $repcnt = 0; + $l_in = $in; + $l_name = $name; + } + $in += $tab; + } + if( ! defined $names->{$name} ){ + $names->{$name} = $name; + $times->{$name} = 0; + $ctimes->{$name} = 0; + push( @$idkeys, $name ); + } + $calls->{$name}++; + push @$curdeep_times, { kids => {}, + name => $name, + enter_stamp => $t - $dprof_t - $overhead, + } if $opt_S; + $x = [ $name, $t - $dprof_t - $overhead ]; + push( @stack, $x ); + + # my children will put their time here + push( @tstack, 0 ); + } elsif ($dir ne '-'){ + die "Bad profile: $_"; + } + } + if( $opt_t ){ + $repstr = ' ('.++$repcnt.'x)' if $repcnt; + print ' ' x $l_in, "$l_name$repstr\n"; + } + + if( @stack ){ + if( ! $opt_F ){ + warn "Garbled profile is missing some exit time stamps:\n"; + foreach $x (@stack) { + print $x->[0],"\n"; + } + die "Try rerunning dprofpp with -F.\n"; + # I don't want -F to be default behavior--yet + # 9/18/95 dmr + } + else{ + warn( "Faking " . scalar( @stack ) . " exit timestamp(s).\n"); + foreach $x ( reverse @stack ){ + $name = $x->[0]; + exitstamp( \@stack, \@tstack, + $t - $dprof_t - $overhead, $times, + $ctimes, $name, \$in, $tab, + $curdeep_times ); + add_to_tree($curdeep_times, $name, + $t - $dprof_t - $overhead) + if $opt_S; + } + } + } + if (defined $opt_g) { + $runtime = $ctimes->{$opt_g}/$hz; + $runtime = 0 unless $runtime > 0; + } +} + +sub exitstamp { + my($stack, $tstack, $t, $times, $ctimes, $name, $in, $tab, $deep) = @_; + my( $x, $c, $z ); + + $x = pop( @$stack ); + if( ! defined $x ){ + die "Garbled profile, missing an enter time stamp"; + } + if( $x->[0] ne $name ){ + if ($x->[0] =~ /::AUTOLOAD$/) { + if ($opt_A) { + $name = $x->[0]; + } + } elsif ( $opt_F ) { + warn( "Garbled profile, faking exit timestamp:\n\t$name => $x->[0].\n"); + $name = $x->[0]; + } else { + foreach $z (@stack, $x) { + print $z->[0],"\n"; + } + die "Garbled profile, unexpected exit time stamp"; + } + } + if( $opt_T || $opt_t ){ + $$in -= $tab; + } + # collect childtime + $c = pop( @$tstack ); + # total time this func has been active + $z = $t - $x->[1]; + $ctimes->{$name} += $z; + $times->{$name} += ($z > $c)? $z - $c: 0; + # pass my time to my parent + if( @$tstack ){ + $c = pop( @$tstack ); + push( @$tstack, $c + $z ); + } +} + + +sub header { + my $fh = shift; + chop($_ = <$fh>); + if( ! /^#fOrTyTwO$/ ){ + die "Not a perl profile"; + } + while(<$fh>){ + next if /^#/; + last if /^PART/; + eval; + } + $over_tests = 1 unless $over_tests; + $time_precision = length int ($hz - 1); # log ;-) +} + + +# Report avg time-per-function in seconds +sub percalc { + my( $calls, $times, $persecs, $idkeys ) = @_; + my( $x, $t, $n, $key ); + + for( $x = 0; $x < @$idkeys; ++$x ){ + $key = $idkeys->[$x]; + $n = $calls->{$key}; + $t = $times->{$key} / $hz; + $persecs->{$key} = $t ? $t / $n : 0; + } +} + + +# Runs the given script with the given profiler and the given perl. +sub run_profiler { + my $script = shift; + my $profiler = shift; + my $startperl = shift; + + system $startperl, "-d:$profiler", $script; + if( $? / 256 > 0 ){ + die "Failed: $startperl -d:$profiler $script: $!"; + } +} + + +sub by_time { $times->{$b} <=> $times->{$a} } +sub by_ctime { $ctimes->{$b} <=> $ctimes->{$a} } +sub by_calls { $calls->{$b} <=> $calls->{$a} } +sub by_alpha { $names->{$a} cmp $names->{$b} } +sub by_avgcpu { $persecs->{$b} <=> $persecs->{$a} } + + +format CSTAT_top = +Total Elapsed Time = @>>>>>>> Seconds +(($rrun_rtime - $overhead - $over_rtime * $total_marks/$over_tests/2) / $hz) + @>>>>>>>>>> Time = @>>>>>>> Seconds +$whichtime, $runtime +@<<<<<<<< Times +$incl_excl +%Time ExclSec CumulS #Calls sec/call Csec/c Name +. + +format STAT = + ^>>> ^>>>> ^>>>>> ^>>>>> ^>>>>> ^>>>>> ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$pcnt, $secs, $csecs, $ncalls, $percall, $cpercall, $name +. + +!NO!SUBS! + +close OUT or die "Can't close $file: $!"; +chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; +exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; Added: trunk/orca/packages/DProf-19990108/DProf.pm ============================================================================== --- trunk/orca/packages/DProf-19990108/DProf.pm (original) +++ trunk/orca/packages/DProf-19990108/DProf.pm 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,192 @@ +require 5.003; + +=head1 NAME + +Devel::DProf - a Perl code profiler + +=head1 SYNOPSIS + + perl5 -d:DProf test.pl + +=head1 DESCRIPTION + +The Devel::DProf package is a Perl code profiler. This will collect +information on the execution time of a Perl script and of the subs in that +script. This information can be used to determine which subroutines are +using the most time and which subroutines are being called most often. This +information can also be used to create an execution graph of the script, +showing subroutine relationships. + +To profile a Perl script run the perl interpreter with the B<-d> debugging +switch. The profiler uses the debugging hooks. So to profile script +F the following command should be used: + + perl5 -d:DProf test.pl + +When the script terminates (or when the output buffer is filled) the +profiler will dump the profile information to a file called +F. A tool like I can be used to interpret the +information which is in that profile. The following command will +print the top 15 subroutines which used the most time: + + dprofpp + +To print an execution graph of the subroutines in the script use the +following command: + + dprofpp -T + +Consult L for other options. + +=head1 PROFILE FORMAT + +The old profile is a text file which looks like this: + + #fOrTyTwO + $hz=100; + $XS_VERSION='DProf 19970606'; + # All values are given in HZ + $rrun_utime=2; $rrun_stime=0; $rrun_rtime=7 + PART2 + + 26 28 566822884 DynaLoader::import + - 26 28 566822884 DynaLoader::import + + 27 28 566822885 main::bar + - 27 28 566822886 main::bar + + 27 28 566822886 main::baz + + 27 28 566822887 main::bar + - 27 28 566822888 main::bar + [....] + +The first line is the magic number. The second line is the hertz value, or +clock ticks, of the machine where the profile was collected. The third line +is the name and version identifier of the tool which created the profile. +The fourth line is a comment. The fifth line contains three variables +holding the user time, system time, and realtime of the process while it was +being profiled. The sixth line indicates the beginning of the sub +entry/exit profile section. + +The columns in B are: + + sub entry(+)/exit(-) mark + app's user time at sub entry/exit mark, in ticks + app's system time at sub entry/exit mark, in ticks + app's realtime at sub entry/exit mark, in ticks + fully-qualified sub name, when possible + +With newer perls another format is used, which may look like this: + + #fOrTyTwO + $hz=10000; + $XS_VERSION='DProf 19971213'; + # All values are given in HZ + $over_utime=5917; $over_stime=0; $over_rtime=5917; + $over_tests=10000; + $rrun_utime=1284; $rrun_stime=0; $rrun_rtime=1284; + $total_marks=6; + + PART2 + @ 406 0 406 + & 2 main bar + + 2 + @ 456 0 456 + - 2 + @ 1 0 1 + & 3 main baz + + 3 + @ 141 0 141 + + 2 + @ 141 0 141 + - 2 + @ 1 0 1 + & 4 main foo + + 4 + @ 142 0 142 + + & Devel::DProf::write + @ 5 0 5 + - & Devel::DProf::write + +(with high value of $ENV{PERL_DPROF_TICKS}). + +New C<$over_*> values show the measured overhead of making $over_tests +calls to the profiler These values are used by the profiler to +subtract the overhead from the runtimes. + +The lines starting with C<@> mark time passed from the previous C<@> +line. The lines starting with C<&> introduce new subroutine I and +show the package and the subroutine name of this id. Lines starting +with C<+>, C<-> and C<*> mark entering and exit of subroutines by +Is, and C. + +The I C<+>- and C<->-lines are used to mark the overhead +related to writing to profiler-output file. + +=head1 AUTOLOAD + +When Devel::DProf finds a call to an C<&AUTOLOAD> subroutine it looks at the +C<$AUTOLOAD> variable to find the real name of the sub being called. See +L. + +=head1 ENVIRONMENT + +C sets size of output buffer in words. Defaults to 2**14. + +C sets number of ticks per second on some systems where +a replacement for times() is used. Defaults to the value of C macro. + +=head1 BUGS + +Builtin functions cannot be measured by Devel::DProf. + +With a newer Perl DProf relies on the fact that the numeric slot of +$DB::sub contains an address of a subroutine. Excessive manipulation +of this variable may overwrite this slot, as in + + $DB::sub = 'current_sub'; + ... + $addr = $DB::sub + 0; + +will set this numeric slot to numeric value of the string +C, i.e., to C<0>. This will cause a segfault on the exit +from this subroutine. Note that the first assignment above does not +change the numeric slot (it will I it as invalid, but will not +write over it). + +Mail bug reports and feature requests to the perl5-porters mailing list at +Fperl5-porters at perl.orgE>. + +=head1 SEE ALSO + +L, L, times(2) + +=cut + +# This sub is needed for calibration. +package Devel::DProf; + +sub NONESUCH_noxs { + return $Devel::DProf::VERSION; +} + +package DB; + +# +# As of perl5.003_20, &DB::sub stub is not needed (some versions +# even had problems if stub was redefined with XS version). +# + +# disable DB single-stepping +BEGIN { $single = 0; } + +# This sub is needed during startup. +sub DB { +# print "nonXS DBDB\n"; +} + +require DynaLoader; + at Devel::DProf::ISA = 'DynaLoader'; +$Devel::DProf::VERSION = '19990108'; # this version not authorized by + # Dean Roehrich. See "Changes" file. + +bootstrap Devel::DProf $Devel::DProf::VERSION; + +1; Added: trunk/orca/packages/DProf-19990108/Todo ============================================================================== --- trunk/orca/packages/DProf-19990108/Todo (original) +++ trunk/orca/packages/DProf-19990108/Todo 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,13 @@ +- work on test suite. +- localize the depth to guard against non-local exits. +Current overhead (with PERLDBf_NONAME) wrt non-debugging run (estimates): + 8% extra call frame on DB::sub + 7% output of subroutine data + 70% output of timing data (on OS/2, 35% with custom dprof_times()) +(Additional 17% are spent to write the output, but they are counted + and subtracted.) + +With compensation for DProf overhead all but some odd 12% are subtracted ?! + +- Calculate overhead/count for XS calls and Perl calls separately. +- goto &XSUB in pp_ctl.c; Added: trunk/orca/packages/DProf-19990108/MANIFEST ============================================================================== --- trunk/orca/packages/DProf-19990108/MANIFEST (original) +++ trunk/orca/packages/DProf-19990108/MANIFEST 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,23 @@ +Changes +DProf.pm +DProf.xs +MANIFEST +Makefile.PL +README +Todo +dprofpp.PL +t/V.pm verification lib for tests +t/test1.t +t/test1.v +t/test2.t +t/test2.v +t/test3.t +t/test3.v +t/test4.t fork test +t/test4.v +t/test5.t &bar as &bar(@_) test +t/test5.v +t/test6.t Nonlocal exit test +t/test6.v +test.pl test suite driver +t/test1.pl alternate test Added: trunk/orca/packages/DProf-19990108/Makefile.PL ============================================================================== --- trunk/orca/packages/DProf-19990108/Makefile.PL (original) +++ trunk/orca/packages/DProf-19990108/Makefile.PL 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,55 @@ +use ExtUtils::MakeMaker; +require 5.003; +die qq{ + +Your perl is too old for this version of DProf. The last version of +DProf that works for perls older than 5.004 is DProf-19960930 and +should be available from Dean Roehrich\'s directory on CPAN: + + CPAN/authors/id/DMR/ + +Please either upgrade your perl or get that older DProf from CPAN. + +} if $] < 5.004; + +if ($] < 5.005) { + $defines = ''; +} else { + $defines = '-DPERLDBf_NONAME=0x40 -DPERLDBf_GOTO=0x80 -DG_NODEBUG=32 -DPL_NEEDED'; +} + +$Verbose = 1; +WriteMakefile( + 'NAME' => 'Devel::DProf', + 'DISTNAME' => 'DProf', + 'VERSION_FROM' => 'DProf.pm', + 'clean' => {'FILES' => 'tmon.out t/tmon.out t/err dprofpp T/tmon.out'}, + 'EXE_FILES' => ['dprofpp'], + 'PL_FILES' => {'dprofpp.PL' => 'dprofpp'}, + 'XSPROTOARG' => '-noprototypes', + 'DEFINE' => $defines, + 'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz' }, +); + +sub MY::test_via_harness { "" } +#sub MY::test_via_harness { +# my( $self, $perl, $tests ) = @_; +# my $t = quotemeta( $tests ); +# my $res; +# +# $res = $self->MM::test_via_harness( $perl, $tests ); +# $res =~ s/^(\s+)/$1-/; +# $res =~ s/(&runtests)/\$\$switches $1/; +# $res =~ s/(; runtests)/; \$\$switches=q{-d:DProf}$1/; +# $res =~ s,$t,t/bug.t,; +# $res; +#} + +sub MY::test_via_script { + my( $self, $perl, $script ) = @_; + my $res; + + $res = $self->MM::test_via_script( $perl, $script ); + $res =~ s/(test.pl)/$1 -p $perl/; + $res; +} Added: trunk/orca/packages/DProf-19990108/Changes ============================================================================== --- trunk/orca/packages/DProf-19990108/Changes (original) +++ trunk/orca/packages/DProf-19990108/Changes 2003-01-07 23:20:27.000000000 -0800 @@ -0,0 +1,176 @@ +1999 Jan 8 + + Ilya Zakharevich: + Newer perls: Add PERL_POLLUTE and dTHR. + +1998 Nov 10 +This version of DProf should work with older Perls too, but to get +full benefits some patches to 5.004_55 are needed. Patches take effect +after new version of Perl is installed, and DProf recompiled. + +Without these patches the overhead of DProf is too big, thus the statistic +may be very skewed. + +Oct 98: + Ilya Zakharevich: + DProf.xs + - correct defstash to PL_defstash + - nonlocal exits work + dprofpp + - nonlocal exits work + DProf.pm + - documentation updated + t/test6.* + - added + +Nov-Dec 97: + Jason E. Holt and Ilya Zakharevich: + DProf.xs + - will not wait until completion to write the output, size of buffer + regulated by PERL_DPROF_BUFFER, default 2**14 words; + + Ilya Zakharevich: + dprofpp + - smarter in fixing garbled profiles; + - subtracts DProf output overhead, and suggested profiler overhead; + - new options -A, -R, -g subroutine, -S; + - handles 'goto' too; + DProf.xs + - 7x denser output (time separated from name, ids for subs); + - outputs report-write overhead; + - optional higher-resolution (currently OS/2 only, cannot grok VMS code); + - outputs suggested profiler overhead; + - handles 'goto' too; + - handles PERL_DPROF_TICKS (on OS/2, VMS may be easily modified too) + +Jun 14, 97 andreas koenig adds the compatibility notes to the README +and lets the Makefile.PL die on $] < 5.004. + +Jun 06, 97 andreas koenig applies a patch by gurusamy sarathy because +Dean is not available for comments at that time. The patch is available +from CPAN in the authors/id/GSAR directory for inspection. + +Sep 30, 96 dmr + DProf.xs + - added Ilya's patches to fix "&bar as &bar(@_)" bug. This also fixes + the coredumps people have seen when using this with 5.003+. + DProf.pm + - updated manpage + t/bug.t + - moved to test5 + Makefile.PL + - remove special case for bug.t + +Jun 26, 96 dmr + dprofpp.PL + - smarter r.e. to find VERSION in Makefile (for MM5.27). + DProf.pm + - updated manpage + DProf.xs + - keep pid of profiled process, if process forks then only the + parent is profiled. Added test4 for this. + +Mar 2, 96 dmr + README + - updated + dprofpp + - updated manpage, point to DProf for raw profile description. + DProf.pm + - update manpage, update raw profile description with XS_VERSION. + - update manpage for AUTOLOAD changes. + DProf.xs + - smart handling of &AUTOLOAD--looks in $AUTOLOAD for the sub name. + this fixes one problem with corrupt profiles. + +Feb 5, 96 dmr + dprofpp + - updated manpage + - added -E/-I for exclusive/inclusive times + - added DPROFPP_OPTS -- lazily + - added -p/-Q for profile-then-analyze + - added version check + dprofpp.PL + - pull dprofpp's version id from the makefile + DProf.pm + - added version to bootstrap + - updated doc + - updated doc, DProf and -w are now friendly to each other + DProf.xs + - using savepv + - added Tim's patch to check for DBsub, avoids -MDevel::DProf coredump + - turn off warnings during newXS("DB::sub") + tests + - added Tim's patch to ignore Loader::import in results + - added Tim's patch to aid readability of test?.v output + + +-- from those days when I kept a unique changelog for each module -- + +# Devel::DProf - a Perl code profiler +# 31oct95 +# +# changes/bugs fixed since 5apr95 version -dmr: +# -added VMS patches from CharlesB. +# -now open ./tmon.out in BOOT. +# changes/bugs fixed since 2apr95 version -dmr: +# -now mallocing an extra byte for the \0 :) +# changes/bugs fixed since 01mar95 version -dmr: +# -stringified code ref is used for name of anonymous sub. +# -include stash name with stringified code ref. +# -use perl.c's DBsingle and DBsub. +# -now using croak() and warn(). +# -print "timer is on" before turning timer on. +# -use safefree() instead of free(). +# -rely on PM to provide full path name to tmon.out. +# -print errno if unable to write tmon.out. +# changes/bugs fixed since 03feb95 version -dmr: +# -comments +# changes/bugs fixed since 31dec94 version -dmr: +# -added patches from AndyD. +# + +# Devel::DProf - a Perl code profiler +# 31oct95 +# +# changes/bugs fixed since 05apr95 version -dmr: +# - VMS-related prob; now let tmon.out name be handled in XS. +# changes/bugs fixed since 01mar95 version -dmr: +# - record $pwd and build pathname for tmon.out +# changes/bugs fixed since 03feb95 version -dmr: +# - fixed some doc bugs +# - added require 5.000 +# - added -w note to bugs section of pod +# changes/bugs fixed since 31dec94 version -dmr: +# - podified +# + + +# dprofpp - display perl profile data +# 31oct95 +# +# changes/bugs fixed since 7oct95 version -dmr: +# - PL'd +# changes/bugs fixed since 5apr95 version -dmr: +# - touch up handling of exit timestamps. +# - suggests -F when exit timestamps are missing. +# - added compressed execution tree patches from AchimB, put under -t. +# now -z is the default action; user+system time. +# - doc changes. +# changes/bugs fixed since 10feb95 version -dmr: +# - summary info is printed by default, opt_c is gone. +# - fixed some doc bugs +# - changed name to dprofpp +# changes/bugs fixed since 03feb95 version -dmr: +# - fixed division by zero. +# - replace many local()s with my(). +# - now prints user+system times by default +# now -u prints user time, -U prints unsorted. +# - fixed documentation +# - fixed output, to clarify that times are given in seconds. +# - can now fake exit timestamps if the profile is garbled. +# changes/bugs fixed since 17jun94 version -dmr: +# - podified. +# - correct old documentation flaws. +# - added AndyD's patches. +# + Added: trunk/orca/packages/DProf-19990108/test.pl ============================================================================== --- trunk/orca/packages/DProf-19990108/test.pl (original) +++ trunk/orca/packages/DProf-19990108/test.pl 2003-01-07 23:20:28.000000000 -0800 @@ -0,0 +1,79 @@ +# perl + +require 5.003; + +use Benchmark qw( timediff timestr ); +use Getopt::Std 'getopts'; +use Config '%Config'; +getopts('vI:p:'); + +# -v Verbose +# -I Add to @INC +# -p Name of perl binary + +unless (-r 'dprofpp' and -M 'dprofpp' <= -M 'dprofpp.PL') { + print STDERR "dprofpp out of date, extracting...\n"; + system 'perl', 'dprofpp.PL' and die 'perl dprofpp.PL: exit code $?, $!'; +} +die "Need dprofpp, could not make it" unless -r 'dprofpp'; + +chdir( 't' ) if -d 't'; + at tests = @ARGV ? @ARGV : sort <*.t *.v>; # glob-sort, for OS/2 + +$path_sep = $Config{path_sep} || ':'; +if( -d '../blib' ){ + unshift @INC, '../blib/arch', '../blib/lib'; +} +$perl5lib = $opt_I || join( $path_sep, @INC ); +$perl = $opt_p || $^X; + +if( $opt_v ){ + print "tests: @tests\n"; + print "perl: $perl\n"; + print "perl5lib: $perl5lib\n"; +} +if( $perl =~ m|^\./| ){ + # turn ./perl into ../perl, because of chdir(t) above. + $perl = ".$perl"; +} +if( ! -f $perl ){ die "Where's Perl?" } + +sub profile { + my $test = shift; + my @results; + local $ENV{PERL5LIB} = $perl5lib; + my $opt_d = '-d:DProf'; + + my $t_start = new Benchmark; + open( R, "$perl $opt_d $test |" ) || warn "$0: Can't run. $!\n"; + @results = ; + close R; + my $t_total = timediff( new Benchmark, $t_start ); + + if( $opt_v ){ + print "\n"; + print @results + } + + print timestr( $t_total, 'nop' ), "\n"; +} + + +sub verify { + my $test = shift; + + system $perl, '-I.', $test, $opt_v?'-v':'', '-p', $perl; +} + + +$| = 1; +while( @tests ){ + $test = shift @tests; + print $test . '.' x (20 - length $test); + if( $test =~ /t$/ ){ + profile $test; + } + else{ + verify $test; + } +} Added: trunk/orca/packages/DProf-19990108/README ============================================================================== --- trunk/orca/packages/DProf-19990108/README (original) +++ trunk/orca/packages/DProf-19990108/README 2003-01-07 23:20:28.000000000 -0800 @@ -0,0 +1,18 @@ +The Devel::DProf package is a Perl code profiler. This will collect +information on the execution time of a Perl script and of the subs in that +script. + +The dprofpp tool is included in this package. + +For more information consult the pod in DProf.pm. + +Compatibility Notes (by Gurusamy Sarathy and Andreas K?nig): +------------------------------------------------------------ + +DProf-19970614 will only work with 5.004 and above. DProf-19970930 +does work with 5.004 (stricly speaking), but it has a buggy testsuite +that will fail (correctly) on 5.004. + +If you're using 5.003, you need to go back to the previous version on +CPAN (DProf-19960930). DProf-19970606 and above will only work with +perl 5.004 and later. From blair at orcaware.com Wed Jan 8 10:47:33 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 8 Jan 2003 10:47:33 -0800 Subject: [Orca-checkins] rev 191 - in trunk/orca: . packages packages/Time-HiRes-1.42 packages/Time-HiRes-1.42/fallback Message-ID: <200301081847.h08IlXvX022727@orcaware.com> Author: blair Date: 2003-01-08 10:47:19 -0800 (Wed, 08 Jan 2003) New Revision: 191 Added: trunk/orca/packages/Time-HiRes-1.42/ trunk/orca/packages/Time-HiRes-1.42/fallback/ trunk/orca/packages/Time-HiRes-1.42/fallback/const-c.inc trunk/orca/packages/Time-HiRes-1.42/fallback/const-xs.inc Removed: trunk/orca/packages/Time-HiRes-1.41/ Modified: trunk/orca/INSTALL trunk/orca/configure.in trunk/orca/packages/Time-HiRes-1.42/Changes trunk/orca/packages/Time-HiRes-1.42/HiRes.pm trunk/orca/packages/Time-HiRes-1.42/HiRes.xs trunk/orca/packages/Time-HiRes-1.42/MANIFEST trunk/orca/packages/Time-HiRes-1.42/Makefile.PL Log: Upgrade Time::HiRes from 1.41 to 1.42. * configure.in: Bump Time::HiRes' version number to 1.42. * INSTALL (Determine which Perl modules need compiling and installing): Add Time::HiRes to the table of Perl modules and add instructions on how to download and install it. * packages/Time-HiRes-1.42: Renamed from packages/Time-HiRes-1.41. Directory contents updated from Time-HiRes-1.42.tar.gz. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-08 10:47:32.000000000 -0800 @@ -41,8 +41,8 @@ RRDTOOL_VER=1.000401 STORABLE_DIR=Storable-2.06 STORABLE_VER=2.06 -TIME_HIRES_DIR=Time-HiRes-1.41 -TIME_HIRES_VER=1.41 +TIME_HIRES_DIR=Time-HiRes-1.42 +TIME_HIRES_VER=1.42 AC_SUBST(COMPRESS_ZLIB_DIR) AC_SUBST(DATA_DUMPER_DIR) Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-01-08 10:47:32.000000000 -0800 @@ -176,6 +176,7 @@ Math::IntervalSearch >= 1.05 >= 1.05 1.05 RRDs >= 1.000401 >= 1.0.40 1.0.40 Storable >= 2.06 >= 2.06 2.06 + Time::HiRes No required by Orca 1.42 All seven of these modules are included with the Orca distribution in the packages directory. When you configure Orca in step 3), @@ -274,6 +275,17 @@ % make test % make install + Time::HiRes + + http://www.perl.com/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.42.tar.gz + + % gunzip -c Time-HiRes-1.42.tar.gz | tar xvf - + % cd Time-HiRes-1.42 + % perl Makefile.PL + % make + % make test + % make install + 5) Make Orca and any necessary Perl modules. To make Orca and these Perl modules run the following command: Copied: Time-HiRes-1.42 (from rev 190, trunk/orca/packages/Time-HiRes-1.41) Added: trunk/orca/packages/Time-HiRes-1.42/fallback/const-xs.inc ============================================================================== --- trunk/orca/packages/Time-HiRes-1.41/fallback/const-xs.inc (original) +++ trunk/orca/packages/Time-HiRes-1.42/fallback/const-xs.inc 2003-01-08 10:47:32.000000000 -0800 @@ -0,0 +1,88 @@ +void +constant(sv) + PREINIT: +#ifdef dXSTARG + dXSTARG; /* Faster if we have it. */ +#else + dTARGET; +#endif + STRLEN len; + int type; + IV iv; + /* NV nv; Uncomment this if you need to return NVs */ + /* const char *pv; Uncomment this if you need to return PVs */ + INPUT: + SV * sv; + const char * s = SvPV(sv, len); + PPCODE: + /* Change this to constant(aTHX_ s, len, &iv, &nv); + if you need to return both NVs and IVs */ + type = constant(aTHX_ s, len, &iv); + /* Return 1 or 2 items. First is error message, or undef if no error. + Second, if present, is found value */ + switch (type) { + case PERL_constant_NOTFOUND: + sv = sv_2mortal(newSVpvf("%s is not a valid Time::HiRes macro", s)); + PUSHs(sv); + break; + case PERL_constant_NOTDEF: + sv = sv_2mortal(newSVpvf( + "Your vendor has not defined Time::HiRes macro %s, used", s)); + PUSHs(sv); + break; + case PERL_constant_ISIV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHi(iv); + break; + /* Uncomment this if you need to return NOs + case PERL_constant_ISNO: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHs(&PL_sv_no); + break; */ + /* Uncomment this if you need to return NVs + case PERL_constant_ISNV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHn(nv); + break; */ + /* Uncomment this if you need to return PVs + case PERL_constant_ISPV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHp(pv, strlen(pv)); + break; */ + /* Uncomment this if you need to return PVNs + case PERL_constant_ISPVN: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHp(pv, iv); + break; */ + /* Uncomment this if you need to return SVs + case PERL_constant_ISSV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHs(sv); + break; */ + /* Uncomment this if you need to return UNDEFs + case PERL_constant_ISUNDEF: + break; */ + /* Uncomment this if you need to return UVs + case PERL_constant_ISUV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHu((UV)iv); + break; */ + /* Uncomment this if you need to return YESs + case PERL_constant_ISYES: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHs(&PL_sv_yes); + break; */ + default: + sv = sv_2mortal(newSVpvf( + "Unexpected return type %d while processing Time::HiRes macro %s, used", + type, s)); + PUSHs(sv); + } Added: trunk/orca/packages/Time-HiRes-1.42/fallback/const-c.inc ============================================================================== --- trunk/orca/packages/Time-HiRes-1.41/fallback/const-c.inc (original) +++ trunk/orca/packages/Time-HiRes-1.42/fallback/const-c.inc 2003-01-08 10:47:32.000000000 -0800 @@ -0,0 +1,202 @@ +#define PERL_constant_NOTFOUND 1 +#define PERL_constant_NOTDEF 2 +#define PERL_constant_ISIV 3 +#define PERL_constant_ISNO 4 +#define PERL_constant_ISNV 5 +#define PERL_constant_ISPV 6 +#define PERL_constant_ISPVN 7 +#define PERL_constant_ISSV 8 +#define PERL_constant_ISUNDEF 9 +#define PERL_constant_ISUV 10 +#define PERL_constant_ISYES 11 + +#ifndef NVTYPE +typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ +#endif +#ifndef aTHX_ +#define aTHX_ /* 5.6 or later define this for threading support. */ +#endif +#ifndef pTHX_ +#define pTHX_ /* 5.6 or later define this for threading support. */ +#endif + +static int +constant_11 (pTHX_ const char *name, IV *iv_return) { + /* When generated this function returned values for the list of names given + here. However, subsequent manual editing may have added or removed some. + ITIMER_PROF ITIMER_REAL d_getitimer d_nanosleep d_setitimer */ + /* Offset 7 gives the best switch position. */ + switch (name[7]) { + case 'P': + if (memEQ(name, "ITIMER_PROF", 11)) { + /* ^ */ +#ifdef ITIMER_PROF + *iv_return = ITIMER_PROF; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'R': + if (memEQ(name, "ITIMER_REAL", 11)) { + /* ^ */ +#ifdef ITIMER_REAL + *iv_return = ITIMER_REAL; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'i': + if (memEQ(name, "d_getitimer", 11)) { + /* ^ */ +#ifdef HAS_GETITIMER + *iv_return = 1; + return PERL_constant_ISIV; +#else + *iv_return = 0; + return PERL_constant_ISIV; +#endif + } + if (memEQ(name, "d_setitimer", 11)) { + /* ^ */ +#ifdef HAS_SETITIMER + *iv_return = 1; + return PERL_constant_ISIV; +#else + *iv_return = 0; + return PERL_constant_ISIV; +#endif + } + break; + case 'l': + if (memEQ(name, "d_nanosleep", 11)) { + /* ^ */ +#ifdef HAS_NANOSLEEP + *iv_return = 1; + return PERL_constant_ISIV; +#else + *iv_return = 0; + return PERL_constant_ISIV; +#endif + } + break; + } + return PERL_constant_NOTFOUND; +} + +static int +constant (pTHX_ const char *name, STRLEN len, IV *iv_return) { + /* Initially switch on the length of the name. */ + /* When generated this function returned values for the list of names given + in this section of perl code. Rather than manually editing these functions + to add or remove constants, which would result in this comment and section + of code becoming inaccurate, we recommend that you edit this section of + code, and use it to regenerate a new set of constant functions which you + then use to replace the originals. + + Regenerate these constant functions by feeding this entire source file to + perl -x + +#!/usr/local/bin/perl5.8.0 -w +use ExtUtils::Constant qw (constant_types C_constant XS_constant); + +my $types = {map {($_, 1)} qw(IV)}; +my @names = (qw(ITIMER_PROF ITIMER_REAL ITIMER_REALPROF ITIMER_VIRTUAL), + {name=>"d_getitimer", type=>"IV", macro=>"HAS_GETITIMER", value=>"1", default=>["IV", "0"]}, + {name=>"d_gettimeofday", type=>"IV", macro=>"HAS_GETTIMEOFDAY", value=>"1", default=>["IV", "0"]}, + {name=>"d_nanosleep", type=>"IV", macro=>"HAS_NANOSLEEP", value=>"1", default=>["IV", "0"]}, + {name=>"d_setitimer", type=>"IV", macro=>"HAS_SETITIMER", value=>"1", default=>["IV", "0"]}, + {name=>"d_ualarm", type=>"IV", macro=>"HAS_UALARM", value=>"1", default=>["IV", "0"]}, + {name=>"d_usleep", type=>"IV", macro=>"HAS_USLEEP", value=>"1", default=>["IV", "0"]}); + +print constant_types(); # macro defs +foreach (C_constant ("Time::HiRes", 'constant', 'IV', $types, undef, 3, @names) ) { + print $_, "\n"; # C constant subs +} +print "#### XS Section:\n"; +print XS_constant ("Time::HiRes", $types); +__END__ + */ + + switch (len) { + case 8: + /* Names all of length 8. */ + /* d_ualarm d_usleep */ + /* Offset 7 gives the best switch position. */ + switch (name[7]) { + case 'm': + if (memEQ(name, "d_ualarm", 8)) { + /* ^ */ +#ifdef HAS_UALARM + *iv_return = 1; + return PERL_constant_ISIV; +#else + *iv_return = 0; + return PERL_constant_ISIV; +#endif + } + break; + case 'p': + if (memEQ(name, "d_usleep", 8)) { + /* ^ */ +#ifdef HAS_USLEEP + *iv_return = 1; + return PERL_constant_ISIV; +#else + *iv_return = 0; + return PERL_constant_ISIV; +#endif + } + break; + } + break; + case 11: + return constant_11 (aTHX_ name, iv_return); + break; + case 14: + /* Names all of length 14. */ + /* ITIMER_VIRTUAL d_gettimeofday */ + /* Offset 6 gives the best switch position. */ + switch (name[6]) { + case '_': + if (memEQ(name, "ITIMER_VIRTUAL", 14)) { + /* ^ */ +#ifdef ITIMER_VIRTUAL + *iv_return = ITIMER_VIRTUAL; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'i': + if (memEQ(name, "d_gettimeofday", 14)) { + /* ^ */ +#ifdef HAS_GETTIMEOFDAY + *iv_return = 1; + return PERL_constant_ISIV; +#else + *iv_return = 0; + return PERL_constant_ISIV; +#endif + } + break; + } + break; + case 15: + if (memEQ(name, "ITIMER_REALPROF", 15)) { +#ifdef ITIMER_REALPROF + *iv_return = ITIMER_REALPROF; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + } + return PERL_constant_NOTFOUND; +} + Modified: trunk/orca/packages/Time-HiRes-1.42/HiRes.xs ============================================================================== --- trunk/orca/packages/Time-HiRes-1.41/HiRes.xs (original) +++ trunk/orca/packages/Time-HiRes-1.42/HiRes.xs 2003-01-08 10:47:32.000000000 -0800 @@ -98,77 +98,14 @@ # undef ITIMER_REALPROF #endif -static IV -constant(char *name, int arg) -{ - errno = 0; - switch (*name) { - case 'd': - if (strEQ(name, "d_getitimer")) -#ifdef HAS_GETITIMER - return 1; -#else - return 0; -#endif - if (strEQ(name, "d_nanosleep")) -#ifdef HAS_NANOSLEEP - return 1; -#else - return 0; -#endif - if (strEQ(name, "d_setitimer")) -#ifdef HAS_SETITIMER - return 1; -#else - return 0; -#endif - if (strEQ(name, "d_ualarm")) -#ifdef HAS_UALARM - return 1; -#else - return 0; -#endif - if (strEQ(name, "d_usleep")) -#ifdef HAS_USLEEP - return 1; -#else - return 0; +/* 5.004 doesn't define PL_sv_undef */ +#ifndef ATLEASTFIVEOHOHFIVE +#ifndef PL_sv_undef +#define PL_sv_undef sv_undef #endif - break; - case 'I': - if (strEQ(name, "ITIMER_REAL")) -#ifdef ITIMER_REAL - return ITIMER_REAL; -#else - goto not_there; -#endif - if (strEQ(name, "ITIMER_REALPROF")) -#ifdef ITIMER_REALPROF - return ITIMER_REALPROF; -#else - goto not_there; #endif - if (strEQ(name, "ITIMER_VIRTUAL")) -#ifdef ITIMER_VIRTUAL - return ITIMER_VIRTUAL; -#else - goto not_there; -#endif - if (strEQ(name, "ITIMER_PROF")) -#ifdef ITIMER_PROF - return ITIMER_PROF; -#else - goto not_there; -#endif - break; - } - errno = EINVAL; - return 0; -not_there: - errno = ENOENT; - return 0; -} +#include "const-c.inc" #if !defined(HAS_GETTIMEOFDAY) && defined(WIN32) #define HAS_GETTIMEOFDAY @@ -699,10 +636,7 @@ #endif #endif -IV -constant(name, arg) - char * name - int arg +INCLUDE: const-xs.inc #if defined(HAS_USLEEP) && defined(HAS_GETTIMEOFDAY) Modified: trunk/orca/packages/Time-HiRes-1.42/HiRes.pm ============================================================================== --- trunk/orca/packages/Time-HiRes-1.41/HiRes.pm (original) +++ trunk/orca/packages/Time-HiRes-1.42/HiRes.pm 2003-01-08 10:47:32.000000000 -0800 @@ -15,18 +15,16 @@ d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer d_nanosleep); -$VERSION = '1.41'; +$VERSION = '1.42'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; sub AUTOLOAD { my $constname; - ($constname= $AUTOLOAD) =~ s/.*:://; - my $val = constant($constname, @_ ? $_[0] : 0); - if ($!) { - my ($pack,$file,$line) = caller; - die "Your vendor has not defined Time::HiRes macro $constname, used at $file line $line.\n"; - } + ($constname = $AUTOLOAD) =~ s/.*:://; + die "&Time::HiRes::constant not defined" if $constname eq 'constant'; + my ($error, $val) = constant($constname); + if ($error) { die $error; } { no strict 'refs'; *$AUTOLOAD = sub { $val }; Modified: trunk/orca/packages/Time-HiRes-1.42/MANIFEST ============================================================================== --- trunk/orca/packages/Time-HiRes-1.41/MANIFEST (original) +++ trunk/orca/packages/Time-HiRes-1.42/MANIFEST 2003-01-08 10:47:32.000000000 -0800 @@ -1,4 +1,6 @@ Changes Time::HiRes extension +fallback/const-c.inc Fallback code for constants +fallback/const-xs.inc Fallback code for constants hints/dynixptx.pl Hints for Time::HiRes for named architecture hints/sco.pl Hints for Time::HiRes for named architecture HiRes.pm Time::HiRes extension Modified: trunk/orca/packages/Time-HiRes-1.42/Makefile.PL ============================================================================== --- trunk/orca/packages/Time-HiRes-1.41/Makefile.PL (original) +++ trunk/orca/packages/Time-HiRes-1.42/Makefile.PL 2003-01-08 10:47:32.000000000 -0800 @@ -33,6 +33,13 @@ $^O eq 'VMS' ? "[$catdir]" : $catdir; } +sub my_catfile { + shift; + return join(my_dirsep, @_) unless $^O eq 'VMS'; + my $file = pop; + return my_catdir (undef, @_) . $file; +} + sub my_updir { shift; $^O eq 'VMS' ? "-" : ".."; @@ -43,12 +50,14 @@ if ($@) { *File::Spec::catdir = \&my_catdir; *File::Spec::updir = \&my_updir; + *File::Spec::catfile = \&my_catfile; } } # Avoid 'used only once' warnings. my $nop1 = *File::Spec::catdir; my $nop2 = *File::Spec::updir; +my $nop3 = *File::Spec::catfile; # if you have 5.004_03 (and some slightly older versions?), xsubpp # tries to generate line numbers in the C code generated from the .xs. @@ -396,11 +405,40 @@ 'SUFFIX' => 'gz', }, clean => { FILES => "xdefine" }, + realclean => {FILES=> 'const-c.inc const-xs.inc'}, ); WriteMakefile(@makefileopts); } +sub doConstants { + if (eval {require ExtUtils::Constant; 1}) { + my @names = (qw(ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF + ITIMER_REALPROF)); + foreach (qw (d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer + d_nanosleep)) { + my $macro = $_; + $macro =~ s/d_(.*)/HAS_\U$1/; + push @names, {name => $_, macro => $macro, value => 1, + default => ["IV", "0"]}; + } + ExtUtils::Constant::WriteConstants( + NAME => 'Time::HiRes', + NAMES => \@names, + ); + } else { + foreach my $file ('const-c.inc', 'const-xs.inc') { + my $fallback = File::Spec->catfile('fallback', $file); + local $/; + open IN, "<$fallback" or die "Can't open $fallback: $!"; + open OUT, ">$file" or die "Can't open $file: $!"; + print OUT or die $!; + close OUT or die "Can't close $file: $!"; + close IN or die "Can't close $fallback: $!"; + } + } +} + sub main { print "Configuring Time::HiRes...\n"; @@ -411,6 +449,7 @@ unixinit(); } doMakefile; + doConstants; my $make = $Config{'make'} || "make"; unless ($ENV{PERL_CORE}) { print < Author: blair Date: 2003-01-08 10:49:04 -0800 (Wed, 08 Jan 2003) New Revision: 192 Modified: trunk/orca/INSTALL Log: * INSTALL (Determine which Perl modules need compiling and installing): Fix typo. Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-01-08 10:49:11.000000000 -0800 @@ -176,7 +176,7 @@ Math::IntervalSearch >= 1.05 >= 1.05 1.05 RRDs >= 1.000401 >= 1.0.40 1.0.40 Storable >= 2.06 >= 2.06 2.06 - Time::HiRes No required by Orca 1.42 + Time::HiRes Not required by Orca 1.42 All seven of these modules are included with the Orca distribution in the packages directory. When you configure Orca in step 3), From blair at orcaware.com Wed Jan 8 13:04:37 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 8 Jan 2003 13:04:37 -0800 Subject: [Orca-checkins] rev 193 - in trunk/orca: . packages Message-ID: <200301082104.h08L4bhn005380@orcaware.com> Author: blair Date: 2003-01-08 13:04:27 -0800 (Wed, 08 Jan 2003) New Revision: 193 Modified: trunk/orca/INSTALL trunk/orca/packages/Makefile.in Log: By default, pass UNINST=1 down to the Perl Makefile's so that any old installed Perl modules are properly deleted. Otherwise, the Perl installation may have the old and new modules installed and due to Perl's module search order, Perl may use the older module instead of the newer installed module. * INSTALL (Install any necessary Perl modules): Describe that UNINST=1 is passed to the Perl Makefile's and how to install the modules without deleting the old version. * packages/Makefile.in: Pass UNINST="$(UNINST)" to all Perl Makefile's. Allows for overriding from make's command line via "make install_modules UNINST=0". Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-01-08 13:04:36.000000000 -0800 @@ -306,6 +306,17 @@ % make install_modules + This command will pass UNINST=1 down to the Perl Makefile's so + that any old installed Perl modules are properly deleted. + Otherwise, the Perl installation may have the old and new modules + installed and due to Perl's module search order, Perl may use the + older module instead of the newer installed module. + + If you do not wish to delete older Perl modules, then run this + command: + + % make install_modules UNINST=0 + 8) Doing an upgrade from Orca 0.23 or older? Follow these steps. Due to various changes to Orca between releases, many of the RRD, Modified: trunk/orca/packages/Makefile.in ============================================================================== --- trunk/orca/packages/Makefile.in (original) +++ trunk/orca/packages/Makefile.in 2003-01-08 13:04:36.000000000 -0800 @@ -3,6 +3,13 @@ PERL = @PERL@ CFLAGS = @CFLAGS@ +# By default, pass UNINST=1 down to the Perl Makefile's so that any +# old installed Perl modules are properly deleted. Otherwise, the +# Perl installation may have the old and new modules installed and and +# due to Perl's module search order, Perl may use the older module +# instead of the newer installed module. +UNINST = 1 + compress_zlib_dir = @COMPRESS_ZLIB_DIR@ data_dumper_dir = @DATA_DUMPER_DIR@ date_parse_dir = @DATE_PARSE_DIR@ @@ -192,28 +199,28 @@ install_modules: $(INSTALL_PERL_TARGETS) install_perl_compress_zlib: make_compress_zlib - cd $(compress_zlib_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install + cd $(compress_zlib_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install install_perl_data_dumper: $(data_dumper_dir)/Makefile - cd $(data_dumper_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install + cd $(data_dumper_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install install_perl_date_parse: $(date_parse_dir)/Makefile - cd $(date_parse_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install + cd $(date_parse_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install install_perl_devel_dprof: $(devel_dprof_dir)/Makefile - cd $(devel_dprof_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install + cd $(devel_dprof_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install install_perl_digest_md5: $(digest_md5_dir)/Makefile - cd $(digest_md5_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install + cd $(digest_md5_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install install_perl_math_intervalsearch: $(math_intervalsearch_dir)/Makefile - cd $(math_intervalsearch_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install + cd $(math_intervalsearch_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install install_perl_rrdtool: make_rrdtool - cd $(rrdtool_dir)/perl-shared && $(MAKE) OPTIMIZE="$(CFLAGS)" install + cd $(rrdtool_dir)/perl-shared && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install install_perl_storable: $(storable_dir)/Makefile - cd $(storable_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" install + cd $(storable_dir) && $(MAKE) OPTIMIZE="$(CFLAGS)" UNINST="$(UNINST)" install clean: $(CLEAN_TARGETS) From blair at orcaware.com Wed Jan 8 20:13:06 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 8 Jan 2003 20:13:06 -0800 Subject: [Orca-checkins] rev 194 - in trunk/orca/data_gatherers: procallator orca_services Message-ID: <200301090413.h094D6mg013416@orcaware.com> Author: blair Date: 2003-01-08 20:12:55 -0800 (Wed, 08 Jan 2003) New Revision: 194 Modified: trunk/orca/data_gatherers/orca_services/orca_services.cfg.in trunk/orca/data_gatherers/procallator/procallator.cfg Log: * data_gatherers/orca_services/orca_services.cfg.in, * data_gatherers/procallator/procallator.cfg: The Orca configuration parameter `date_format' was removed in Orca 0.27b1. No longer use it in the supplied Orca configuration files. Modified: trunk/orca/data_gatherers/procallator/procallator.cfg ============================================================================== --- trunk/orca/data_gatherers/procallator/procallator.cfg (original) +++ trunk/orca/data_gatherers/procallator/procallator.cfg 2003-01-08 20:13:04.000000000 -0800 @@ -53,7 +53,6 @@ find_files /usr/local/var/orca/procallator/(.*)/(?:(?:procallator)|(?:proccol))-\d{4}-\d{2}-\d{2}(?:\.(?:Z|gz|bz2))? column_description first_line date_source column_name timestamp -date_format %s interval 300 reopen 1 filename_compare sub { Modified: trunk/orca/data_gatherers/orca_services/orca_services.cfg.in ============================================================================== --- trunk/orca/data_gatherers/orca_services/orca_services.cfg.in (original) +++ trunk/orca/data_gatherers/orca_services/orca_services.cfg.in 2003-01-08 20:13:05.000000000 -0800 @@ -58,7 +58,6 @@ find_files @VAR_DIR@/orca_services/(.*)/(?:(?:orca_services)|(?:percol))-\d{4}-\d{2}-\d{2}(?:\.(?:Z|gz|bz2))? column_description first_line date_source column_name timestamp -date_format %s interval 300 reopen 1 filename_compare sub { From sean at seanoneill.info Fri Jan 17 07:29:08 2003 From: sean at seanoneill.info (sean at seanoneill.info) Date: Fri, 17 Jan 2003 07:29:08 -0800 Subject: [Orca-checkins] rev 195 - trunk/orca/lib/Orca Message-ID: <200301171529.h0HFT87H025580@orcaware.com> Author: sean at seanoneill.info Date: 2003-01-17 07:28:51 -0800 (Fri, 17 Jan 2003) New Revision: 195 Modified: trunk/orca/lib/Orca/Constants.pm Log: * lib/Orca/Constants.pm: modified so that the hourly graphs now display 3 hours worth of data rather then the default 1.5 hours. Modified: trunk/orca/lib/Orca/Constants.pm ============================================================================== --- trunk/orca/lib/Orca/Constants.pm (original) +++ trunk/orca/lib/Orca/Constants.pm 2003-01-17 07:29:07.000000000 -0800 @@ -75,7 +75,7 @@ BEGIN { @CONST_IMAGE_PLOT_TYPES = qw(hourly daily weekly monthly quarterly yearly); %CONST_IMAGE_PLOT_INFO = - ('hourly' => [$RRA_PDP_COUNTS[0], 1.5*60*60], # 18 data points + ('hourly' => [$RRA_PDP_COUNTS[0], 3*60*60], # 36 data points 'daily' => [$RRA_PDP_COUNTS[0], 1.5*DAY_SECONDS], # 432 data points 'weekly' => [$RRA_PDP_COUNTS[1], 10 *DAY_SECONDS], # 480 data points 'monthly' => [$RRA_PDP_COUNTS[2], 40 *DAY_SECONDS], # 480 data points From blair at orcaware.com Sun Jan 19 19:54:55 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Sun, 19 Jan 2003 19:54:55 -0800 Subject: [Orca-checkins] rev 196 - in trunk/orca: . packages packages/Digest-MD5-2.23 packages/Digest-MD5-2.23/t Message-ID: <200301200354.h0K3stau019987@orcaware.com> Author: blair Date: 2003-01-19 19:54:39 -0800 (Sun, 19 Jan 2003) New Revision: 196 Added: trunk/orca/packages/Digest-MD5-2.23/ Removed: trunk/orca/packages/Digest-MD5-2.22/ Modified: trunk/orca/INSTALL trunk/orca/configure.in trunk/orca/packages/Digest-MD5-2.23/Changes trunk/orca/packages/Digest-MD5-2.23/MD5.pm trunk/orca/packages/Digest-MD5-2.23/Makefile.PL trunk/orca/packages/Digest-MD5-2.23/t/files.t Log: Upgrade Digest::MD5 from 2.22 to 2.23 and require the new version for Orca. * INSTALL: Update all references to Digest::MD5's version number from 2.22 to 2.23. * configure.in: Bump Digest::MD5's version number to 2.23. * packages/Digest-MD5-2.23: Renamed from packages/Digest-MD5-2.22. Directory contents updated from Digest-MD5-2.23.tar.gz. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-01-19 19:54:53.000000000 -0800 @@ -33,8 +33,8 @@ DATE_PARSE_VER=2.24 DEVEL_DPROF_DIR=DProf-19990108 DEVEL_DPROF_VER=19990108 -DIGEST_MD5_DIR=Digest-MD5-2.22 -DIGEST_MD5_VER=2.22 +DIGEST_MD5_DIR=Digest-MD5-2.23 +DIGEST_MD5_VER=2.23 MATH_INTERVALSEARCH_DIR=Math-Interpolate-1.05 MATH_INTERVALSEARCH_VER=1.05 RRDTOOL_DIR=rrdtool-1.0.40 Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-01-19 19:54:54.000000000 -0800 @@ -172,7 +172,7 @@ Data::Dumper >= 2.101 >= 2.101 2.101 Date::Parse Not required by Orca 2.24 Devel::DProf Not required by Orca 19990108 - Digest::MD5 >= 2.22 >= 2.22 2.22 + Digest::MD5 >= 2.23 >= 2.23 2.23 Math::IntervalSearch >= 1.05 >= 1.05 1.05 RRDs >= 1.000401 >= 1.0.40 1.0.40 Storable >= 2.06 >= 2.06 2.06 @@ -226,10 +226,10 @@ Digest::MD5 - http://www.perl.com/CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.22.tar.gz + http://www.perl.com/CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.23.tar.gz - % gunzip -c Digest-MD5-2.22.tar.gz | tar xvf - - % cd Digest-MD5-2.22 + % gunzip -c Digest-MD5-2.23.tar.gz | tar xvf - + % cd Digest-MD5-2.23 % perl Makefile.PL % make % make test Copied: Digest-MD5-2.23 (from rev 195, trunk/orca/packages/Digest-MD5-2.22) Modified: trunk/orca/packages/Digest-MD5-2.23/MD5.pm ============================================================================== --- trunk/orca/packages/Digest-MD5-2.22/MD5.pm (original) +++ trunk/orca/packages/Digest-MD5-2.23/MD5.pm 2003-01-19 19:54:54.000000000 -0800 @@ -3,7 +3,7 @@ use strict; use vars qw($VERSION @ISA @EXPORT_OK); -$VERSION = '2.22'; # $Date: 2003/01/05 00:56:14 $ +$VERSION = '2.23'; # $Date: 2003/01/19 04:42:15 $ require Exporter; *import = \&Exporter::import; Modified: trunk/orca/packages/Digest-MD5-2.23/t/files.t ============================================================================== --- trunk/orca/packages/Digest-MD5-2.22/t/files.t (original) +++ trunk/orca/packages/Digest-MD5-2.23/t/files.t 2003-01-19 19:54:54.000000000 -0800 @@ -20,26 +20,26 @@ my $EXPECT; if (ord "A" == 193) { # EBCDIC $EXPECT = < 'perl') if $] >= 5.008; WriteMakefile( 'NAME' => 'Digest::MD5', Modified: trunk/orca/packages/Digest-MD5-2.23/Changes ============================================================================== --- trunk/orca/packages/Digest-MD5-2.22/Changes (original) +++ trunk/orca/packages/Digest-MD5-2.23/Changes 2003-01-19 19:54:54.000000000 -0800 @@ -1,4 +1,13 @@ -2002-03-04 Gisle Aas +2003-01-18 Gisle Aas + + Release 2.23 + + Override INSTALLDIRS for 5.8 as suggested by + Guido Ostkamp . + + + +2003-01-04 Gisle Aas Release 2.22. From sean at seanoneill.info Sun Jan 19 20:24:27 2003 From: sean at seanoneill.info (sean at seanoneill.info) Date: Sun, 19 Jan 2003 20:24:27 -0800 Subject: [Orca-checkins] rev 197 - in trunk/orca: lib lib/SE lib/SE/3.2.1 lib/SE/3.3 data_gatherers/orcallator Message-ID: <200301200424.h0K4OR3U020487@orcaware.com> Author: sean at seanoneill.info Date: 2003-01-19 20:24:17 -0800 (Sun, 19 Jan 2003) New Revision: 197 Added: trunk/orca/lib/SE/ trunk/orca/lib/SE/3.2.1/ trunk/orca/lib/SE/3.2.1/orca_p_vmstat_class.se trunk/orca/lib/SE/3.3/ trunk/orca/lib/SE/3.3/orca_p_vmstat_class.se Modified: trunk/orca/data_gatherers/orcallator/orcallator.cfg.in trunk/orca/data_gatherers/orcallator/orcallator.se trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in trunk/orca/lib/Makefile.in Log: * Added new lib/SE/3.2.1 and lib/SE/3.3 directories to hold new orca_p_vmstat_class.se file. * orca_p_vmstat_class.se file added which contains definitions of new metrics * start_orcallator modified to determine installed SE version which is used to include the correct version of orca_p_vmstat_class.se file. * orcallator.cfg modified to graph new metrics * orcallator.se modified to collect new metrics * Makefile.in modified to properly create new lib/SE/3.2.1 and lib/SE/3.3 directories and copy orca_p_vmstat_class.se files during installation * New metrics include: pgrec/s - page reclaims (include pageout) pgfrec/s - page reclaims from free list pgin/s - pageins pages_in/s - pages paged in pgout/s - pageouts pages_out/s - pages paged out dfree/s - pages freed by daemon or auto min_fault/s - minor page faults (pvm.hat_fault + pvm.as_fault) maj_fault/s - major page faults prot_fault/s - protection faults cow_fault/s - copy-on-write faults zfod/s - zero-fill-on-demand faults interrupts/s - interrupts including clock intrthreads/s - interrupts as threads (below clock) system_calls/s context_switches/s invol_switches/s - involuntary context switches traps/s forks/s vforks/s execs/s namei/s - pathname lookups ufsiget/s - ufs_iget() calls ufsdirblk/s - directory blocks read ufsinopage/s - inodes taken with no attached pages Modified: trunk/orca/lib/Makefile.in ============================================================================== --- trunk/orca/lib/Makefile.in (original) +++ trunk/orca/lib/Makefile.in 2003-01-19 20:24:26.000000000 -0800 @@ -40,6 +40,17 @@ done; \ fi + $(MKDIR) $(libdir)/SE/3.2.1 + @for f in SE/3.2.1/*; do \ + $(INSTALL) -m 0644 $$f $(libdir)/SE/3.2.1; \ + echo $(INSTALL) -m 0644 $$f $(libdir)/SE/3.2.1; \ + done + $(MKDIR) $(libdir)/SE/3.3 + @for f in SE/3.3/*; do \ + $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ + echo $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ + done + clean: distclean: clean Added: trunk/orca/lib/SE/3.2.1/orca_p_vmstat_class.se ============================================================================== --- trunk/orca/lib/SE/3.2.1/orca_p_vmstat_class.se (original) +++ trunk/orca/lib/SE/3.2.1/orca_p_vmstat_class.se 2003-01-19 20:24:26.000000000 -0800 @@ -0,0 +1,386 @@ +// +// Copyright (c) 1993-2001 by Richard Pettit. All rights reserved. +// +// Some of this work was derived from include files containing the following +// copyrights. +// +// Copyright (c) 1986-1994 by Sun Microsystems, Inc. +// Copyright (c) 1983-1989 by AT&T +// Copyright (c) 1980-1993 by The Regents of the University of California. +// +// The work as a whole represents unique intellectual property and is +// copyright by Richard Pettit as shown on the first line. +// + +#ifndef _P_VMSTAT_CLASS_SE_ +#define _P_VMSTAT_CLASS_SE_ + +#include +#include +#include + +/* for memory computation */ +#define PGTOK(n) (((n) * pagesize) / 1024) +#define DELTA(name) (new_vminfo.name - old_vminfo.name) +#define COMPUTE(name) PGTOK(DELTA(name) / updates) + +/* make the code easier on the eye */ +#define CSI_DIFF(name) \ + pvmGLOB_cpu_sysinfo[i].name = \ + (csi.name - pvmGLOB_old_cpu_sysinfo[i].name) +#define CSI_PCT(name) \ + pvmGLOB_cpu_sysinfo[i].name = (pvmGLOB_cpu_sysinfo[i].name / total) * 100.0 + +#define CSIPCT(name) (100.0 * name / (hz * pvmGLOB_etime[i])) + +#define CVI_DIFF(name) \ + pvmGLOB_cpu_vminfo[i].name = \ + (cvi.name - pvmGLOB_old_cpu_vminfo[i].name) + +double pvmGLOB_etime[]; +ulong pvmGLOB_old_time[]; +ks_cpu_sysinfo pvmGLOB_cpu_sysinfo[]; +ks_cpu_sysinfo pvmGLOB_old_cpu_sysinfo[]; +ks_cpu_vminfo pvmGLOB_cpu_vminfo[]; +ks_cpu_vminfo pvmGLOB_old_cpu_vminfo[]; + +int pvmGLOB_cpu_size; + +pvmGLOB_realloc() +{ + pvmGLOB_etime = renew pvmGLOB_etime [pvmGLOB_cpu_size]; + pvmGLOB_old_time = renew pvmGLOB_old_time [pvmGLOB_cpu_size]; + pvmGLOB_cpu_sysinfo = renew pvmGLOB_cpu_sysinfo [pvmGLOB_cpu_size]; + pvmGLOB_old_cpu_sysinfo = renew pvmGLOB_old_cpu_sysinfo [pvmGLOB_cpu_size]; + pvmGLOB_cpu_vminfo = renew pvmGLOB_cpu_vminfo [pvmGLOB_cpu_size]; + pvmGLOB_old_cpu_vminfo = renew pvmGLOB_old_cpu_vminfo [pvmGLOB_cpu_size]; +} + +class p_vmstat { + + /* which cpu */ + int number$; + int instance; /* instance number from the kernel */ + int ncpus; /* current total number of CPUs */ + + /* these values are numbers of procs */ + double runque; + double waiting; + double swpque; + + /* these values are in Kbytes */ + int swap_avail; + int freemem; + + double pgrec; /* page reclaims (include pageout) */ + double pgfrec; /* page reclaims from free list */ + double pgin; /* pageins */ + double pgout; /* pageouts */ + double pgswapin; /* pages swapped in */ + double pgswapout; /* pages swapped out */ + double dfree; /* pages freed by daemon or auto */ + + double hat_fault; /* minor page faults via hat_fault() */ + double as_fault; /* minor page faults via as_fault() */ + double maj_fault; /* major page faults */ + double prot_fault; /* protection faults */ + double cow_fault; /* copy-on-write faults */ + double zfod; /* pages zero filled on demand */ + + double sysfork; /* forks */ + double sysvfork; /* vforks */ + double sysexec; /* execs */ + + double namei; /* pathname lookups */ + double ufsiget; /* pathname lookups */ + double ufsdirblk; /* directory block read */ + + double ufsinopage; /* inodes taken with no attached pgs */ + + /* these values are per second */ + double pages_in; /* pages paged in */ + double pages_out; /* pages paged out */ + double swapins; /* swap-in occurrences */ + double swapouts; /* swap-out occurrences */ + double scan; /* pages scanned */ + double pgrrun; /* how many times did pageout run */ + + double smtx; /* sleeps on a mutex per sec - mutex adaptive enter */ + double interrupts; /* interrupts including clock */ + double intrthread; /* interrupts as threads (below clock) */ + double system_calls; + double context_switches; + double invol_switches; + double trap; + + /* these are percentages of total over the last period */ + double user_time; + double system_time; + double wait_time; + double idle_time; + + p_vmstat$() + { + int i; + int n; + double updates; + int initialized = 0; + int last_number; + double hz = sysconf(_SC_CLK_TCK); + long pagesize = sysconf(_SC_PAGESIZE); + double total; + ulong itime; + ulong new_time; + ks_cpu_sysinfo csi; + ks_cpu_vminfo cvi; + ks_system_misc kstat$misc; + ks_sysinfo kstat$info; + ks_sysinfo old_sysinfo; + ks_sysinfo new_sysinfo; + ks_vminfo kstat$vminfo; + ks_vminfo old_vminfo; + ks_vminfo new_vminfo; + + // allow this to change each time + ncpus = sysconf(_SC_NPROCESSORS_ONLN); + + /* grab initial values */ + if (initialized == 0) { + pvmGLOB_cpu_size = ncpus; + + pvmGLOB_etime = new double[pvmGLOB_cpu_size]; + pvmGLOB_old_time = new ulong[pvmGLOB_cpu_size]; + pvmGLOB_cpu_sysinfo = new ks_cpu_sysinfo[pvmGLOB_cpu_size]; + pvmGLOB_old_cpu_sysinfo = new ks_cpu_sysinfo[pvmGLOB_cpu_size]; + pvmGLOB_cpu_vminfo = new ks_cpu_vminfo[pvmGLOB_cpu_size]; + pvmGLOB_old_cpu_vminfo = new ks_cpu_vminfo[pvmGLOB_cpu_size]; + + n = kstat$misc.clk_intr; + for(i=0; i pvmGLOB_cpu_size) { + pvmGLOB_cpu_size = ncpus; + pvmGLOB_realloc(); + } + + /* select which cpu */ + i = number$; + if (i < 0 || i >= ncpus) { + number$ = -1; + return; + } + instance = pvmGLOB_old_cpu_sysinfo[i].instance; + + /* how much time has gone by */ + new_time = kstat$misc.clk_intr; + itime = new_time - pvmGLOB_old_time[i]; + + /* no time has gone by, return */ + if (itime == 0) { + if (i != last_number) { + smtx = pvmGLOB_cpu_sysinfo[i].mutex_adenters/pvmGLOB_etime[i]; + interrupts = pvmGLOB_cpu_sysinfo[i].intr/pvmGLOB_etime[i]; + intrthread = pvmGLOB_cpu_sysinfo[i].intrthread/pvmGLOB_etime[i]; + system_calls = pvmGLOB_cpu_sysinfo[i].syscall/pvmGLOB_etime[i]; + trap = pvmGLOB_cpu_sysinfo[i].trap/pvmGLOB_etime[i]; + context_switches = pvmGLOB_cpu_sysinfo[i].pswitch/pvmGLOB_etime[i]; + invol_switches = pvmGLOB_cpu_sysinfo[i].inv_swtch/pvmGLOB_etime[i]; + user_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_USER]); + system_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_KERNEL]); + wait_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_WAIT]); + idle_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_IDLE]); + + sysfork = pvmGLOB_cpu_sysinfo[i].sysfork/pvmGLOB_etime[i]; + sysvfork = pvmGLOB_cpu_sysinfo[i].sysvfork/pvmGLOB_etime[i]; + sysexec = pvmGLOB_cpu_sysinfo[i].sysexec/pvmGLOB_etime[i]; + + namei = pvmGLOB_cpu_sysinfo[i].namei/pvmGLOB_etime[i]; + ufsiget = pvmGLOB_cpu_sysinfo[i].ufsiget/pvmGLOB_etime[i]; + ufsdirblk = pvmGLOB_cpu_sysinfo[i].ufsdirblk/pvmGLOB_etime[i]; + + ufsinopage = pvmGLOB_cpu_sysinfo[i].ufsinopage/pvmGLOB_etime[i]; + + pgrec = pvmGLOB_cpu_vminfo[i].pgrec/pvmGLOB_etime[i]; + pgfrec = pvmGLOB_cpu_vminfo[i].pgfrec/pvmGLOB_etime[i]; + pgin = pvmGLOB_cpu_vminfo[i].pgin/pvmGLOB_etime[i]; + pgout = pvmGLOB_cpu_vminfo[i].pgout/pvmGLOB_etime[i]; + dfree = pvmGLOB_cpu_vminfo[i].dfree/pvmGLOB_etime[i]; + + hat_fault = pvmGLOB_cpu_vminfo[i].hat_fault/pvmGLOB_etime[i]; + as_fault = pvmGLOB_cpu_vminfo[i].as_fault/pvmGLOB_etime[i]; + maj_fault = pvmGLOB_cpu_vminfo[i].maj_fault/pvmGLOB_etime[i]; + prot_fault = pvmGLOB_cpu_vminfo[i].prot_fault/pvmGLOB_etime[i]; + cow_fault = pvmGLOB_cpu_vminfo[i].cow_fault/pvmGLOB_etime[i]; + zfod = pvmGLOB_cpu_vminfo[i].zfod/pvmGLOB_etime[i]; + + pages_in = pvmGLOB_cpu_vminfo[i].pgpgin/pvmGLOB_etime[i]; + pages_out = pvmGLOB_cpu_vminfo[i].pgpgout/pvmGLOB_etime[i]; + swapins = pvmGLOB_cpu_vminfo[i].swapin/pvmGLOB_etime[i]; + swapouts = pvmGLOB_cpu_vminfo[i].swapout/pvmGLOB_etime[i]; + scan = pvmGLOB_cpu_vminfo[i].scan/pvmGLOB_etime[i]; + pgrrun = pvmGLOB_cpu_vminfo[i].pgrrun/pvmGLOB_etime[i]; + + last_number = i; + } + return; + } + pvmGLOB_etime[i] = itime / hz; + pvmGLOB_old_time[i] = new_time; + + csi.number$ = i; + refresh$(csi); + + cvi.number$ = i; + refresh$(cvi); + + new_sysinfo = kstat$info; + updates = new_sysinfo.updates - old_sysinfo.updates; + if (updates > 0.0) { + new_vminfo = kstat$vminfo; + } + + /* compute cpu sysinfo diffs */ + CSI_DIFF(mutex_adenters); + CSI_DIFF(intr); + CSI_DIFF(intrthread); + CSI_DIFF(syscall); + CSI_DIFF(pswitch); + CSI_DIFF(inv_swtch); + CSI_DIFF(trap); + CSI_DIFF(cpu[CPU_USER]); + CSI_DIFF(cpu[CPU_KERNEL]); + CSI_DIFF(cpu[CPU_WAIT]); + CSI_DIFF(cpu[CPU_IDLE]); + CSI_DIFF(wait[W_IO]); + CSI_DIFF(wait[W_SWAP]); + CSI_DIFF(wait[W_PIO]); + + CSI_DIFF(sysfork); + CSI_DIFF(sysvfork); + CSI_DIFF(sysexec); + + CSI_DIFF(namei); + CSI_DIFF(ufsiget); + CSI_DIFF(ufsdirblk); + + CSI_DIFF(ufsinopage); + + /* compute percentages + total = pvmGLOB_cpu_sysinfo[i].cpu[CPU_USER] + + pvmGLOB_cpu_sysinfo[i].cpu[CPU_KERNEL] + + pvmGLOB_cpu_sysinfo[i].cpu[CPU_WAIT] + + pvmGLOB_cpu_sysinfo[i].cpu[CPU_IDLE]; + CSI_PCT(cpu[CPU_USER]); + CSI_PCT(cpu[CPU_KERNEL]); + CSI_PCT(cpu[CPU_WAIT]); + CSI_PCT(cpu[CPU_IDLE]); + */ + + /* save new values */ + pvmGLOB_old_cpu_sysinfo[i] = csi; + + CVI_DIFF(pgrec); + CVI_DIFF(pgfrec); + CVI_DIFF(pgin); + CVI_DIFF(pgout); + CVI_DIFF(dfree); + + CVI_DIFF(hat_fault); + CVI_DIFF(as_fault); + CVI_DIFF(maj_fault); + CVI_DIFF(prot_fault); + CVI_DIFF(zfod); + CVI_DIFF(cow_fault); + + /* compute page/swap values */ + pvmGLOB_cpu_vminfo[i].pgpgin = + ((cvi.pgpgin - pvmGLOB_old_cpu_vminfo[i].pgpgin) * pagesize) / 1024; + pvmGLOB_cpu_vminfo[i].pgpgout = + ((cvi.pgpgout - pvmGLOB_old_cpu_vminfo[i].pgpgout) * pagesize) / 1024; + CVI_DIFF(swapin); + CVI_DIFF(swapout); + CVI_DIFF(scan); + CVI_DIFF(pgrrun); + + /* save new values */ + pvmGLOB_old_cpu_vminfo[i] = cvi; + + /* update and return */ + smtx = pvmGLOB_cpu_sysinfo[i].mutex_adenters/pvmGLOB_etime[i]; + interrupts = pvmGLOB_cpu_sysinfo[i].intr/pvmGLOB_etime[i]; + intrthread = pvmGLOB_cpu_sysinfo[i].intrthread/pvmGLOB_etime[i]; + system_calls = pvmGLOB_cpu_sysinfo[i].syscall/pvmGLOB_etime[i]; + context_switches = pvmGLOB_cpu_sysinfo[i].pswitch/pvmGLOB_etime[i]; + invol_switches = pvmGLOB_cpu_sysinfo[i].inv_swtch/pvmGLOB_etime[i]; + trap = pvmGLOB_cpu_sysinfo[i].trap/pvmGLOB_etime[i]; + user_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_USER]); + system_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_KERNEL]); + wait_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_WAIT]); + idle_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_IDLE]); + + sysfork = pvmGLOB_cpu_sysinfo[i].sysfork/pvmGLOB_etime[i]; + sysvfork = pvmGLOB_cpu_sysinfo[i].sysvfork/pvmGLOB_etime[i]; + sysexec = pvmGLOB_cpu_sysinfo[i].sysexec/pvmGLOB_etime[i]; + + namei = pvmGLOB_cpu_sysinfo[i].namei/pvmGLOB_etime[i]; + ufsiget = pvmGLOB_cpu_sysinfo[i].ufsiget/pvmGLOB_etime[i]; + ufsdirblk = pvmGLOB_cpu_sysinfo[i].ufsdirblk/pvmGLOB_etime[i]; + + ufsinopage = pvmGLOB_cpu_sysinfo[i].ufsinopage/pvmGLOB_etime[i]; + + pgrec = pvmGLOB_cpu_vminfo[i].pgrec/pvmGLOB_etime[i]; + pgfrec = pvmGLOB_cpu_vminfo[i].pgfrec/pvmGLOB_etime[i]; + pgin = pvmGLOB_cpu_vminfo[i].pgin/pvmGLOB_etime[i]; + pgout = pvmGLOB_cpu_vminfo[i].pgout/pvmGLOB_etime[i]; + dfree = pvmGLOB_cpu_vminfo[i].dfree/pvmGLOB_etime[i]; + + hat_fault = pvmGLOB_cpu_vminfo[i].hat_fault/pvmGLOB_etime[i]; + as_fault = pvmGLOB_cpu_vminfo[i].as_fault/pvmGLOB_etime[i]; + maj_fault = pvmGLOB_cpu_vminfo[i].maj_fault/pvmGLOB_etime[i]; + prot_fault = pvmGLOB_cpu_vminfo[i].prot_fault/pvmGLOB_etime[i]; + cow_fault = pvmGLOB_cpu_vminfo[i].cow_fault/pvmGLOB_etime[i]; + zfod = pvmGLOB_cpu_vminfo[i].zfod/pvmGLOB_etime[i]; + + pages_in = pvmGLOB_cpu_vminfo[i].pgpgin/pvmGLOB_etime[i]; + pages_out = pvmGLOB_cpu_vminfo[i].pgpgout/pvmGLOB_etime[i]; + swapins = pvmGLOB_cpu_vminfo[i].swapin/pvmGLOB_etime[i]; + swapouts = pvmGLOB_cpu_vminfo[i].swapout/pvmGLOB_etime[i]; + scan = pvmGLOB_cpu_vminfo[i].scan/pvmGLOB_etime[i]; + pgrrun = pvmGLOB_cpu_vminfo[i].pgrrun/pvmGLOB_etime[i]; + + if (updates > 0.0) { + freemem = COMPUTE(freemem); + swap_avail = COMPUTE(swap_avail); + + runque = (new_sysinfo.runque - old_sysinfo.runque) / updates; + waiting = (new_sysinfo.waiting - old_sysinfo.waiting) / updates; + swpque = (new_sysinfo.swpque - old_sysinfo.swpque) / updates; + + /* save old memory values */ + old_sysinfo = new_sysinfo; + old_vminfo = new_vminfo; + } + } +}; + +#endif /* _P_VMSTAT_CLASS_SE_ */ Added: trunk/orca/lib/SE/3.3/orca_p_vmstat_class.se ============================================================================== --- trunk/orca/lib/SE/3.3/orca_p_vmstat_class.se (original) +++ trunk/orca/lib/SE/3.3/orca_p_vmstat_class.se 2003-01-19 20:24:26.000000000 -0800 @@ -0,0 +1,386 @@ +// +// Copyright (c) 1993-2001 by Richard Pettit. All rights reserved. +// +// Some of this work was derived from include files containing the following +// copyrights. +// +// Copyright (c) 1986-1994 by Sun Microsystems, Inc. +// Copyright (c) 1983-1989 by AT&T +// Copyright (c) 1980-1993 by The Regents of the University of California. +// +// The work as a whole represents unique intellectual property and is +// copyright by Richard Pettit as shown on the first line. +// + +#ifndef _P_VMSTAT_CLASS_SE_ +#define _P_VMSTAT_CLASS_SE_ + +#include +#include +#include + +/* for memory computation */ +#define PGTOK(n) (((n) * pagesize) / 1024) +#define DELTA(name) (new_vminfo.name - old_vminfo.name) +#define COMPUTE(name) PGTOK(DELTA(name) / updates) + +/* make the code easier on the eye */ +#define CSI_DIFF(name) \ + pvmGLOB_cpu_sysinfo[i].name = \ + (csi.name - pvmGLOB_old_cpu_sysinfo[i].name) +#define CSI_PCT(name) \ + pvmGLOB_cpu_sysinfo[i].name = (pvmGLOB_cpu_sysinfo[i].name / total) * 100.0 + +#define CSIPCT(name) (100.0 * name / (hz * pvmGLOB_etime[i])) + +#define CVI_DIFF(name) \ + pvmGLOB_cpu_vminfo[i].name = \ + (cvi.name - pvmGLOB_old_cpu_vminfo[i].name) + +double pvmGLOB_etime[]; +ulong pvmGLOB_old_time[]; +ks_cpu_sysinfo pvmGLOB_cpu_sysinfo[]; +ks_cpu_sysinfo pvmGLOB_old_cpu_sysinfo[]; +ks_cpu_vminfo pvmGLOB_cpu_vminfo[]; +ks_cpu_vminfo pvmGLOB_old_cpu_vminfo[]; + +int pvmGLOB_cpu_size; + +pvmGLOB_realloc() +{ + pvmGLOB_etime = renew pvmGLOB_etime [pvmGLOB_cpu_size]; + pvmGLOB_old_time = renew pvmGLOB_old_time [pvmGLOB_cpu_size]; + pvmGLOB_cpu_sysinfo = renew pvmGLOB_cpu_sysinfo [pvmGLOB_cpu_size]; + pvmGLOB_old_cpu_sysinfo = renew pvmGLOB_old_cpu_sysinfo [pvmGLOB_cpu_size]; + pvmGLOB_cpu_vminfo = renew pvmGLOB_cpu_vminfo [pvmGLOB_cpu_size]; + pvmGLOB_old_cpu_vminfo = renew pvmGLOB_old_cpu_vminfo [pvmGLOB_cpu_size]; +} + +class p_vmstat { + + /* which cpu */ + int number$; + int instance; /* instance number from the kernel */ + int ncpus; /* current total number of CPUs */ + + /* these values are numbers of procs */ + double runque; + double waiting; + double swpque; + + /* these values are in Kbytes */ + int swap_avail; + int freemem; + + double pgrec; /* page reclaims (include pageout) */ + double pgfrec; /* page reclaims from free list */ + double pgin; /* pageins */ + double pgout; /* pageouts */ + double pgswapin; /* pages swapped in */ + double pgswapout; /* pages swapped out */ + double dfree; /* pages freed by daemon or auto */ + + double hat_fault; /* minor page faults via hat_fault() */ + double as_fault; /* minor page faults via as_fault() */ + double maj_fault; /* major page faults */ + double prot_fault; /* protection faults */ + double cow_fault; /* copy-on-write faults */ + double zfod; /* pages zero filled on demand */ + + double sysfork; /* forks */ + double sysvfork; /* vforks */ + double sysexec; /* execs */ + + double namei; /* pathname lookups */ + double ufsiget; /* pathname lookups */ + double ufsdirblk; /* directory block read */ + + double ufsinopage; /* inodes taken with no attached pgs */ + + /* these values are per second */ + double pages_in; /* pages paged in */ + double pages_out; /* pages paged out */ + double swapins; /* swap-in occurrences */ + double swapouts; /* swap-out occurrences */ + double scan; /* pages scanned */ + double pgrrun; /* how many times did pageout run */ + + double smtx; /* sleeps on a mutex per sec - mutex adaptive enter */ + double interrupts; /* interrupts including clock */ + double intrthread; /* interrupts as threads (below clock) */ + double system_calls; + double context_switches; + double invol_switches; + double trap; + + /* these are percentages of total over the last period */ + double user_time; + double system_time; + double wait_time; + double idle_time; + + p_vmstat$() + { + int i; + int n; + double updates; + int initialized = 0; + int last_number; + double hz = sysconf(_SC_CLK_TCK); + long pagesize = sysconf(_SC_PAGESIZE); + double total; + ulong itime; + ulong new_time; + ks_cpu_sysinfo csi; + ks_cpu_vminfo cvi; + ks_system_misc kstat$misc; + ks_sysinfo kstat$info; + ks_sysinfo old_sysinfo; + ks_sysinfo new_sysinfo; + ks_vminfo kstat$vminfo; + ks_vminfo old_vminfo; + ks_vminfo new_vminfo; + + // allow this to change each time + ncpus = sysconf(_SC_NPROCESSORS_ONLN); + + /* grab initial values */ + if (initialized == 0) { + pvmGLOB_cpu_size = ncpus; + + pvmGLOB_etime = new double[pvmGLOB_cpu_size]; + pvmGLOB_old_time = new ulong[pvmGLOB_cpu_size]; + pvmGLOB_cpu_sysinfo = new ks_cpu_sysinfo[pvmGLOB_cpu_size]; + pvmGLOB_old_cpu_sysinfo = new ks_cpu_sysinfo[pvmGLOB_cpu_size]; + pvmGLOB_cpu_vminfo = new ks_cpu_vminfo[pvmGLOB_cpu_size]; + pvmGLOB_old_cpu_vminfo = new ks_cpu_vminfo[pvmGLOB_cpu_size]; + + n = kstat$misc.clk_intr; + for(i=0; i pvmGLOB_cpu_size) { + pvmGLOB_cpu_size = ncpus; + pvmGLOB_realloc(); + } + + /* select which cpu */ + i = number$; + if (i < 0 || i >= ncpus) { + number$ = -1; + return; + } + instance = pvmGLOB_old_cpu_sysinfo[i].instance$; + + /* how much time has gone by */ + new_time = kstat$misc.clk_intr; + itime = new_time - pvmGLOB_old_time[i]; + + /* no time has gone by, return */ + if (itime == 0) { + if (i != last_number) { + smtx = pvmGLOB_cpu_sysinfo[i].mutex_adenters/pvmGLOB_etime[i]; + interrupts = pvmGLOB_cpu_sysinfo[i].intr/pvmGLOB_etime[i]; + intrthread = pvmGLOB_cpu_sysinfo[i].intrthread/pvmGLOB_etime[i]; + system_calls = pvmGLOB_cpu_sysinfo[i].syscall/pvmGLOB_etime[i]; + trap = pvmGLOB_cpu_sysinfo[i].trap/pvmGLOB_etime[i]; + context_switches = pvmGLOB_cpu_sysinfo[i].pswitch/pvmGLOB_etime[i]; + invol_switches = pvmGLOB_cpu_sysinfo[i].inv_swtch/pvmGLOB_etime[i]; + user_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_USER]); + system_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_KERNEL]); + wait_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_WAIT]); + idle_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_IDLE]); + + sysfork = pvmGLOB_cpu_sysinfo[i].sysfork/pvmGLOB_etime[i]; + sysvfork = pvmGLOB_cpu_sysinfo[i].sysvfork/pvmGLOB_etime[i]; + sysexec = pvmGLOB_cpu_sysinfo[i].sysexec/pvmGLOB_etime[i]; + + namei = pvmGLOB_cpu_sysinfo[i].namei/pvmGLOB_etime[i]; + ufsiget = pvmGLOB_cpu_sysinfo[i].ufsiget/pvmGLOB_etime[i]; + ufsdirblk = pvmGLOB_cpu_sysinfo[i].ufsdirblk/pvmGLOB_etime[i]; + + ufsinopage = pvmGLOB_cpu_sysinfo[i].ufsinopage/pvmGLOB_etime[i]; + + pgrec = pvmGLOB_cpu_vminfo[i].pgrec/pvmGLOB_etime[i]; + pgfrec = pvmGLOB_cpu_vminfo[i].pgfrec/pvmGLOB_etime[i]; + pgin = pvmGLOB_cpu_vminfo[i].pgin/pvmGLOB_etime[i]; + pgout = pvmGLOB_cpu_vminfo[i].pgout/pvmGLOB_etime[i]; + dfree = pvmGLOB_cpu_vminfo[i].dfree/pvmGLOB_etime[i]; + + hat_fault = pvmGLOB_cpu_vminfo[i].hat_fault/pvmGLOB_etime[i]; + as_fault = pvmGLOB_cpu_vminfo[i].as_fault/pvmGLOB_etime[i]; + maj_fault = pvmGLOB_cpu_vminfo[i].maj_fault/pvmGLOB_etime[i]; + prot_fault = pvmGLOB_cpu_vminfo[i].prot_fault/pvmGLOB_etime[i]; + cow_fault = pvmGLOB_cpu_vminfo[i].cow_fault/pvmGLOB_etime[i]; + zfod = pvmGLOB_cpu_vminfo[i].zfod/pvmGLOB_etime[i]; + + pages_in = pvmGLOB_cpu_vminfo[i].pgpgin/pvmGLOB_etime[i]; + pages_out = pvmGLOB_cpu_vminfo[i].pgpgout/pvmGLOB_etime[i]; + swapins = pvmGLOB_cpu_vminfo[i].swapin/pvmGLOB_etime[i]; + swapouts = pvmGLOB_cpu_vminfo[i].swapout/pvmGLOB_etime[i]; + scan = pvmGLOB_cpu_vminfo[i].scan/pvmGLOB_etime[i]; + pgrrun = pvmGLOB_cpu_vminfo[i].pgrrun/pvmGLOB_etime[i]; + + last_number = i; + } + return; + } + pvmGLOB_etime[i] = itime / hz; + pvmGLOB_old_time[i] = new_time; + + csi.number$ = i; + refresh$(csi); + + cvi.number$ = i; + refresh$(cvi); + + new_sysinfo = kstat$info; + updates = new_sysinfo.updates - old_sysinfo.updates; + if (updates > 0.0) { + new_vminfo = kstat$vminfo; + } + + /* compute cpu sysinfo diffs */ + CSI_DIFF(mutex_adenters); + CSI_DIFF(intr); + CSI_DIFF(intrthread); + CSI_DIFF(syscall); + CSI_DIFF(pswitch); + CSI_DIFF(inv_swtch); + CSI_DIFF(trap); + CSI_DIFF(cpu[CPU_USER]); + CSI_DIFF(cpu[CPU_KERNEL]); + CSI_DIFF(cpu[CPU_WAIT]); + CSI_DIFF(cpu[CPU_IDLE]); + CSI_DIFF(wait[W_IO]); + CSI_DIFF(wait[W_SWAP]); + CSI_DIFF(wait[W_PIO]); + + CSI_DIFF(sysfork); + CSI_DIFF(sysvfork); + CSI_DIFF(sysexec); + + CSI_DIFF(namei); + CSI_DIFF(ufsiget); + CSI_DIFF(ufsdirblk); + + CSI_DIFF(ufsinopage); + + /* compute percentages + total = pvmGLOB_cpu_sysinfo[i].cpu[CPU_USER] + + pvmGLOB_cpu_sysinfo[i].cpu[CPU_KERNEL] + + pvmGLOB_cpu_sysinfo[i].cpu[CPU_WAIT] + + pvmGLOB_cpu_sysinfo[i].cpu[CPU_IDLE]; + CSI_PCT(cpu[CPU_USER]); + CSI_PCT(cpu[CPU_KERNEL]); + CSI_PCT(cpu[CPU_WAIT]); + CSI_PCT(cpu[CPU_IDLE]); + */ + + /* save new values */ + pvmGLOB_old_cpu_sysinfo[i] = csi; + + CVI_DIFF(pgrec); + CVI_DIFF(pgfrec); + CVI_DIFF(pgin); + CVI_DIFF(pgout); + CVI_DIFF(dfree); + + CVI_DIFF(hat_fault); + CVI_DIFF(as_fault); + CVI_DIFF(maj_fault); + CVI_DIFF(prot_fault); + CVI_DIFF(zfod); + CVI_DIFF(cow_fault); + + /* compute page/swap values */ + pvmGLOB_cpu_vminfo[i].pgpgin = + ((cvi.pgpgin - pvmGLOB_old_cpu_vminfo[i].pgpgin) * pagesize) / 1024; + pvmGLOB_cpu_vminfo[i].pgpgout = + ((cvi.pgpgout - pvmGLOB_old_cpu_vminfo[i].pgpgout) * pagesize) / 1024; + CVI_DIFF(swapin); + CVI_DIFF(swapout); + CVI_DIFF(scan); + CVI_DIFF(pgrrun); + + /* save new values */ + pvmGLOB_old_cpu_vminfo[i] = cvi; + + /* update and return */ + smtx = pvmGLOB_cpu_sysinfo[i].mutex_adenters/pvmGLOB_etime[i]; + interrupts = pvmGLOB_cpu_sysinfo[i].intr/pvmGLOB_etime[i]; + intrthread = pvmGLOB_cpu_sysinfo[i].intrthread/pvmGLOB_etime[i]; + system_calls = pvmGLOB_cpu_sysinfo[i].syscall/pvmGLOB_etime[i]; + context_switches = pvmGLOB_cpu_sysinfo[i].pswitch/pvmGLOB_etime[i]; + invol_switches = pvmGLOB_cpu_sysinfo[i].inv_swtch/pvmGLOB_etime[i]; + trap = pvmGLOB_cpu_sysinfo[i].trap/pvmGLOB_etime[i]; + user_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_USER]); + system_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_KERNEL]); + wait_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_WAIT]); + idle_time = CSIPCT(pvmGLOB_cpu_sysinfo[i].cpu[CPU_IDLE]); + + sysfork = pvmGLOB_cpu_sysinfo[i].sysfork/pvmGLOB_etime[i]; + sysvfork = pvmGLOB_cpu_sysinfo[i].sysvfork/pvmGLOB_etime[i]; + sysexec = pvmGLOB_cpu_sysinfo[i].sysexec/pvmGLOB_etime[i]; + + namei = pvmGLOB_cpu_sysinfo[i].namei/pvmGLOB_etime[i]; + ufsiget = pvmGLOB_cpu_sysinfo[i].ufsiget/pvmGLOB_etime[i]; + ufsdirblk = pvmGLOB_cpu_sysinfo[i].ufsdirblk/pvmGLOB_etime[i]; + + ufsinopage = pvmGLOB_cpu_sysinfo[i].ufsinopage/pvmGLOB_etime[i]; + + pgrec = pvmGLOB_cpu_vminfo[i].pgrec/pvmGLOB_etime[i]; + pgfrec = pvmGLOB_cpu_vminfo[i].pgfrec/pvmGLOB_etime[i]; + pgin = pvmGLOB_cpu_vminfo[i].pgin/pvmGLOB_etime[i]; + pgout = pvmGLOB_cpu_vminfo[i].pgout/pvmGLOB_etime[i]; + dfree = pvmGLOB_cpu_vminfo[i].dfree/pvmGLOB_etime[i]; + + hat_fault = pvmGLOB_cpu_vminfo[i].hat_fault/pvmGLOB_etime[i]; + as_fault = pvmGLOB_cpu_vminfo[i].as_fault/pvmGLOB_etime[i]; + maj_fault = pvmGLOB_cpu_vminfo[i].maj_fault/pvmGLOB_etime[i]; + prot_fault = pvmGLOB_cpu_vminfo[i].prot_fault/pvmGLOB_etime[i]; + cow_fault = pvmGLOB_cpu_vminfo[i].cow_fault/pvmGLOB_etime[i]; + zfod = pvmGLOB_cpu_vminfo[i].zfod/pvmGLOB_etime[i]; + + pages_in = pvmGLOB_cpu_vminfo[i].pgpgin/pvmGLOB_etime[i]; + pages_out = pvmGLOB_cpu_vminfo[i].pgpgout/pvmGLOB_etime[i]; + swapins = pvmGLOB_cpu_vminfo[i].swapin/pvmGLOB_etime[i]; + swapouts = pvmGLOB_cpu_vminfo[i].swapout/pvmGLOB_etime[i]; + scan = pvmGLOB_cpu_vminfo[i].scan/pvmGLOB_etime[i]; + pgrrun = pvmGLOB_cpu_vminfo[i].pgrrun/pvmGLOB_etime[i]; + + if (updates > 0.0) { + freemem = COMPUTE(freemem); + swap_avail = COMPUTE(swap_avail); + + runque = (new_sysinfo.runque - old_sysinfo.runque) / updates; + waiting = (new_sysinfo.waiting - old_sysinfo.waiting) / updates; + swpque = (new_sysinfo.swpque - old_sysinfo.swpque) / updates; + + /* save old memory values */ + old_sysinfo = new_sysinfo; + old_vminfo = new_vminfo; + } + } +}; + +#endif /* _P_VMSTAT_CLASS_SE_ */ Modified: trunk/orca/data_gatherers/orcallator/orcallator.cfg.in ============================================================================== --- trunk/orca/data_gatherers/orcallator/orcallator.cfg.in (original) +++ trunk/orca/data_gatherers/orcallator/orcallator.cfg.in 2003-01-19 20:24:26.000000000 -0800 @@ -533,6 +533,57 @@ } plot { +title %g Interrupts/s, System Calls/s & Traps/s +source orcallator +data interrupts/s +data intrthread/s +data system_calls/s +data traps/s +line_type area +line_type line1 +line_type line1 +line_type line1 +legend Interrupts +legend Interrupts as threads +legend System Calls +legend Traps +y_legend calls/s +data_min 0 +} + +plot { +title %g Forks/s, Vforks/s & Execs/s +source orcallator +data forks/s +data vforks/s +data execs/s +line_type area +line_type line1 +line_type line1 +legend forks/s +legend vforks/s +legend execs/s +y_legend calls/s +data_min 0 +} + +plot { +title %g Context Switches/s +source orcallator +data context_switches/s - invol_switches/s +data invol_switches/s +data context_switches/s +line_type area +line_type stack +line_type line1 +legend Voluntary Switches/s +legend Involuntary Switches/s +legend Total +y_legend Switches/s +data_min 0 +} + +plot { title %g NFS Server Call Rate source orcallator data nfss_calls @@ -737,11 +788,30 @@ } plot { +title %g Pathname lookups, UFS iget calls & UFS dir. block reads/s +source orcallator +data namei/s +data ufsiget/s +data ufsdirblk/s +line_type area +line_type line1 +line_type line1 +legend namei/s +legend ufsiget/s +legend ufsdirblk/s +y_legend calls/s +data_min 0 +} + +plot { title %g Cache Inode Steal Rate source orcallator data inod_stl/s +data ufsinopage/s line_type area +line_type line1 legend Inode w/page steals/s +legend Inode wo/page steals/s y_legend Steals/s data_min 0 href http://www.orcaware.com/orca/docs/orcallator.html#inode_steal_rate @@ -818,6 +888,68 @@ } plot { +title %g Pageins/s & Pageouts/s +source orcallator +data pgin/s +data pgout/s +line_type area +line_type line1 +legend Page Ins +legend Page Outs +y_legend Events/s +data_min 0 +plot_min 0 +} + +plot { +title %g Pages PagedIn & Pages PagedOut & Pages Freed/s +source orcallator +data pages_in/s +data pages_out/s +data dfree/s +line_type area +line_type line1 +line_type line1 +legend Pages Paged In +legend Pages Paged Out +legend Pages Freed +y_legend Pages/s +data_min 0 +plot_min 0 +} + +plot { +title %g Major, Minor & Protection Page Faults/s +source orcallator +data maj_fault/s +data min_fault/s +data prot_fault/s +line_type area +line_type line1 +line_type line1 +legend Major Faults +legend Minor Faults +legend Protection Faults +y_legend Faults/s +data_min 0 +plot_min 0 +} + +plot { +title %g Copy-on-write & Zero-fill-on-demand Page Faults/s +source orcallator +data cow_fault/s +data zfod/s +line_type area +line_type line1 +legend Copy-on-write +legend Zero-fill-on-demand +y_legend Faults/s +data_min 0 +plot_min 0 +} + +plot { title %g Memory Pages Locked & IO source orcallator data pageslock Modified: trunk/orca/data_gatherers/orcallator/orcallator.se ============================================================================== --- trunk/orca/data_gatherers/orcallator/orcallator.se (original) +++ trunk/orca/data_gatherers/orcallator/orcallator.se 2003-01-19 20:24:26.000000000 -0800 @@ -8,6 +8,38 @@ // // Portions copied from percollator.se written by Adrian Cockroft. // +// Version 1.38: Jan 14, 2003 Additions by Sean O'Neill +// Added several new variables for Orca to collect +// and graph including: +// pgrec/s - page reclaims (include pageout) +// pgfrec/s - page reclaims from free list +// pgin/s - pageins +// pages_in/s - pages paged in +// pgout/s - pageouts +// pages_out/s - pages paged out +// dfree/s - pages freed by daemon or auto +// min_fault/s - minor page faults +// (pvm.hat_fault + pvm.as_fault) +// maj_fault/s - major page faults +// prot_fault/s - protection faults +// cow_fault/s - copy-on-write faults +// zfod/s - zero-fill-on-demand faults +// interrupts/s - interrupts including clock +// intrthreads/s - interrupts as threads +// (below clock) +// system_calls/s +// context_switches/s +// invol_switches/s - involuntary context switches +// traps/s +// forks/s +// vforks/s +// execs/s +// namei/s - pathname lookups +// ufsiget/s - ufs_iget() calls +// ufsdirblk/s - directory blocks read +// ufsinopage/s - inodes taken with no attached +// pages +// // Version 1.37: Dec 28, 2002 Improved algorithm in raw_disk_map() which // detects the end of the GLOBAL_disk_info array. // To deal with occasions when the first disk is a @@ -339,7 +371,8 @@ #include #include -#include +//#include +#include #include #include #include @@ -1523,6 +1556,31 @@ put_output("#waiting", sprintf("%8.2f", pvm.waiting + 0.0)); put_output(" #swpque", sprintf("%8.2f", pvm.swpque + 0.0)); put_output("scanrate", sprintf("%8.3f", pvm.scan + 0.0)); + put_output("pgrec/s", sprintf("%8.3f", pvm.pgrec + 0.0)); + put_output("pgfrec/s", sprintf("%8.3f", pvm.pgfrec + 0.0)); + put_output("pgin/s", sprintf("%8.3f", pvm.pgin + 0.0)); + put_output("pages_in/s", sprintf("%8.3f", pvm.pages_in + 0.0)); + put_output("pgout/s", sprintf("%8.3f", pvm.pgout + 0.0)); + put_output("pages_out/s", sprintf("%8.3f", pvm.pages_out + 0.0)); + put_output("dfree/s", sprintf("%8.3f", pvm.dfree + 0.0)); + put_output("min_fault/s", sprintf("%8.3f", pvm.hat_fault + pvm.as_fault + 0.0)) +; + put_output("maj_fault/s", sprintf("%8.3f", pvm.maj_fault + 0.0)); + put_output("prot_fault/s", sprintf("%8.3f", pvm.prot_fault + 0.0)); + put_output("cow_fault/s", sprintf("%8.3f", pvm.cow_fault + 0.0)); + put_output("zfod/s", sprintf("%8.3f", pvm.zfod + 0.0)); + put_output("interrupts/s", sprintf("%8.3f", pvm.interrupts + 0.0)); + put_output("intrthread/s", sprintf("%8.3f", pvm.intrthread + 0.0)); + put_output("system_calls/s", sprintf("%8.3f", pvm.system_calls + 0.0)); + put_output("context_switches/s", sprintf("%8.3f", pvm.context_switches + 0.0)); + put_output("invol_switches/s", sprintf("%8.3f", pvm.invol_switches + 0.0)); + put_output("traps/s", sprintf("%8.3f", pvm.trap + 0.0)); + put_output("forks/s", sprintf("%8.3f", pvm.sysfork + 0.0)); + put_output("vforks/s", sprintf("%8.3f", pvm.sysvfork + 0.0)); + put_output("execs/s", sprintf("%8.3f", pvm.sysexec + 0.0)); + put_output("namei/s", sprintf("%8.3f", pvm.namei + 0.0)); + put_output("ufsiget/s", sprintf("%8.3f", pvm.ufsiget + 0.0)); + put_output("ufsdirblk/s", sprintf("%8.3f", pvm.ufsdirblk + 0.0)); // Calculate the rate of new process spawning. if (can_read_kernel != 0) { @@ -1893,9 +1951,13 @@ #ifdef WATCH_INODE measure_inode() { + p_vmstat pvm; + put_output("inod_ref/s", sprintf("%10.3f", tmp_lr_inode.refrate)); put_output("inod_hit%", sprintf("%9.3f", tmp_lr_inode.hitrate)); put_output("inod_stl/s", sprintf("%10.3f", tmp_lr_inode.iprate)); + put_output("ufsinopage/s", sprintf("%8.3f", pvm.ufsinopage + 0.0)); + } #endif Modified: trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in ============================================================================== --- trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in (original) +++ trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in 2003-01-19 20:24:26.000000000 -0800 @@ -13,6 +13,12 @@ UNAME=@UNAME@ RAW_ORCALLATOR_DIR=@VAR_DIR@/orcallator SE=@SE@ +SE_VERSION=`$SE -version | nawk '{print $4}'` +if [ "$SE_VERSION" != "3.2.1" -a "$SE_VERSION" != "3.3" ]; then + echo "SE version MUST be 3.3 or 3.2.1 .. please upgrade SE." + echo "See http://www.setoolkit.com for more information." + exit 1 +fi # WEB_LOG contains the location of the web server log file that # orcallator.se should read. @@ -103,7 +109,7 @@ # Now start the logging. echo "Starting logging" -nohup $SE $SE_PATCHES -DWATCH_OS $WATCH_WEB $libdir/orcallator.se & +nohup $SE $SE_PATCHES -DWATCH_OS $WATCH_WEB -I$libdir/SE/$SE_VERSION $libdir/orcallator.se & # Write the PID of orcallator to a file to make killing easier. pid=$! From sean at seanoneill.info Sun Jan 19 22:04:17 2003 From: sean at seanoneill.info (sean at seanoneill.info) Date: Sun, 19 Jan 2003 22:04:17 -0800 Subject: [Orca-checkins] propchange - rev 197 svn:log Message-ID: <200301200604.h0K64HUd020800@orcaware.com> Author: sean at seanoneill.info Revision: 197 Property Name: svn:log New Property Value: * lib/SE/3.2.1, lib/SE/3.3: New directories to hold new orca_p_vmstat_class.se files. * lib/SE/3.2.1/orca_p_vmstat_class.se, * lib/SE/3.3/orca_p_vmstat_class.se: New files which contain definitions of new metrics. These files are modifications of the p_vmstat_class.se file that comes with SE 3.2.1 and SE 3.3. Rich Pettit asked that the modifications to these files be included as part of Orca as he won't be including them with SE. * data_graphers/orcallator/start_orcallator.sh.in: Modified to determine installed SE version which is used to include the correct version of orca_p_vmstat_class.se file. Modified to make sure either SE 3.2.1 or SE 3.3 is found. If neither version is found, an error is displayed and the script exists. * data_graphers/orcallator/orcallator.cfg.in: Modified to graph new metrics. * data_graphers/orcallator/orcallator.se: Modified to collect new metrics. * lib/Makefile.in: Modified to properly create new lib/SE/3.2.1 and lib/SE/3.3 directories and copy orca_p_vmstat_class.se files during installation. * The modifications above allow for the collection and graphing of the following metrics: pgrec/s - page reclaims (include pageout) pgfrec/s - page reclaims from free list pgin/s - pageins pages_in/s - pages paged in pgout/s - pageouts pages_out/s - pages paged out dfree/s - pages freed by daemon or auto min_fault/s - minor page faults (pvm.hat_fault + pvm.as_fault) maj_fault/s - major page faults prot_fault/s - protection faults cow_fault/s - copy-on-write faults zfod/s - zero-fill-on-demand faults interrupts/s - interrupts including clock intrthreads/s - interrupts as threads (below clock) system_calls/s context_switches/s invol_switches/s - involuntary context switches traps/s forks/s vforks/s execs/s namei/s - pathname lookups ufsiget/s - ufs_iget() calls ufsdirblk/s - directory blocks read ufsinopage/s - inodes taken with no attached pages From blair at orcaware.com Mon Jan 20 08:31:23 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Mon, 20 Jan 2003 08:31:23 -0800 Subject: [Orca-checkins] propchange - rev 197 svn:log Message-ID: <200301201631.h0KGVNLM023764@orcaware.com> Author: blair Revision: 197 Property Name: svn:log New Property Value: * lib/SE/3.2.1, lib/SE/3.3: New directories to hold new orca_p_vmstat_class.se files. * lib/SE/3.2.1/orca_p_vmstat_class.se, * lib/SE/3.3/orca_p_vmstat_class.se: New files which contain definitions of new metrics. These files are modifications of the p_vmstat_class.se file that comes with SE 3.2.1 and SE 3.3. Rich Pettit asked that the modifications to these files be included as part of Orca as he won't be including them with SE. * data_graphers/orcallator/start_orcallator.sh.in: Modified to determine installed SE version which is used to include the correct version of orca_p_vmstat_class.se file. Modified to make sure either SE 3.2.1 or SE 3.3 is found. If neither version is found, an error is displayed and the script exists. * data_graphers/orcallator/orcallator.cfg.in: Modified to graph new metrics. * data_graphers/orcallator/orcallator.se: Modified to collect new metrics. * lib/Makefile.in: Modified to properly create new lib/SE/3.2.1 and lib/SE/3.3 directories and copy orca_p_vmstat_class.se files during installation. * The modifications above allow for the collection and graphing of the following metrics: pgrec/s - page reclaims (include pageout) pgfrec/s - page reclaims from free list pgin/s - pageins pages_in/s - pages paged in pgout/s - pageouts pages_out/s - pages paged out dfree/s - pages freed by daemon or auto min_fault/s - minor page faults (pvm.hat_fault + pvm.as_fault) maj_fault/s - major page faults prot_fault/s - protection faults cow_fault/s - copy-on-write faults zfod/s - zero-fill-on-demand faults interrupts/s - interrupts including clock intrthreads/s - interrupts as threads (below clock) system_calls/s context_switches/s invol_switches/s - involuntary context switches traps/s forks/s vforks/s execs/s namei/s - pathname lookups ufsiget/s - ufs_iget() calls ufsdirblk/s - directory blocks read ufsinopage/s - inodes taken with no attached pages From blair at orcaware.com Mon Jan 20 10:36:49 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Mon, 20 Jan 2003 10:36:49 -0800 Subject: [Orca-checkins] rev 198 - trunk/orca/lib Message-ID: <200301201836.h0KIankp026868@orcaware.com> Author: blair Date: 2003-01-20 10:36:42 -0800 (Mon, 20 Jan 2003) New Revision: 198 Modified: trunk/orca/lib/Makefile.in Log: * lib/Makefile.in (install): When installing files, echo the install command before running it. Use the new Makefile style for installing the SE/3.2.1 and SE/3.3 files, that is indent with spaces, not tabs. Modified: trunk/orca/lib/Makefile.in ============================================================================== --- trunk/orca/lib/Makefile.in (original) +++ trunk/orca/lib/Makefile.in 2003-01-20 10:36:49.000000000 -0800 @@ -28,27 +28,26 @@ install: all $(MKDIR) $(libdir)/Orca + $(MKDIR) $(libdir)/SE/3.2.1 + $(MKDIR) $(libdir)/SE/3.3 @for f in Orca/*.pm; do \ - $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ echo $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ + $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ done @if test -d Orca/Config; then \ $(MKDIR) $(libdir)/Orca/Config; \ for f in Orca/Config/*.pm; do \ - $(INSTALL) -m 0644 $$f $(libdir)/Orca/Config; \ echo $(INSTALL) -m 0644 $$f $(libdir)/Orca/Config; \ + $(INSTALL) -m 0644 $$f $(libdir)/Orca/Config; \ done; \ fi - - $(MKDIR) $(libdir)/SE/3.2.1 - @for f in SE/3.2.1/*; do \ - $(INSTALL) -m 0644 $$f $(libdir)/SE/3.2.1; \ - echo $(INSTALL) -m 0644 $$f $(libdir)/SE/3.2.1; \ + @for f in SE/3.2.1/*; do \ + echo $(INSTALL) -m 0644 $$f $(libdir)/SE/3.2.1; \ + $(INSTALL) -m 0644 $$f $(libdir)/SE/3.2.1; \ done - $(MKDIR) $(libdir)/SE/3.3 - @for f in SE/3.3/*; do \ - $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ - echo $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ + @for f in SE/3.3/*; do \ + echo $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ + $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ done clean: From blair at orcaware.com Tue Jan 21 13:36:21 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Tue, 21 Jan 2003 13:36:21 -0800 Subject: [Orca-checkins] rev 199 - in trunk/orca/lib/SE: 3.2.1 3.3 Message-ID: <200301212136.h0LLaLa9022245@orcaware.com> Author: blair Date: 2003-01-21 13:36:06 -0800 (Tue, 21 Jan 2003) New Revision: 199 Added: trunk/orca/lib/SE/3.2.1/live_rules.se trunk/orca/lib/SE/3.3/live_rules.se Log: * lib/SE/3.2.1/live_rules.se, * lib/SE/3.3/live_rules.se: New files to be included by SE instead of the live_rules.se packaged with SE 3.2.1. These files fix an issue where the pvm.idle_time is calculated in such a way that the total CPU time (pvm.user_time + pvm.system_time + pvm.wait_time + pvm.idle_time) can be greater than 100%, which causes the orcallator.cfg.in file to ignore that data measurement. The new calculation ensures that the total CPU time will be less than 100%, which is better than being greater than 100%. These files are only included by the new start_orcallator.sh.in script, which starts SE with a -I command line option. Added: trunk/orca/lib/SE/3.2.1/live_rules.se ============================================================================== --- trunk/orca/lib/SE/3.2.1/live_rules.se (original) +++ trunk/orca/lib/SE/3.2.1/live_rules.se 2003-01-21 13:36:17.000000000 -0800 @@ -0,0 +1,945 @@ + +/* + + Copyright (c) 1995-1998, by Sun Microsystems, Inc. + All Rights Reserved + +Written by Adrian Cockcroft, based on Appendix A of "Sun Performance +and Tuning", ISBN 0-13-095249-4 + +Version 1.8 31 May 99 Added disk errors to disk rule +Version 1.7 19 Mar 99 Make GLOBAL_disk a dynamic array +Version 1.6 17 Feb 99 Fixes to partition exclusion code +Version 1.5 25 Jul 98 Updated mutex rule data feed +Version 1.4 26 Dec 97 Fixes for disk_count in 2.6 disk rule +Version 1.3 7 Nov 97 Fixed handspread for ram rule +Version 1.2 23 Oct 97 Fixes for 2.6 partitions +Version 1.1 8 Oct 96 Use explanations from pure rules +Version 1.00 9 Aug 96 Extra info for new net_rule +Version 0.20 23 Aug 95 Added data rates to lr_rpcclient +Version 0.19 22 Aug 95 Added hme ethernet device +Version 0.18 8 Aug 95 Fixed init of kmem +Version 0.17 29 May 95 Added extra data to kmem rule +Version 0.16 16 May 95 Added print_lr_disk +Version 0.15 14 May 95 Bugfix dnlc and inode rules +Version 0.14 10 May 95 Fixed kmem to work on 2.3 +Version 0.13 7 May 95 Added new live rules, and thresh code +Version 0.12 24 Apr 95 Modified to remove live thresholds +Version 0.11 14 Apr 95 Added vmglobal_total function +Version 0.10 18 Mar 95 Added debug defines, fixed bugs +Version 0.9 16 Mar 95 Made local into GLOBAL storage - Adrian +Version 0.8 24 Feb 95 Fixes by Rich to recognise smc ethernets +Version 0.7 25 Jan 95 Made source classes global, added mutex +Version 0.6 18 Dec 94 Added swapspace and ram rules +Version 0.5 13 Dec 94 Added rpcc rule, fixed some bugs +Version 0.4 15 Nov 94 Created, matching pure_rules version + +Live Rules use the rules found in pure_rules.se but contain the code +to obtain the measurements and feed them into the rules using current +data measured on the live system. Each live rule is a class, with +output variables, threshold variables, private variables and code. No inputs +should be required apart from changes to any special live-only thresholds. + +Thresholds for the underlying pure rules are read from environment +variables when the pure rule is reset. Resetting the live rule causes +the pure rule to be reset. Use putenv if you must tweak them... + +Each rule has a state and an action, the state is the evaluated condition, +the action is a short text string that may indicate what should be done. +A longer string called an explanation may span multiple lines. + +Each live rule class type is lr_xxxx_t with active prefix lr_xxxx$ +for the code section. Each matches a pr_xxxx_t pure rule. + +The live_rules read directly from the vmstat_class and iostat_class etc, +to make the raw data available to programs that read a rule, and want to +show the same underlying numbers, the classes and temporary copies are +defined globally. Rich doesn't like globals, so I put GLOBAL in the +name of each variable to make it obvious that they are special. +Each GLOBAL active class has a GLOBAL_update_time so that multiple rules +that use it know that they don't have to reevaluate the data more often +than the specified UPDATE_RATE + +Include file dependencies - these should be included by the application: +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +*/ + +/* common string to use */ +string uninit = "Rule initializing..."; + +/* global iostat class and recorded data available for use */ +p_iostat p_iostat$GLOBAL_disk; +ks_sderr kstat$sderr; +ulong GLOBAL_disk_update_time; /* when last evaluated */ +#define DISK_UPDATE_RATE 2 /* 2 seconds between samples */ +/* GLOBAL_disk[0].disk_count indicates how many entries are valid */ +p_iostat GLOBAL_disk[]; /* on 2.6 partition data is excluded */ +ks_sderr GLOBAL_sderr[];/* MAX_DISK is bigger than needed */ +int GLOBAL_sderr_state[]; /* rule status */ +int GLOBAL_sderr_errcnt[]; /* total error count */ +int GLOBAL_disk_size = MAX_DISK; +int GLOBAL_sderr_size = MAX_DISK; +int GLOBAL_disk_count; + +/* global net class and recorded data available for use */ +p_netstat p_netstat$GLOBAL_net; +ulong GLOBAL_net_update_time; /* when last evaluated */ +#define NET_UPDATE_RATE 2 /* 2 seconds between samples */ +/* GLOBAL_net[0].net_count indicates how many entries are valid */ +p_netstat GLOBAL_net[MAX_IF]; + +/* global client rpc class available for use */ +ks_rpc_client kstat$GLOBAL_ks_rpc_client; +ulong GLOBAL_ks_rpc_client_update_time; +#define KS_RPC_CLIENT_UPDATE_RATE 1 /* 1 second between samples */ +ks_rpc_client GLOBAL_last_rpcc; +ks_rpc_client GLOBAL_this_rpcc; + +/* global per-cpu vmstat class and recorded data */ +p_vmstat p_vmstat$GLOBAL_pvm; +ulong GLOBAL_pvm_update_time; /* when last evaluated */ +#define PVM_UPDATE_RATE 2 /* 2 seconds between samples */ +int GLOBAL_pvm_ncpus; /* number of valid entries */ +p_vmstat GLOBAL_pvm[MAX_CPU]; + +/* function to total up global per_cpu data into vmstat form */ +p_vmstat vmglobal_total() { + int i; + double total; + p_vmstat pvm; + + pvm = GLOBAL_pvm[0]; + for(i=1; i < GLOBAL_pvm_ncpus; i++) { + pvm.pages_in += GLOBAL_pvm[i].pages_in; + pvm.pages_out += GLOBAL_pvm[i].pages_out; + pvm.interrupts += GLOBAL_pvm[i].interrupts; + pvm.system_calls += GLOBAL_pvm[i].system_calls; + pvm.context_switches += GLOBAL_pvm[i].context_switches; + pvm.user_time += GLOBAL_pvm[i].user_time; + pvm.system_time += GLOBAL_pvm[i].system_time; + pvm.wait_time += GLOBAL_pvm[i].wait_time; + pvm.idle_time += GLOBAL_pvm[i].idle_time; + pvm.scan += GLOBAL_pvm[i].scan; + pvm.smtx += GLOBAL_pvm[i].smtx; + } + if (GLOBAL_pvm_ncpus > 1) { + /* average over cpu count */ + pvm.user_time /= GLOBAL_pvm_ncpus; + pvm.system_time /= GLOBAL_pvm_ncpus; + pvm.wait_time /= GLOBAL_pvm_ncpus; + pvm.idle_time /= GLOBAL_pvm_ncpus; +#if MINOR_VERSION < 70 + /* reduce wait time - only one CPU can ever be waiting - others are idle */ + /* system counts all idle CPUs as waiting if any I/O is outstanding */ + pvm.wait_time /= GLOBAL_pvm_ncpus; +#endif + } + total = pvm.user_time + pvm.system_time + pvm.wait_time + pvm.idle_time; + if (total < 100.0) { + pvm.idle_time += (100.0 - total); + } + + /* Make sure that total is never greater than 100%. Better less + * than 100% than greater than 100%. */ + total = pvm.user_time + pvm.system_time + pvm.wait_time + pvm.idle_time; + if (total > 100.0) { + pvm.idle_time -= (total - 100.0); + } + return pvm; +} + +/* Disk I/O live rule - special extra disk type thresholds */ +rule_thresh_dbl slowfd_thr = {"LR_DISK_SLOW_FD", 10.0, "x", 4, 1, + "derate slow floppys" }; +rule_thresh_dbl slowcd_thr = {"LR_DISK_SLOW_CD", 10.0, "x", 4, 1, + "derate slow CDs" }; +rule_thresh_str fdname = {"LR_DISK_FLOPPY", "fd0", "", 6, "default floppy device" }; +rule_thresh_str cdname = {"LR_DISK_CDROM", "c0t6d0", "", 6, "default CD device" }; +rule_thresh_str diskerr_thr = {"LR_DISK_ERROR", "new", "", 4, "report on since boot, or only errors" }; + +print_lr_disk(ulong f) { + print_thresh_dbl(f, slowfd_thr); + print_thresh_dbl(f, slowcd_thr); + print_thresh_str(f, fdname); + print_thresh_str(f, cdname); + print_thresh_str(f, diskerr_thr); +} + +class lr_disk_t { + /* output variables */ + int state; + string action; + string explanation; + int disk_count; /* inicates how many entries are valid */ + int states[MAX_DISK]; /* per-disk state */ + string names[MAX_DISK]; /* dynamic arrays don't work here */ + /* threshold variables */ + string floppy; /* don't include floppy and CD in normal rules */ + string cdrom; + string diskerr_mode; + double slowfd; /* assume floppy and CD are slower */ + double slowcd; + + lr_disk$() { + pr_disk_t disk_rule; + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + int i; + int update; + int d; + int e; + int n; + string dname; + char dummy[32]; + +#ifdef LIVE_DISK_DEBUG + debug_on(); +#endif + if (timestamp == 0) { /* reset defaults */ + p_iostat$GLOBAL_disk.number$ = 0; + GLOBAL_disk = new p_iostat[GLOBAL_disk_size]; + GLOBAL_disk_count = 0; + for(i=0; ; i++) { + if (GLOBAL_disk_count == GLOBAL_disk_size) { + GLOBAL_disk_size += 4; + GLOBAL_disk = renew GLOBAL_disk[GLOBAL_disk_size]; + } + p_iostat$GLOBAL_disk.number$ = i; + GLOBAL_disk[GLOBAL_disk_count] = p_iostat$GLOBAL_disk; + if (GLOBAL_disk[GLOBAL_disk_count].number$ == -1) { + break; /* we have run out of io kstats */ + } + // ignore slices + if (strchr(GLOBAL_disk[GLOBAL_disk_count].info.long_name, 's') == nil) { + GLOBAL_disk_count++; + } + } + disk_count = GLOBAL_disk_count; + disk_rule.ndisks = GLOBAL_disk_count; + disk_rule.timestamp = 0; /* reset pure rule */ + refresh$(disk_rule); + state = ST_WHITE; + for(i=0; i < MAX_DISK; i++){ + states[i] = ST_WHITE; + } + action = uninit; + explanation = uninit; + slowfd = get_thresh_dbl(slowfd_thr); + slowcd = get_thresh_dbl(slowcd_thr); + floppy = get_thresh_str(fdname); + cdrom = get_thresh_str(cdname); + + diskerr_mode = get_thresh_str(diskerr_thr); + GLOBAL_sderr = new ks_sderr[GLOBAL_sderr_size]; + GLOBAL_sderr_state = new int[GLOBAL_sderr_size]; + GLOBAL_sderr_errcnt = new int[GLOBAL_sderr_size]; + + timestamp = time(0); + lasttime = timestamp; + GLOBAL_disk_update_time = timestamp; +#ifdef LIVE_DISK_DEBUG + debug_off(); +#endif + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + + if (timestamp - GLOBAL_disk_update_time >= DISK_UPDATE_RATE) { + update = 1; + } else { + update = 0; + } + /* use the disk rule - if there are no disks then one appears then */ + /* this code never sees it until the live_rule is reinitialized */ + /* its unlikely to happen so I kept the code simpler - Adrian */ + for(i=0; ; i++) { + /* some other rule may have already updated the GLOBAL recently */ + /* so don't reread the data, but do use the existing data */ + if (update == 1) { + if (i == GLOBAL_disk_size) { + GLOBAL_disk_size += 4; + GLOBAL_disk = renew GLOBAL_disk[GLOBAL_disk_size]; + } + p_iostat$GLOBAL_disk.number$ = GLOBAL_disk[i].number$; + GLOBAL_disk[i] = p_iostat$GLOBAL_disk; + GLOBAL_disk_update_time = timestamp; + if (GLOBAL_disk[i].number$ == -1) { + GLOBAL_disk_count = i; + break; + } else { + // skip it if it's a slice + if (strchr(GLOBAL_disk[i].info.long_name,'s') != nil) { + continue; /* go find another I/O record */ + } + } + } + + /* check that there is good data */ + if (GLOBAL_disk[i].number$ == -1) { + GLOBAL_disk_count = i; + break; + } + names[i] = GLOBAL_disk[i].info.long_name; + disk_rule.busy[i] = GLOBAL_disk[i].run_percent; + +/* note previous error and throughput, if no activity since error then +stay black, count new errors black, media/soft errors red */ + + if (names[i] == cdrom) { + disk_rule.svc_t[i] = GLOBAL_disk[i].service / slowcd; + } else { + if (names[i] == floppy) { + disk_rule.svc_t[i] = GLOBAL_disk[i].service / slowfd; + } else { + disk_rule.svc_t[i] = GLOBAL_disk[i].service; + } + } + } + disk_rule.timestamp = timestamp; + refresh$(disk_rule); + state = disk_rule.state; + action = disk_rule.action; + explanation = disk_rule.explanation; + disk_count = GLOBAL_disk_count; + for(i=0; i < disk_count; i++){ + states[i] = disk_rule.states[i]; + } +#ifdef LIVE_PRINTOUT + printf("\nDisk %-5s %s\n", state_string(state), action); + printf("disk r/s w/s Kr/s Kw/s wait actv svc_t %%w %%b State\n"); + for(i=0; i < GLOBAL_disk[0].disk_count; i++) { + printf("%-8.8s %4.1f %4.1f %6.1f %6.1f %4.1f %4.1f %6.1f %3.0f %3.0f %-5s\n", + names[i], + GLOBAL_disk[i].reads, GLOBAL_disk[i].writes, + GLOBAL_disk[i].kreads, GLOBAL_disk[i].kwrites, + GLOBAL_disk[i].avg_wait, GLOBAL_disk[i].avg_run, + GLOBAL_disk[i].service, + GLOBAL_disk[i].wait_percent, GLOBAL_disk[i].run_percent, + state_string(states[i])); + } +#endif + + /* now check for disk errors */ + /* if we find one then figure out which disk it is later */ + for(i=0; ; i++) { /* grab new data */ + if (i == GLOBAL_sderr_size) { + GLOBAL_sderr_size += 4; /* grow the arrays a bit */ + GLOBAL_sderr = renew GLOBAL_sderr[GLOBAL_sderr_size]; + GLOBAL_sderr_state = renew GLOBAL_sderr_state[GLOBAL_sderr_size]; + GLOBAL_sderr_errcnt = renew GLOBAL_sderr_errcnt[GLOBAL_sderr_size]; + } + kstat$sderr.number$ = i; + GLOBAL_sderr[i] = kstat$sderr; + if (GLOBAL_sderr[i].number$ == -1) { + break; + } + e = GLOBAL_sderr[i].Soft_Errors + GLOBAL_sderr[i].Hard_Errors + + GLOBAL_sderr[i].Transport_Errors; + if (e > (diskerr_mode == "new" ? GLOBAL_sderr_errcnt[i]: 0)) { + /* this disk needs a closer look */ + GLOBAL_sderr_errcnt[i] = e; + /* work out which disk it really is */ + d = strcspn(GLOBAL_sderr[i].name$, ","); + dname = strncpy(dummy, GLOBAL_sderr[i].name$, d); /* chop ,err */ +#ifdef FIND_INST + d = find_inst(dname); /* fast but buggy */ +#else + for(n=0; n < GLOBAL_disk_count; n++) { + if (dname == GLOBAL_disk[n].info.short_name) { + d = n; + break; + } + } +#endif + if (d != -1) { + dname = GLOBAL_disk[d].info.long_name; + } + /* process rules in order of increasing error level */ + if (GLOBAL_sderr[i].No_Device > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].No_Device, "green Warning - No Device - cprboot spinup?"); + GLOBAL_sderr_state[i] = ST_GREEN; + } + if (GLOBAL_sderr[i].Recoverable > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Recoverable, "amber - Recoverable Error Retry"); + GLOBAL_sderr_state[i] = ST_AMBER; + } + if (GLOBAL_sderr[i].Predictive_Failure_Analysis > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Predictive_Failure_Analysis, "red - Predictive_Failure_Analysis - Replace Disk"); + GLOBAL_sderr_state[i] = ST_RED; + } + // it's not uncommon for the CD to not be ready... richp + if (GLOBAL_sderr[i].Device_Not_Ready > 0 && dname != cdrom) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Device_Not_Ready, "black - Device Not Ready - disk offline?"); + GLOBAL_sderr_state[i] = ST_BLACK; + } + if (GLOBAL_sderr[i].Media_Error > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Media_Error, "black - Media Error - replace disk"); + GLOBAL_sderr_state[i] = ST_BLACK; + } + if (GLOBAL_sderr[i].Illegal_Request > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Illegal_Request, "black - Illegal Request Error"); + GLOBAL_sderr_state[i] = ST_BLACK; + } + /* update disk state */ + if (d != -1) { + if (states[d] < GLOBAL_sderr_state[i]) { + states[d] = GLOBAL_sderr_state[i]; + if (state < states[d]) { + state = states[d]; + } + switch(GLOBAL_sderr_state[i]) { + case ST_AMBER: + action = "Disk error warning - check disk"; + break; + case ST_RED: + action = "Disk error problem - replace disk"; + break; + case ST_BLACK: + action = "Disk failed - check cables or replace disk"; + } + } + } + } + } + + lasttime = timestamp; +#ifdef LIVE_DISK_DEBUG + debug_off(); +#endif + } +}; + +/* Network live rule - picks out ethernets only for now */ +/* reports anything else as green */ + +class lr_net_t { + /* output variables */ + int state; + string action; + string explanation; + int net_count; + int states[MAX_IF]; /* per-net state */ + string names[MAX_IF]; + int speeds[MAX_IF]; /* network speed in bytes/sec */ + /* make snapshot of pure rule available */ + pr_enet_t net_rule; + + lr_net$() { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + int i; + int update; + char ifname[12]; + int enet_count; + int net[MAX_IF]; /* index between ethernets and all nets */ + + if (timestamp == 0) { /* reset defaults */ + GLOBAL_net[0] = p_netstat$GLOBAL_net; + net_count = GLOBAL_net[0].net_count; + for(i=1; i < GLOBAL_net[0].net_count; i++){ + p_netstat$GLOBAL_net.number$ = i; + GLOBAL_net[i] = p_netstat$GLOBAL_net; + } + net_rule.enet_count = net_count; + net_rule.timestamp = 0; /* force pure rule to reset */ + refresh$(net_rule); + state = ST_GREEN; /* non-ethernets should default to ST_GREEN */ + for(i=0; i < MAX_IF; i++){ + states[i] = ST_GREEN; + } + action = uninit; + explanation = action; + timestamp = time(0); + lasttime = timestamp; + GLOBAL_net_update_time = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + + if (timestamp - GLOBAL_net_update_time >= NET_UPDATE_RATE) { + update = 1; + } else { + update = 0; + } + enet_count = 0; + for(i=0; i < GLOBAL_net[0].net_count; i++) { + if (update == 1) { + p_netstat$GLOBAL_net.number$ = i; + GLOBAL_net[i] = p_netstat$GLOBAL_net; + GLOBAL_net_update_time = timestamp; + } + names[i] = GLOBAL_net[i].name$; + ifname = GLOBAL_net[i].name$; + speeds[i] = GLOBAL_net[i].ifspeed; + if (GLOBAL_net[i].iftype == NT_CSMACD) { + net_rule.opackets[enet_count] = GLOBAL_net[i].opackets; + net_rule.collpercent[enet_count] = GLOBAL_net[i].collpercent; + net_rule.errors[i] = GLOBAL_net[i].ierrors + GLOBAL_net[i].oerrors; + net_rule.defer[i] = GLOBAL_net[i].defer; + net_rule.nocanput[i] = GLOBAL_net[i].nocanput; + net[enet_count++] = i; + } else { + /* XXX: add code to check FDDI, ATM, token ring here */ + states[i] = ST_GREEN; /* not an ethernet so assume its OK */ + } + } + net_rule.enet_count = enet_count; + net_rule.timestamp = timestamp; + refresh$(net_rule); + state = net_rule.state; + action = net_rule.action; + explanation = net_rule.explanation; + net_count = GLOBAL_net[0].net_count; + for(i=0; i < enet_count; i++){ + states[net[i]] = net_rule.states[i]; + } + lasttime = timestamp; + } +}; + + +/* NFS client RPC live rule */ + +class lr_rpcclient_t { + /* output variables */ + int state; + string action; + string explanation; + double calls; /* per second rates for info */ + double timeouts; + double badxids; + + lr_rpcclient$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_rpcclient_t rpcc_rule; + double ttmp; + double dtmp; + + if (timestamp == 0) { + rpcc_rule.timestamp = 0; + refresh$(rpcc_rule); + GLOBAL_last_rpcc = kstat$GLOBAL_ks_rpc_client; + action = uninit; + explanation = action; + state = ST_WHITE; + calls = 0.0; + timeouts = 0.0; + badxids = 0.0; + timestamp = time(0); + lasttime = timestamp; + GLOBAL_ks_rpc_client_update_time = lasttime; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + if (timestamp - GLOBAL_ks_rpc_client_update_time >= + KS_RPC_CLIENT_UPDATE_RATE) { + GLOBAL_this_rpcc = kstat$GLOBAL_ks_rpc_client; + GLOBAL_ks_rpc_client_update_time = lasttime; + } + ttmp = timestamp - lasttime; /* double temporaries */ + dtmp = GLOBAL_this_rpcc.calls - GLOBAL_last_rpcc.calls; + calls = dtmp / ttmp; + rpcc_rule.calls = calls; + dtmp = GLOBAL_this_rpcc.timeouts - GLOBAL_last_rpcc.timeouts; + timeouts = dtmp / ttmp; + rpcc_rule.timeouts = timeouts; + dtmp = GLOBAL_this_rpcc.badxids - GLOBAL_last_rpcc.badxids; + badxids = dtmp / ttmp; + rpcc_rule.badxids = badxids; + rpcc_rule.timestamp = timestamp; + refresh$(rpcc_rule); + state = rpcc_rule.state; + action = rpcc_rule.action; + explanation = rpcc_rule.explanation; + lasttime = timestamp; + GLOBAL_last_rpcc = GLOBAL_this_rpcc; + } +}; + + +/* shared function to update the global pvm data */ +pvm_update(ulong timestamp) { + int i; + + if (timestamp == 0 || timestamp - GLOBAL_pvm_update_time >= PVM_UPDATE_RATE) { + GLOBAL_pvm_ncpus = sysconf(_SC_NPROCESSORS_ONLN); + for(i = 0; i < GLOBAL_pvm_ncpus; i++) { + p_vmstat$GLOBAL_pvm.number$ = i; + GLOBAL_pvm[i] = p_vmstat$GLOBAL_pvm; + } + GLOBAL_pvm_update_time = timestamp; + } +} + +/* Virtual Memory - Swap Space - live rule */ +class lr_swapspace_t { + /* output variables */ + int state; + string action; + string explanation; + + lr_swapspace$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_swapspace_t swap_rule; + + if (timestamp == 0) { + timestamp = time(0); + pvm_update(timestamp); + swap_rule.swap_avail = GLOBAL_pvm[0].swap_avail; + swap_rule.timestamp = timestamp; + refresh$(swap_rule); + action = uninit; + explanation = uninit; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + pvm_update(timestamp); + swap_rule.swap_avail = GLOBAL_pvm[0].swap_avail; + swap_rule.timestamp = timestamp; + refresh$(swap_rule); + state = swap_rule.state; + action = swap_rule.action; + explanation = swap_rule.explanation; + lasttime = timestamp; + } +}; + + +/* Real Memory - RAM page residency - live rule using improved pure_rule */ +class lr_ram_t { + /* output variables */ + int state; + string action; + string explanation; + int restime; + ulong handspreadpages; /* estimated on startup, can be set if known */ + + lr_ram$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_ram_t ram_rule; + ulong pages; + + if (timestamp == 0) { + ram_rule.timestamp = 0; + /* default max handspread is 64MB worth of pages */ + handspreadpages = 64 * 1048576 / sysconf(_SC_PAGESIZE); + pages = sysconf(_SC_PHYS_PAGES); + if (handspreadpages > pages / 4) { + handspreadpages = pages / 4; + } + ram_rule.handspread = handspreadpages; + refresh$(ram_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + timestamp = time(0); + lasttime = timestamp; + pvm_update(timestamp); + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + pvm_update(timestamp); + ram_rule.handspread = handspreadpages; /* allow it to be changed */ + ram_rule.scan = GLOBAL_pvm[0].scan; + ram_rule.timestamp = timestamp; + refresh$(ram_rule); + state = ram_rule.state; + action = ram_rule.action; + explanation = ram_rule.explanation; + restime = ram_rule.restime; + lasttime = timestamp; + } +}; + +/* Kernel memory live rule */ +class lr_kmem_t { + /* output variables */ + int state; + string action; + string explanation; + ulong kmem_errors; + + lr_kmem$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + ks_kmem_misc kmem; + pr_kmem_t kmem_rule; + int pagesize = sysconf(_SC_PAGESIZE) / 1024; + + if (timestamp == 0) { + kmem_rule.timestamp = 0; + kmem_rule.freemem = 0; + refresh$(kmem); + kmem_errors = kmem.huge_alloc_fail + kmem.perm_alloc_fail; + kmem_rule.kmem_errs = kmem_errors; + refresh$(kmem_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + timestamp = time(0); + lasttime = timestamp; + pvm_update(timestamp); + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + pvm_update(timestamp); + refresh$(kmem); + kmem_errors = kmem.huge_alloc_fail + kmem.perm_alloc_fail; + kmem_rule.kmem_errs = kmem_errors; + kmem_rule.freemem = GLOBAL_pvm[0].freemem / pagesize; + kmem_rule.timestamp = timestamp; + refresh$(kmem_rule); + state = kmem_rule.state; + action = kmem_rule.action; + explanation = kmem_rule.explanation; + lasttime = timestamp; + } +}; + + +/* CPU power - live rule */ +class lr_cpu_t { + /* output variables */ + int state; + string action; + string explanation; + + lr_cpu$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_cpu_t cpu_rule; + + if (timestamp == 0) { + timestamp = time(0); + pvm_update(timestamp); + cpu_rule.ncpus = GLOBAL_pvm_ncpus; + cpu_rule.timestamp = 0; + refresh$(cpu_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + pvm_update(timestamp); + cpu_rule.runque = GLOBAL_pvm[0].runque; + cpu_rule.timestamp = timestamp; + refresh$(cpu_rule); + state = cpu_rule.state; + action = cpu_rule.action; + explanation = cpu_rule.explanation; + lasttime = timestamp; + } +}; + +/* mutex contention - live rule */ +class lr_mutex_t { + /* output variables */ + int state; + int states[MAX_CPU]; + string action; + string explanation; + int smtx; /* back compatible sum of p_vmstat.smtx for all cpus */ + int ncpus; /* i.e. sysconf(_SC_NPROCESSORS_ONLN) */ + + lr_mutex$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_mutex_t mutex_rule; + int i; + + if (timestamp == 0) { + timestamp = time(0); + pvm_update(timestamp); + ncpus = GLOBAL_pvm_ncpus; + mutex_rule.ncpus = ncpus; + mutex_rule.timestamp = 0; + refresh$(mutex_rule); + smtx = 0; + action = uninit; + explanation = action; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + pvm_update(timestamp); + /* use the rule */ + ncpus = GLOBAL_pvm_ncpus; + smtx = 0; + for(i = 0; i < ncpus; i++) { + smtx += GLOBAL_pvm[i].smtx; + mutex_rule.smtx[i] = GLOBAL_pvm[i].smtx; + mutex_rule.usr[i] = GLOBAL_pvm[i].user_time; + mutex_rule.sys[i] = GLOBAL_pvm[i].system_time; + } + mutex_rule.ncpus = ncpus; + mutex_rule.timestamp = timestamp; + refresh$(mutex_rule); + state = mutex_rule.state; + for(i = 0; i < ncpus; i++) { + states[i] = mutex_rule.states[i]; + } + action = mutex_rule.action; + explanation = mutex_rule.explanation; + lasttime = timestamp; + } +}; + +/* Directory Name Lookup Cache hit rate */ +class lr_dnlc_t { + /* output variables */ + int state; + string action; + string explanation; + double refrate; /* current DNLC reference rate */ + double hitrate; /* current DNLC hit rate */ + + lr_dnlc$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_dnlc_t dnlc_rule; + ks_ncstats ncstats; + int i; + + if (timestamp == 0) { + timestamp = time(0); + dnlc_rule.timestamp = 0; + refresh$(dnlc_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + refresh$(ncstats); + dnlc_rule.hits = ncstats.hits; + dnlc_rule.misses = ncstats.misses; + dnlc_rule.timestamp = timestamp; + refresh$(dnlc_rule); + state = dnlc_rule.state; + action = dnlc_rule.action; + explanation = dnlc_rule.explanation; + refrate = dnlc_rule.refrate; + hitrate = dnlc_rule.hitrate; + lasttime = timestamp; + } +}; + +/* Inode Cache hit rate */ +class lr_inode_t { + /* output variables */ + int state; + string action; + string explanation; + double refrate; /* current inode cache reference rate */ + double hitrate; /* current inode cache hit rate */ + double iprate; /* current inode w/page steal rate */ + + lr_inode$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_inode_t inode_rule; + ks_inode_cache inostats; + int i; + + if (timestamp == 0) { + timestamp = time(0); + inode_rule.timestamp = 0; + refresh$(inode_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + refresh$(inostats); + inode_rule.hits = inostats.hits; + inode_rule.misses = inostats.misses; + inode_rule.timestamp = timestamp; + refresh$(inode_rule); + state = inode_rule.state; + action = inode_rule.action; + explanation = inode_rule.explanation; + refrate = inode_rule.refrate; + hitrate = inode_rule.hitrate; + lasttime = timestamp; + } +}; Added: trunk/orca/lib/SE/3.3/live_rules.se ============================================================================== --- trunk/orca/lib/SE/3.3/live_rules.se (original) +++ trunk/orca/lib/SE/3.3/live_rules.se 2003-01-21 13:36:18.000000000 -0800 @@ -0,0 +1,977 @@ +// +// Copyright (c) 1995-1998, by Sun Microsystems, Inc. +// All Rights Reserved +// + +#ifndef _LIVE_RULES_SE_ +#define _LIVE_RULES_SE_ + +/* + +Written by Adrian Cockcroft, based on Appendix A of "Sun Performance +and Tuning", ISBN 0-13-095249-4 + +Version 1.8 31 May 99 Added disk errors to disk rule +Version 1.7 19 Mar 99 Make GLOBAL_disk a dynamic array +Version 1.6 17 Feb 99 Fixes to partition exclusion code +Version 1.5 25 Jul 98 Updated mutex rule data feed +Version 1.4 26 Dec 97 Fixes for disk_count in 2.6 disk rule +Version 1.3 7 Nov 97 Fixed handspread for ram rule +Version 1.2 23 Oct 97 Fixes for 2.6 partitions +Version 1.1 8 Oct 96 Use explanations from pure rules +Version 1.00 9 Aug 96 Extra info for new net_rule +Version 0.20 23 Aug 95 Added data rates to lr_rpcclient +Version 0.19 22 Aug 95 Added hme ethernet device +Version 0.18 8 Aug 95 Fixed init of kmem +Version 0.17 29 May 95 Added extra data to kmem rule +Version 0.16 16 May 95 Added print_lr_disk +Version 0.15 14 May 95 Bugfix dnlc and inode rules +Version 0.14 10 May 95 Fixed kmem to work on 2.3 +Version 0.13 7 May 95 Added new live rules, and thresh code +Version 0.12 24 Apr 95 Modified to remove live thresholds +Version 0.11 14 Apr 95 Added vmglobal_total function +Version 0.10 18 Mar 95 Added debug defines, fixed bugs +Version 0.9 16 Mar 95 Made local into GLOBAL storage - Adrian +Version 0.8 24 Feb 95 Fixes by Rich to recognise smc ethernets +Version 0.7 25 Jan 95 Made source classes global, added mutex +Version 0.6 18 Dec 94 Added swapspace and ram rules +Version 0.5 13 Dec 94 Added rpcc rule, fixed some bugs +Version 0.4 15 Nov 94 Created, matching pure_rules version + +Live Rules use the rules found in pure_rules.se but contain the code +to obtain the measurements and feed them into the rules using current +data measured on the live system. Each live rule is a class, with +output variables, threshold variables, private variables and code. No inputs +should be required apart from changes to any special live-only thresholds. + +Thresholds for the underlying pure rules are read from environment +variables when the pure rule is reset. Resetting the live rule causes +the pure rule to be reset. Use putenv if you must tweak them... + +Each rule has a state and an action, the state is the evaluated condition, +the action is a short text string that may indicate what should be done. +A longer string called an explanation may span multiple lines. + +Each live rule class type is lr_xxxx_t with active prefix lr_xxxx$ +for the code section. Each matches a pr_xxxx_t pure rule. + +The live_rules read directly from the vmstat_class and iostat_class etc, +to make the raw data available to programs that read a rule, and want to +show the same underlying numbers, the classes and temporary copies are +defined globally. Rich doesn't like globals, so I put GLOBAL in the +name of each variable to make it obvious that they are special. +Each GLOBAL active class has a GLOBAL_update_time so that multiple rules +that use it know that they don't have to reevaluate the data more often +than the specified UPDATE_RATE + +Include file dependencies - these should be included by the application: +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +*/ + +/* common string to use */ +string uninit = "Rule initializing..."; + +/* global iostat class and recorded data available for use */ +p_iostat p_iostat$GLOBAL_disk; +ks_sderr kstat$sderr; +ulong GLOBAL_disk_update_time; /* when last evaluated */ +#define DISK_UPDATE_RATE 2 /* 2 seconds between samples */ +/* GLOBAL_disk[0].disk_count indicates how many entries are valid */ +p_iostat GLOBAL_disk[]; /* on 2.6 partition data is excluded */ +ks_sderr GLOBAL_sderr[];/* MAX_DISK is bigger than needed */ +int GLOBAL_sderr_state[]; /* rule status */ +int GLOBAL_sderr_errcnt[]; /* total error count */ +int GLOBAL_disk_size = MAX_DISK; +int GLOBAL_sderr_size = MAX_DISK; +int GLOBAL_disk_count; + +/* global net class and recorded data available for use */ +p_netstat p_netstat$GLOBAL_net; +ulong GLOBAL_net_update_time; /* when last evaluated */ +#define NET_UPDATE_RATE 2 /* 2 seconds between samples */ +/* GLOBAL_net[0].net_count indicates how many entries are valid */ +p_netstat GLOBAL_net[MAX_IF]; + +/* global client rpc class available for use */ +ks_rpc_client kstat$GLOBAL_ks_rpc_client; +ulong GLOBAL_ks_rpc_client_update_time; +#define KS_RPC_CLIENT_UPDATE_RATE 1 /* 1 second between samples */ +ks_rpc_client GLOBAL_last_rpcc; +ks_rpc_client GLOBAL_this_rpcc; + +/* global per-cpu vmstat class and recorded data */ +p_vmstat p_vmstat$GLOBAL_pvm; +ulong GLOBAL_pvm_update_time; /* when last evaluated */ +#define PVM_UPDATE_RATE 2 /* 2 seconds between samples */ +int GLOBAL_pvm_ncpus; /* number of valid entries */ +p_vmstat GLOBAL_pvm[MAX_CPU]; + +/* function to total up global per_cpu data into vmstat form */ +p_vmstat vmglobal_total() { + int i; + double total; + p_vmstat pvm; + + pvm = GLOBAL_pvm[0]; + for(i=1; i < GLOBAL_pvm_ncpus; i++) { + pvm.pages_in += GLOBAL_pvm[i].pages_in; + pvm.pages_out += GLOBAL_pvm[i].pages_out; + pvm.interrupts += GLOBAL_pvm[i].interrupts; + pvm.system_calls += GLOBAL_pvm[i].system_calls; + pvm.context_switches += GLOBAL_pvm[i].context_switches; + pvm.user_time += GLOBAL_pvm[i].user_time; + pvm.system_time += GLOBAL_pvm[i].system_time; + pvm.wait_time += GLOBAL_pvm[i].wait_time; + pvm.idle_time += GLOBAL_pvm[i].idle_time; + pvm.scan += GLOBAL_pvm[i].scan; + pvm.smtx += GLOBAL_pvm[i].smtx; + } + if (GLOBAL_pvm_ncpus > 1) { + /* average over cpu count */ + pvm.user_time /= GLOBAL_pvm_ncpus; + pvm.system_time /= GLOBAL_pvm_ncpus; + pvm.wait_time /= GLOBAL_pvm_ncpus; + pvm.idle_time /= GLOBAL_pvm_ncpus; +#if MINOR_VERSION < 70 + /* reduce wait time - only one CPU can ever be waiting - others are idle */ + /* system counts all idle CPUs as waiting if any I/O is outstanding */ + pvm.wait_time /= GLOBAL_pvm_ncpus; +#endif + } + total = pvm.user_time + pvm.system_time + pvm.wait_time + pvm.idle_time; + if (total < 100.0) { + pvm.idle_time += (100.0 - total); + } + + /* Make sure that total is never greater than 100%. Better less + * than 100% than greater than 100%. */ + total = pvm.user_time + pvm.system_time + pvm.wait_time + pvm.idle_time; + if (total > 100.0) { + pvm.idle_time -= (total - 100.0); + } + return pvm; +} + +/* Disk I/O live rule - special extra disk type thresholds */ +rule_thresh_dbl slowfd_thr = {"LR_DISK_SLOW_FD", 10.0, "x", 4, 1, + "derate slow floppys" }; +rule_thresh_dbl slowcd_thr = {"LR_DISK_SLOW_CD", 10.0, "x", 4, 1, + "derate slow CDs" }; +rule_thresh_str fdname = {"LR_DISK_FLOPPY", "fd0", "", 6, "default floppy device" }; +rule_thresh_str cdname = {"LR_DISK_CDROM", "c0t6d0", "", 6, "default CD device" }; +rule_thresh_str diskerr_thr = {"LR_DISK_ERROR", "new", "", 4, "report on since boot, or only errors" }; + +print_lr_disk(ulong f) { + print_thresh_dbl(f, slowfd_thr); + print_thresh_dbl(f, slowcd_thr); + print_thresh_str(f, fdname); + print_thresh_str(f, cdname); + print_thresh_str(f, diskerr_thr); +} + +class lr_disk_t { + /* output variables */ + int state; + string action; + string explanation; + int disk_count; /* inicates how many entries are valid */ + int states[MAX_DISK]; /* per-disk state */ + string names[MAX_DISK]; /* dynamic arrays don't work here */ + /* threshold variables */ + string floppy; /* don't include floppy and CD in normal rules */ + string cdrom; + string diskerr_mode; + double slowfd; /* assume floppy and CD are slower */ + double slowcd; + + lr_disk$() { + pr_disk_t disk_rule; + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + int i; + int update; + int d; + int e; + int n; + string dname; + char dummy[32]; + +#ifdef LIVE_DISK_DEBUG + debug_on(); +#endif + if (timestamp == 0) { /* reset defaults */ + p_iostat$GLOBAL_disk.number$ = 0; + GLOBAL_disk = new p_iostat[GLOBAL_disk_size]; + GLOBAL_disk_count = 0; + for(i=0; ; i++) { + if (GLOBAL_disk_count == GLOBAL_disk_size) { + GLOBAL_disk_size += 4; + GLOBAL_disk = renew GLOBAL_disk[GLOBAL_disk_size]; + } + p_iostat$GLOBAL_disk.number$ = i; + GLOBAL_disk[GLOBAL_disk_count] = p_iostat$GLOBAL_disk; + if (GLOBAL_disk[GLOBAL_disk_count].number$ == -1) { + break; /* we have run out of io kstats */ + } + // ignore slices + if (strchr(GLOBAL_disk[GLOBAL_disk_count].info.long_name, 's') == nil) { + GLOBAL_disk_count++; + } + } + disk_count = GLOBAL_disk_count; + disk_rule.ndisks = GLOBAL_disk_count; + disk_rule.timestamp = 0; /* reset pure rule */ + refresh$(disk_rule); + state = ST_WHITE; + for(i=0; i < MAX_DISK; i++){ + states[i] = ST_WHITE; + } + action = uninit; + explanation = uninit; + slowfd = get_thresh_dbl(slowfd_thr); + slowcd = get_thresh_dbl(slowcd_thr); + floppy = get_thresh_str(fdname); + cdrom = get_thresh_str(cdname); + + diskerr_mode = get_thresh_str(diskerr_thr); + GLOBAL_sderr = new ks_sderr[GLOBAL_sderr_size]; + GLOBAL_sderr_state = new int[GLOBAL_sderr_size]; + GLOBAL_sderr_errcnt = new int[GLOBAL_sderr_size]; + + timestamp = time(0); + lasttime = timestamp; + GLOBAL_disk_update_time = timestamp; +#ifdef LIVE_DISK_DEBUG + debug_off(); +#endif + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + + if (timestamp - GLOBAL_disk_update_time >= DISK_UPDATE_RATE) { + update = 1; + } else { + update = 0; + } + /* use the disk rule - if there are no disks then one appears then */ + /* this code never sees it until the live_rule is reinitialized */ + /* its unlikely to happen so I kept the code simpler - Adrian */ + for(i=0; ; i++) { + /* some other rule may have already updated the GLOBAL recently */ + /* so don't reread the data, but do use the existing data */ + if (update == 1) { + if (i == GLOBAL_disk_size) { + GLOBAL_disk_size += 4; + GLOBAL_disk = renew GLOBAL_disk[GLOBAL_disk_size]; + } + p_iostat$GLOBAL_disk.number$ = GLOBAL_disk[i].number$; + GLOBAL_disk[i] = p_iostat$GLOBAL_disk; + GLOBAL_disk_update_time = timestamp; + if (GLOBAL_disk[i].number$ == -1) { + GLOBAL_disk_count = i; + break; + } else { + // skip it if it's a slice + if (strchr(GLOBAL_disk[i].info.long_name,'s') != nil) { + continue; /* go find another I/O record */ + } + } + } + + /* check that there is good data */ + if (GLOBAL_disk[i].number$ == -1) { + GLOBAL_disk_count = i; + break; + } + names[i] = GLOBAL_disk[i].info.long_name; + disk_rule.busy[i] = GLOBAL_disk[i].run_percent; + +/* note previous error and throughput, if no activity since error then +stay black, count new errors black, media/soft errors red */ + + if (names[i] == cdrom) { + disk_rule.svc_t[i] = GLOBAL_disk[i].service / slowcd; + } else { + if (names[i] == floppy) { + disk_rule.svc_t[i] = GLOBAL_disk[i].service / slowfd; + } else { + disk_rule.svc_t[i] = GLOBAL_disk[i].service; + } + } + } + disk_rule.timestamp = timestamp; + refresh$(disk_rule); + state = disk_rule.state; + action = disk_rule.action; + explanation = disk_rule.explanation; + disk_count = GLOBAL_disk_count; + for(i=0; i < disk_count; i++){ + states[i] = disk_rule.states[i]; + } +#ifdef LIVE_PRINTOUT + printf("\nDisk %-5s %s\n", state_string(state), action); + printf("disk r/s w/s Kr/s Kw/s wait actv svc_t %%w %%b State\n"); + for(i=0; i < GLOBAL_disk[0].disk_count; i++) { + printf("%-8.8s %4.1f %4.1f %6.1f %6.1f %4.1f %4.1f %6.1f %3.0f %3.0f %-5s\n", + names[i], + GLOBAL_disk[i].reads, GLOBAL_disk[i].writes, + GLOBAL_disk[i].kreads, GLOBAL_disk[i].kwrites, + GLOBAL_disk[i].avg_wait, GLOBAL_disk[i].avg_run, + GLOBAL_disk[i].service, + GLOBAL_disk[i].wait_percent, GLOBAL_disk[i].run_percent, + state_string(states[i])); + } +#endif + + /* now check for disk errors */ + /* if we find one then figure out which disk it is later */ + for(i=0; ; i++) { /* grab new data */ + if (i == GLOBAL_sderr_size) { + GLOBAL_sderr_size += 4; /* grow the arrays a bit */ + GLOBAL_sderr = renew GLOBAL_sderr[GLOBAL_sderr_size]; + GLOBAL_sderr_state = renew GLOBAL_sderr_state[GLOBAL_sderr_size]; + GLOBAL_sderr_errcnt = renew GLOBAL_sderr_errcnt[GLOBAL_sderr_size]; + } + kstat$sderr.number$ = i; + GLOBAL_sderr[i] = kstat$sderr; + if (GLOBAL_sderr[i].number$ == -1) { + break; + } + e = GLOBAL_sderr[i].Soft_Errors + GLOBAL_sderr[i].Hard_Errors + + GLOBAL_sderr[i].Transport_Errors; + if (e > (diskerr_mode == "new" ? GLOBAL_sderr_errcnt[i]: 0)) { + /* this disk needs a closer look */ + GLOBAL_sderr_errcnt[i] = e; + /* work out which disk it really is */ + d = strcspn(GLOBAL_sderr[i].name$, ","); + dname = strncpy(dummy, GLOBAL_sderr[i].name$, d); /* chop ,err */ +#ifdef FIND_INST + d = find_inst(dname); /* fast but buggy */ +#else + for(n=0; n < GLOBAL_disk_count; n++) { + if (dname == GLOBAL_disk[n].info.short_name) { + d = n; + break; + } + } +#endif + if (d != -1) { + dname = GLOBAL_disk[d].info.long_name; + } + /* process rules in order of increasing error level */ + if (GLOBAL_sderr[i].No_Device > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].No_Device, "green Warning - No Device - cprboot spinup?"); + GLOBAL_sderr_state[i] = ST_GREEN; + } + if (GLOBAL_sderr[i].Recoverable > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Recoverable, "amber - Recoverable Error Retry"); + GLOBAL_sderr_state[i] = ST_AMBER; + } + if (GLOBAL_sderr[i].Predictive_Failure_Analysis > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Predictive_Failure_Analysis, "red - Predictive_Failure_Analysis - Replace Disk"); + GLOBAL_sderr_state[i] = ST_RED; + } + // it's not uncommon for the CD to not be ready... richp + if (GLOBAL_sderr[i].Device_Not_Ready > 0 && dname != cdrom) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Device_Not_Ready, "black - Device Not Ready - disk offline?"); + GLOBAL_sderr_state[i] = ST_BLACK; + } + if (GLOBAL_sderr[i].Media_Error > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Media_Error, "black - Media Error - replace disk"); + GLOBAL_sderr_state[i] = ST_BLACK; + } + if (GLOBAL_sderr[i].Illegal_Request > 0) { + explanation = sprintf("%s\n\t%s\t%s\t%3d %s", explanation, + dname, GLOBAL_sderr[i].Product, + GLOBAL_sderr[i].Illegal_Request, "black - Illegal Request Error"); + GLOBAL_sderr_state[i] = ST_BLACK; + } + /* update disk state */ + if (d != -1) { + if (states[d] < GLOBAL_sderr_state[i]) { + states[d] = GLOBAL_sderr_state[i]; + if (state < states[d]) { + state = states[d]; + } + switch(GLOBAL_sderr_state[i]) { + case ST_AMBER: + action = "Disk error warning - check disk"; + break; + case ST_RED: + action = "Disk error problem - replace disk"; + break; + case ST_BLACK: + action = "Disk failed - check cables or replace disk"; + } + } + } + } + } + + lasttime = timestamp; +#ifdef LIVE_DISK_DEBUG + debug_off(); +#endif + } +}; + +/* Network live rule - picks out ethernets only for now */ +/* reports anything else as green */ + +class lr_net_t { + /* output variables */ + int state; + string action; + string explanation; + int net_count; + int states[MAX_IF]; /* per-net state */ + string names[MAX_IF]; + int speeds[MAX_IF]; /* network speed in bytes/sec */ + /* make snapshot of pure rule available */ + pr_enet_t net_rule; + + lr_net$() { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + int i; + int update; + char ifname[12]; + int enet_count; + int net[MAX_IF]; /* index between ethernets and all nets */ + + if (timestamp == 0) { /* reset defaults */ + GLOBAL_net[0] = p_netstat$GLOBAL_net; + net_count = GLOBAL_net[0].net_count; + for(i=1; i < GLOBAL_net[0].net_count; i++){ + p_netstat$GLOBAL_net.number$ = i; + GLOBAL_net[i] = p_netstat$GLOBAL_net; + } + net_rule.enet_count = net_count; + net_rule.timestamp = 0; /* force pure rule to reset */ + refresh$(net_rule); + state = ST_GREEN; /* non-ethernets should default to ST_GREEN */ + for(i=0; i < MAX_IF; i++){ + states[i] = ST_GREEN; + } + action = uninit; + explanation = action; + timestamp = time(0); + lasttime = timestamp; + GLOBAL_net_update_time = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + + if (timestamp - GLOBAL_net_update_time >= NET_UPDATE_RATE) { + update = 1; + } else { + update = 0; + } + enet_count = 0; + for(i=0; i < GLOBAL_net[0].net_count; i++) { + if (update == 1) { + p_netstat$GLOBAL_net.number$ = i; + GLOBAL_net[i] = p_netstat$GLOBAL_net; + GLOBAL_net_update_time = timestamp; + } + names[i] = GLOBAL_net[i].name$; + ifname = GLOBAL_net[i].name$; + speeds[i] = GLOBAL_net[i].ifspeed; + if (GLOBAL_net[i].iftype == NT_CSMACD) { + net_rule.opackets[enet_count] = GLOBAL_net[i].opackets; + net_rule.collpercent[enet_count] = GLOBAL_net[i].collpercent; + net_rule.errors[i] = GLOBAL_net[i].ierrors + GLOBAL_net[i].oerrors; + net_rule.defer[i] = GLOBAL_net[i].defer; + net_rule.nocanput[i] = GLOBAL_net[i].nocanput; + net[enet_count++] = i; + } else { + /* XXX: add code to check FDDI, ATM, token ring here */ + states[i] = ST_GREEN; /* not an ethernet so assume its OK */ + } + } + net_rule.enet_count = enet_count; + net_rule.timestamp = timestamp; + refresh$(net_rule); + state = net_rule.state; + action = net_rule.action; + explanation = net_rule.explanation; + net_count = GLOBAL_net[0].net_count; + for(i=0; i < enet_count; i++){ + states[net[i]] = net_rule.states[i]; + } + lasttime = timestamp; + } +}; + + +/* NFS client RPC live rule */ + +class lr_rpcclient_t { + /* output variables */ + int state; + string action; + string explanation; + double calls; /* per second rates for info */ + double timeouts; + double badxids; + + lr_rpcclient$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_rpcclient_t rpcc_rule; + double ttmp; + double dtmp; + + if (timestamp == 0) { + rpcc_rule.timestamp = 0; + refresh$(rpcc_rule); + GLOBAL_last_rpcc = kstat$GLOBAL_ks_rpc_client; + action = uninit; + explanation = action; + state = ST_WHITE; + calls = 0.0; + timeouts = 0.0; + badxids = 0.0; + timestamp = time(0); + lasttime = timestamp; + GLOBAL_ks_rpc_client_update_time = lasttime; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + if (timestamp - GLOBAL_ks_rpc_client_update_time >= + KS_RPC_CLIENT_UPDATE_RATE) { + GLOBAL_this_rpcc = kstat$GLOBAL_ks_rpc_client; + GLOBAL_ks_rpc_client_update_time = lasttime; + } + ttmp = timestamp - lasttime; /* double temporaries */ + dtmp = GLOBAL_this_rpcc.calls - GLOBAL_last_rpcc.calls; + calls = dtmp / ttmp; + rpcc_rule.calls = calls; + dtmp = GLOBAL_this_rpcc.timeouts - GLOBAL_last_rpcc.timeouts; + timeouts = dtmp / ttmp; + rpcc_rule.timeouts = timeouts; + dtmp = GLOBAL_this_rpcc.badxids - GLOBAL_last_rpcc.badxids; + badxids = dtmp / ttmp; + rpcc_rule.badxids = badxids; + rpcc_rule.timestamp = timestamp; + refresh$(rpcc_rule); + state = rpcc_rule.state; + action = rpcc_rule.action; + explanation = rpcc_rule.explanation; + lasttime = timestamp; + GLOBAL_last_rpcc = GLOBAL_this_rpcc; + } +}; + + +/* shared function to update the global pvm data */ +pvm_update(ulong timestamp) { + int i; + + if (timestamp == 0 || timestamp - GLOBAL_pvm_update_time >= PVM_UPDATE_RATE) { + GLOBAL_pvm_ncpus = sysconf(_SC_NPROCESSORS_ONLN); + for(i = 0; i < GLOBAL_pvm_ncpus; i++) { + p_vmstat$GLOBAL_pvm.number$ = i; + GLOBAL_pvm[i] = p_vmstat$GLOBAL_pvm; + } + GLOBAL_pvm_update_time = timestamp; + } +} + +/* Virtual Memory - Swap Space - live rule */ +class lr_swapspace_t { + /* output variables */ + int state; + string action; + string explanation; + + lr_swapspace$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_swapspace_t swap_rule; + + if (timestamp == 0) { + timestamp = time(0); + pvm_update(timestamp); + swap_rule.swap_avail = GLOBAL_pvm[0].swap_avail; + swap_rule.timestamp = timestamp; + refresh$(swap_rule); + action = uninit; + explanation = uninit; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + pvm_update(timestamp); + swap_rule.swap_avail = GLOBAL_pvm[0].swap_avail; + swap_rule.timestamp = timestamp; + refresh$(swap_rule); + state = swap_rule.state; + action = swap_rule.action; + explanation = swap_rule.explanation; + lasttime = timestamp; + } +}; + + +/* Real Memory - RAM page residency - live rule using improved pure_rule */ +class lr_ram_t { + /* output variables */ + int state; + string action; + string explanation; + int restime; + ulong handspreadpages; /* estimated on startup, can be set if known */ + + lr_ram$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_ram_t ram_rule; + ulong pages; + + if (timestamp == 0) { + ram_rule.timestamp = 0; + /* default max handspread is 64MB worth of pages */ + handspreadpages = 64 * 1048576 / sysconf(_SC_PAGESIZE); + pages = sysconf(_SC_PHYS_PAGES); + if (handspreadpages > pages / 4) { + handspreadpages = pages / 4; + } + ram_rule.handspread = handspreadpages; + refresh$(ram_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + timestamp = time(0); + lasttime = timestamp; + pvm_update(timestamp); + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + pvm_update(timestamp); + ram_rule.handspread = handspreadpages; /* allow it to be changed */ + ram_rule.scan = GLOBAL_pvm[0].scan; + ram_rule.timestamp = timestamp; + refresh$(ram_rule); + state = ram_rule.state; + action = ram_rule.action; + explanation = ram_rule.explanation; + restime = ram_rule.restime; + lasttime = timestamp; + } +}; + +/* Kernel memory live rule */ +class lr_kmem_t { + /* output variables */ + int state; + string action; + string explanation; + ulong kmem_errors; + + lr_kmem$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; +#if MINOR_VERSION < 80 + ks_kmem_misc kmem; +#else + ks_cache kmem; +#endif + pr_kmem_t kmem_rule; + int pagesize = sysconf(_SC_PAGESIZE) / 1024; + + if (timestamp == 0) { + kmem_rule.timestamp = 0; + kmem_rule.freemem = 0; + refresh$(kmem); +#if MINOR_VERSION < 80 + kmem_errors = kmem.huge_alloc_fail + kmem.perm_alloc_fail; +#else + for(kmem_errors=0, kmem.number$=0, refresh$(kmem); + kmem.number$ != -1; kmem.number$++, refresh$(kmem)) { + if (kmem.name$ =~ "kmem_alloc.*") { + kmem_errors += kmem.alloc_fail; + } + } +#endif + kmem_rule.kmem_errs = kmem_errors; + refresh$(kmem_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + timestamp = time(0); + lasttime = timestamp; + pvm_update(timestamp); + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + pvm_update(timestamp); + refresh$(kmem); +#if MINOR_VERSION < 80 + kmem_errors = kmem.huge_alloc_fail + kmem.perm_alloc_fail; +#else + for(kmem_errors=0, kmem.number$=0, refresh$(kmem); + kmem.number$ != -1; kmem.number$++, refresh$(kmem)) { + if (kmem.name$ =~ "kmem_alloc.*") { + kmem_errors += kmem.alloc_fail; + } + } +#endif + kmem_rule.kmem_errs = kmem_errors; + kmem_rule.freemem = GLOBAL_pvm[0].freemem / pagesize; + kmem_rule.timestamp = timestamp; + refresh$(kmem_rule); + state = kmem_rule.state; + action = kmem_rule.action; + explanation = kmem_rule.explanation; + lasttime = timestamp; + } +}; + + +/* CPU power - live rule */ +class lr_cpu_t { + /* output variables */ + int state; + string action; + string explanation; + + lr_cpu$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_cpu_t cpu_rule; + + if (timestamp == 0) { + timestamp = time(0); + pvm_update(timestamp); + cpu_rule.ncpus = GLOBAL_pvm_ncpus; + cpu_rule.timestamp = 0; + refresh$(cpu_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + pvm_update(timestamp); + cpu_rule.runque = GLOBAL_pvm[0].runque; + cpu_rule.timestamp = timestamp; + refresh$(cpu_rule); + state = cpu_rule.state; + action = cpu_rule.action; + explanation = cpu_rule.explanation; + lasttime = timestamp; + } +}; + +/* mutex contention - live rule */ +class lr_mutex_t { + /* output variables */ + int state; + int states[MAX_CPU]; + string action; + string explanation; + int smtx; /* back compatible sum of p_vmstat.smtx for all cpus */ + int ncpus; /* i.e. sysconf(_SC_NPROCESSORS_ONLN) */ + + lr_mutex$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_mutex_t mutex_rule; + int i; + + if (timestamp == 0) { + timestamp = time(0); + pvm_update(timestamp); + ncpus = GLOBAL_pvm_ncpus; + mutex_rule.ncpus = ncpus; + mutex_rule.timestamp = 0; + refresh$(mutex_rule); + smtx = 0; + action = uninit; + explanation = action; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + pvm_update(timestamp); + /* use the rule */ + ncpus = GLOBAL_pvm_ncpus; + smtx = 0; + for(i = 0; i < ncpus; i++) { + smtx += GLOBAL_pvm[i].smtx; + mutex_rule.smtx[i] = GLOBAL_pvm[i].smtx; + mutex_rule.usr[i] = GLOBAL_pvm[i].user_time; + mutex_rule.sys[i] = GLOBAL_pvm[i].system_time; + } + mutex_rule.ncpus = ncpus; + mutex_rule.timestamp = timestamp; + refresh$(mutex_rule); + state = mutex_rule.state; + for(i = 0; i < ncpus; i++) { + states[i] = mutex_rule.states[i]; + } + action = mutex_rule.action; + explanation = mutex_rule.explanation; + lasttime = timestamp; + } +}; + +/* Directory Name Lookup Cache hit rate */ +class lr_dnlc_t { + /* output variables */ + int state; + string action; + string explanation; + double refrate; /* current DNLC reference rate */ + double hitrate; /* current DNLC hit rate */ + + lr_dnlc$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_dnlc_t dnlc_rule; +#if MINOR_VERSION > 70 + ks_dnlcstats ncstats; +#else + ks_ncstats ncstats; +#endif + int i; + + if (timestamp == 0) { + timestamp = time(0); + dnlc_rule.timestamp = 0; + refresh$(dnlc_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + refresh$(ncstats); + dnlc_rule.hits = ncstats.hits; + dnlc_rule.misses = ncstats.misses; + dnlc_rule.timestamp = timestamp; + refresh$(dnlc_rule); + state = dnlc_rule.state; + action = dnlc_rule.action; + explanation = dnlc_rule.explanation; + refrate = dnlc_rule.refrate; + hitrate = dnlc_rule.hitrate; + lasttime = timestamp; + } +}; + +/* Inode Cache hit rate */ +class lr_inode_t { + /* output variables */ + int state; + string action; + string explanation; + double refrate; /* current inode cache reference rate */ + double hitrate; /* current inode cache hit rate */ + double iprate; /* current inode w/page steal rate */ + + lr_inode$() + { + ulong lasttime = 0; /* previous timestamp */ + ulong timestamp = 0; + pr_inode_t inode_rule; + ks_inode_cache inostats; + int i; + + if (timestamp == 0) { + timestamp = time(0); + inode_rule.timestamp = 0; + refresh$(inode_rule); + action = uninit; + explanation = action; + state = ST_WHITE; + lasttime = timestamp; + return; + } + timestamp = time(0); + if (timestamp == lasttime) { + return; /* wait at least a second between rule invocations */ + } + /* use the rule */ + refresh$(inostats); + inode_rule.hits = inostats.hits; + inode_rule.misses = inostats.misses; + inode_rule.timestamp = timestamp; + refresh$(inode_rule); + state = inode_rule.state; + action = inode_rule.action; + explanation = inode_rule.explanation; + refrate = inode_rule.refrate; + hitrate = inode_rule.hitrate; + lasttime = timestamp; + } +}; + +#endif