summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-07-17 19:03:43 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-07-17 19:03:43 (GMT)
commit79d65106abab53203ad5c6ceda033f65eb2d3099 (patch)
treeccae5dbbda58bd5d9f48c3fd8a77dd3ad4a4e9dc /bin
parent6bea093682dff9ceba41f501010c513803da751a (diff)
downloadhdf5-79d65106abab53203ad5c6ceda033f65eb2d3099.zip
hdf5-79d65106abab53203ad5c6ceda033f65eb2d3099.tar.gz
hdf5-79d65106abab53203ad5c6ceda033f65eb2d3099.tar.bz2
[svn-r514] Changes since 19980715
---------------------- ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsplit.c Changed the allocation size request from `size_t' to `hsize_t' because it was overflowing for the `big' test. ./src/H5detect.c If `long double' and `double' are the same size then we define H5T_NATIVE_LDOUBLE to be the same as H5T_NATIVE_DOUBLE. Similarly for `long' vs. `long long' and `unsigned long' vs. `unsigned long long'. ./test/Makefile.in Added `big' to the list of tests to normally run. ./test/big.c Added a check to see if the file system supports holes and if it doesn't then the test is skipped. ./RELEASE Added a couple minor details details about API tracing and symbolic links. ./src/H5public.h Added comments about the use of hbool_t. Fixed a comment spelling error. ./test/testhdf5.h Changed the way the version number is printed. The old method was `hdf5-1.2.3d' and the new method is `hdf5 version 1.2 release 3' ./tools/h5ls.c Only prints the max dimension if it differs from the current dimension or if verbose mode is enabled. Added switches `-?', `-h', and `--help' to print a usage message. Added switches `-v' and `--verbose' to generate more verbose output. Added switches `-V' and `--version' to print the version number and exit. The version number is printed like: This is h5ls version 1.0 release 24' ./bin/h5vers [NEW] This script prints, sets, and/or increments the hdf5 version number. It can be run from the top directory or any of the child directories like src, tools, test, etc. Some examples: $ h5vers # Display current version 1.0.24 $ h5vers -v version 1.0 release 24 # Display current version. $ h5vers -s 5.2.8 # Set version and display 5.2.8 $ h5vers -s 2.1 2.1.0 $ h5vers -s hdf5-1.0.24a.tar.bz2 1.0.24 $ h5vers -s 'version 2.0 release 8' 2.0.8 $ h5vers -s 'junk 22 junk 33 more junk 66 and 99 junk' 33.66.99 $ h5vers -i major # Increment from 1.0.24 2.0.0 $ h5vers -i minor # Increment from 1.0.24 1.1.0 $ h5vers -i release # Increment from 1.0.24 1.0.25 $ h5vers ~/hdf5/src/H5public.h # Use an alternate file 1.0.24 ./bin/checkapi [NEW] Run from the src directory with arguments H5[A-Z]*.c and it will print the locations of each place where an API function was called from within the library. Use it as the compile or grep command under Emacs and you can C-x ` through the list. ./bin/debug-ohdr [NEW] Keeps track of H5O_open() and H5O_close() debugging messages and lists the file addresses of the object headers that are opened but never closed. You must enable the `o' debugging at configuration time and pipe stderr into this script. ./bin/errors Added a note to indicate that this script no longer works because of changes in the HRETURN_ERROR() and HGOTO_ERROR() macros. ./bin/iostats [NEW] Watches output from the Linux strace program and accumulates statistics about low-level access to an hdf5 file. The output is a list of 2d data points which can be plotted by gnuplot to show file seeking behavior. ./MANIFEST Added new files.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/checkapi35
-rwxr-xr-xbin/checkposix2
-rwxr-xr-xbin/debug-ohdr26
-rwxr-xr-xbin/errors3
-rwxr-xr-xbin/h5vers154
-rwxr-xr-xbin/iostats40
6 files changed, 260 insertions, 0 deletions
diff --git a/bin/checkapi b/bin/checkapi
new file mode 100755
index 0000000..7447b26
--- /dev/null
+++ b/bin/checkapi
@@ -0,0 +1,35 @@
+#!/usr/bin/perl -w
+require 5.003;
+
+# Purpose: insures that API functions aren't called internally.
+# Usage: checkapi H5*.c
+my $comment = 0;
+while (<>) {
+
+ # Remove comments within the line.
+ s/\/\*.*?\*\///g;
+
+ # Process comment begin and end tokens on this line.
+ $comment-- if /\*\//; # count comment ends
+ next if $comment; # skip line if in comment
+ $comment++ if /\/\*/; # count comment starts
+ s/(.*)\/\*.*/$1/; # remove comments that begin on this line
+
+ # Remove character strings
+ s/\\.//g; # remove escaped characters
+ s/\".*?\"//g; # remove string constants
+
+ # Disregard the following hits
+ next if /^H5/;
+ next if /^\#/;
+ next if /FUNC_ENTER/;
+
+ next unless /(H5[A-Z]{1,2}[a-z]\w*)/;
+ print "$ARGV:$.: $1\n";
+} continue {
+ if (eof) {
+ print "$ARGV:$.: bad comment nesting\n" if $comment;
+ $comment = 0;
+ close ARGV; # reset line number
+ }
+}
diff --git a/bin/checkposix b/bin/checkposix
index 229a106..ef2951b 100755
--- a/bin/checkposix
+++ b/bin/checkposix
@@ -35,6 +35,8 @@ while (<>) {
# Get rid of string constants if they begin and end on this line.
s/([\'\"])([^\1]|\\\1)*?\1/$1$1/g;
+ # Get rid of preprocessor directives
+ s/^\#.*//;
# Now find all function calls on this line
while (($name)=/\b([a-gi-z_A-GI-Z]\w*)\s*\(/) {
diff --git a/bin/debug-ohdr b/bin/debug-ohdr
new file mode 100755
index 0000000..f176a58
--- /dev/null
+++ b/bin/debug-ohdr
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+require 5.003;
+
+# Looks for lines emitted by H5O_open() and H5O_close() and tries to
+# determine which objects were not properly closed.
+
+while (<>) {
+ next unless /^([<>])(0x[\da-f]+|\d+)$/;
+ my ($op, $addr) = ($1, $2);
+
+ if ($op eq ">") {
+ # Open object
+ $obj{$addr} += 1;
+ } else {
+ # Close object
+ die unless $obj{$addr}>0;
+ $obj{$addr} -= 1;
+ delete $obj{$addr} unless $obj{$addr};
+ }
+}
+
+for (sort keys %obj) {
+ printf "%3d %s\n", $obj{$_}, $_;
+}
+
+exit 0;
diff --git a/bin/errors b/bin/errors
index 28585cd..1393226 100755
--- a/bin/errors
+++ b/bin/errors
@@ -2,6 +2,9 @@
require 5.003;
use Text::Tabs;
+# NOTE: THE FORMAT OF HRETURN_ERROR AND HGOTO_ERROR MACROS HAS
+# CHANGED. THIS SCRIPT NO LONGER WORKS! --rpm
+
# Copyright (C) 1997 National Center for Supercomputing Applications.
# All rights reserved.
#
diff --git a/bin/h5vers b/bin/h5vers
new file mode 100755
index 0000000..a4ddefc
--- /dev/null
+++ b/bin/h5vers
@@ -0,0 +1,154 @@
+#!/usr/bin/perl -w
+require 5.003;
+
+### Copyright © 1998 NCSA.
+# Robb Matzke <matzke@llnl.gov>
+# 17 July 1998
+
+### Purpose
+# Increments the hdf5 version number by changing the value of
+# constants in the src/H5public.h file. The new version number is
+# printed on the standard output. An alternate source file name can be
+# specified as an argument. In any case, the original file is saved
+# by appending a tilde `~' to the name.
+
+### Usage:
+# h5vers [OPTIONS] [FILE]
+
+# Without options this program only displays the current version and
+# doesn't modify any files or create backups. The default is to print
+# the version number as a dotted triple like `1.0.24' but with the
+# `-v' option the version will be printed as `version 1.0 release 24'.
+#
+# The `-s VERSION' switch will set the version as specified. If the
+# string contains a dotted triple then it will be used as the version
+# number, otherwise up to three numbers will be read from the end of
+# the string and used as the major version, minor version, and release
+# number. If any numbers are missing then zero is assumed. This
+# allows versions to be specified like `-s "version 2.1 release 8"' or
+# `-s hdf5-2.1.8.tar.bz2'. If the new version is less than the old
+# version then a warning message is generated on standard error.
+#
+# The `-i [major|minor|release]' option increments the major, minor,
+# or release (the default) number. If the minor number is incremented
+# then the release number is set to zero; if the major number is
+# incremented then the minor and release numbers are set to zero.
+#
+# If a file is specified then that file is used instead of
+# ./H5public.h or ./src/H5public.h.
+##############################################################################
+
+sub getvers {
+ local ($_) = @_;
+ my (@vers);
+
+ ($vers[0]) = /^\#\s*define\s+H5_VERS_MAJOR\s+(\d+)/m;
+ ($vers[1]) = /^\#\s*define\s+H5_VERS_MINOR\s+(\d+)/m;
+ ($vers[2]) = /^\#\s*define\s+H5_VERS_RELEASE\s+(\d+)/m;
+ return @vers;
+}
+
+sub setvers {
+ my ($contents, @vers) = @_;
+ $_[0] =~ s/^(\#\s*define\s+H5_VERS_MAJOR\s+)\d+/$1$vers[0]/m;
+ $_[0] =~ s/^(\#\s*define\s+H5_VERS_MINOR\s+)\d+/$1$vers[1]/m;
+ $_[0] =~ s/^(\#\s*define\s+H5_VERS_RELEASE\s+)\d+/$1$vers[2]/m;
+}
+
+# Parse arguments
+my ($verbose, $set, $inc, $file);
+my (@files) = ("H5public.h", "src/H5public.h", "../src/H5public.h");
+while ($_ = shift) {
+ $_ eq "-s" && do {
+ die "-s switch needs a version number\n" unless @ARGV;
+ $set = shift;
+ next;
+ };
+
+ $_ eq "-i" && do {
+ die "-i switch needs a value\n" unless @ARGV;
+ $inc = shift;
+ next;
+ };
+
+ $_ eq "-v" && do {
+ $verbose = 1;
+ next;
+ };
+
+
+ /^-/ && die "unrecognized option: $ARGV[0]\n";
+ die "only one file name can be specified\n" if $file;
+ $file = _;
+}
+die "mutually exclusive options given\n" if $set && $inc;
+
+# Determine file to use
+unless ($file) {
+ for (@files) {
+ ($file=$_,last) if -f $_;
+ }
+}
+die "unable to read file: $file\n" unless -r $file;
+
+# Get the current version number.
+open FILE, $file or die "unable to open $file: $!\n";
+my ($contents) = join "", <FILE>;
+close FILE;
+my (@curver) = getvers $contents;
+
+# Determine the new version number.
+if ($set) {
+ if ($set =~ /(\d+)\.(\d+)\.(\d+)/) {
+ @newver = ($1, $2, $3);
+ } elsif ($set =~ /(\d+)\D+(\d+)\D+(\d+)\D*$/) {
+ @newver = ($1, $2, $3);
+ } elsif ($set =~ /(\d+)\D+(\d+)\D*$/) {
+ @newver = ($1, $2, 0);
+ } elsif ($set =~ /(\d+)\D*$/) {
+ @newver = ($1, 0, 0);
+ } else {
+ die "illegal version number specified: $set\n";
+ }
+} elsif ($inc && $inc eq "major") {
+ $newver[0] = $curver[0]+1;
+ @newver[1,2] = (0,0);
+} elsif ($inc && $inc eq "minor") {
+ $newver[0] = $curver[0];
+ $newver[1] = $curver[1]+1;
+ $newver[2] = 0;
+} elsif ($inc && $inc eq "release") {
+ @newver[0,1] = @curver[0,1];
+ $newver[2] = $curver[2]+1;
+} elsif ($inc) {
+ die "unknown increment field: $inc\n";
+} else {
+ @newver = @curver;
+}
+
+# Print a warning if the version got smaller.
+if ($newver[0]*1000000 + $newver[1]*1000 + $newver[2] <
+ $curver[0]*1000000 + $curver[1]*1000 + $curver[2]) {
+ printf STDERR "Warning: version decreased from %d.%d.%d to %d.%d.%d\n",
+ @curver, @newver;
+}
+
+# Update the version number if it changed.
+if ($newver[0]!=$curver[0] ||
+ $newver[1]!=$curver[1] ||
+ $newver[2]!=$curver[2]) {
+ setvers $contents, @newver or die "unable to set version\n";
+ rename $file, "$file~" or die "unable to save backup file\n";
+ open FILE, ">$file" or die "unable to open $file but backup saved!\n";
+ print FILE $contents;
+ close FILE;
+}
+
+# Print the new version number
+if ($verbose) {
+ printf "version %d.%d release %d\n", @newver;
+} else {
+ printf "%d.%d.%d\n", @newver;
+}
+
+exit 0;
diff --git a/bin/iostats b/bin/iostats
new file mode 100755
index 0000000..924c273
--- /dev/null
+++ b/bin/iostats
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+# Usage: pipe the output of Linux's `strace' program into the stdin of
+# this command, and the output of this command into gnuplot.
+
+$filename = shift || "tstab2.h5";
+$total = 0;
+
+while (<>) {
+ if (!defined $fd) {
+ if (/^open\("(.*?)".*=\s+(\d+)/ && $1 eq $filename) {
+ $fd = $2;
+ $pos = 0;
+ }
+ } elsif (/^close\((\d+)/ && $1==$fd) {
+ $fd = undef;
+ } elsif (/^lseek\((\d+), -?\d+,.*= (\d+)/ &&
+ $1==$fd && $2>=0) {
+ $pos = $2;
+ } elsif (/^lseek\((\d+),/ && $1==$fd) {
+ die $_;
+ } elsif (/^write\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ &&
+ $1==$fd && $3>=0) {
+ my $nbytes = $3;
+ printf "%d %d\n", $total, $pos;
+ $pos += $nbytes;
+ $total += $nbytes;
+ } elsif (/^write\((\d+),/ && $1==$fd) {
+ die $_;
+ } elsif (/^read\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ &&
+ $1==$fd && $3>=0) {
+ my $nbytes = $3;
+ printf "%d %d\n", $total, $pos;
+ $pos += $nbytes;
+ $total += $nbytes;
+ } elsif (/^read\((\d+),/ && $1==$fd) {
+ die $_;
+ }
+}
+