Replace in-place modification with built files; enables one to re-run configure multi...
authordbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 4 Nov 2008 03:02:47 +0000 (03:02 +0000)
committerdbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 4 Nov 2008 03:02:47 +0000 (03:02 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1487 9efc2488-bf62-4759-914b-345cdb29e865

configure.ac
examples/math_bench.pl [deleted file]
examples/math_bench.pl.in [new file with mode: 0755]
examples/math_client.py [deleted file]
examples/math_client.py.in [new file with mode: 0644]
examples/multisession-test.pl [deleted file]
examples/multisession-test.pl.in [new file with mode: 0755]
src/Makefile.am

index a7a1180..6aacae5 100644 (file)
@@ -246,7 +246,11 @@ AC_CHECK_FUNCS([bzero dup2 gethostbyname gethostname gettimeofday memset select
 #------------------------------------
 
 AC_CONFIG_FILES([Makefile
+                 doc/dokuwiki-doc-stubber.pl
                  examples/math_xul_client/Makefile
+                 examples/math_bench.pl
+                 examples/math_client.py
+                 examples/multisession-test.pl
                  src/Makefile
                  src/c-apps/Makefile
                  src/gateway/Makefile
@@ -257,7 +261,7 @@ AC_CONFIG_FILES([Makefile
                  src/python/Makefile
                  src/router/Makefile
                  src/srfsh/Makefile
-                bin/osrf_config], [if test -e "./bin/osrf_config"; then chmod 755 bin/osrf_config; fi])
+                 bin/osrf_config], [if test -e "./bin/osrf_config"; then chmod 755 bin/osrf_config; fi])
 
 
 AC_OUTPUT
diff --git a/examples/math_bench.pl b/examples/math_bench.pl
deleted file mode 100755 (executable)
index 6dd94ac..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/perl
-use strict; use warnings;
-use OpenSRF::System;
-use Time::HiRes qw/time/;
-use OpenSRF::Utils::Logger;
-my $log = "OpenSRF::Utils::Logger";
-
-# Test script which runs queries agains the opensrf.math service and reports on
-# the average round trip time of the requests.
-
-# how many batches of 4 requests do we send
-my $count = $ARGV[0];
-print "usage: $0 <num_requests>\n" and exit unless $count;
-
-# * connect to the Jabber network
-OpenSRF::System->bootstrap_client( config_file => "SYSCONFDIR/opensrf_core.xml" );
-$log->set_service('math_bench');
-
-# * create a new application session for the opensrf.math service
-my $session = OpenSRF::AppSession->create( "opensrf.math" );
-
-my @times; # "delta" times for each round trip
-
-# we're gonna call methods "add", "sub", "mult", and "div" with
-# params 1, 2.  The hash below maps the method name to the 
-# expected response value
-my %vals = ( add => 3, sub => -1, mult => 2, div => 0.5 );
-
-# print the counter grid 
-for my $x (1..100) {
-       if( $x % 10 ) { print ".";}
-       else{ print $x/10; };
-}
-print "\n";
-
-my $c = 0;
-
-for my $scale ( 1..$count ) {
-       for my $mname ( keys %vals ) { # cycle through add, sub, mult, and div
-
-               my $starttime = time();
-
-               # * Fires the request and gathers the response object, which in this case
-               # is just a string
-               my $resp = $session->request( $mname, 1, 2 )->gather(1);
-               push @times, time() - $starttime;
-
-
-               if( "$resp" eq $vals{$mname} ) { 
-                       # we got the response we expected
-                       print "+"; 
-
-               } elsif($resp) { 
-                       # we got some other response     
-                       print "\n* BAD Data:  $resp\n";
-
-               } else { 
-                       # we got no data
-                       print "Received nothing\n";     
-               }
-
-               $c++;
-
-       }
-
-       print " [$c] \n" unless $scale % 25;
-}
-
-my $total = 0;
-
-$total += $_ for (@times);
-
-$total /= scalar(@times);
-
-print "\n\n\tAverage Round Trip Time: $total Seconds\n";
-
-
diff --git a/examples/math_bench.pl.in b/examples/math_bench.pl.in
new file mode 100755 (executable)
index 0000000..5831e71
--- /dev/null
@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+use strict; use warnings;
+use OpenSRF::System;
+use Time::HiRes qw/time/;
+use OpenSRF::Utils::Logger;
+my $log = "OpenSRF::Utils::Logger";
+
+# Test script which runs queries agains the opensrf.math service and reports on
+# the average round trip time of the requests.
+
+# how many batches of 4 requests do we send
+my $count = $ARGV[0];
+print "usage: $0 <num_requests>\n" and exit unless $count;
+
+# * connect to the Jabber network
+OpenSRF::System->bootstrap_client( config_file => "@sysconfdir@/opensrf_core.xml" );
+$log->set_service('math_bench');
+
+# * create a new application session for the opensrf.math service
+my $session = OpenSRF::AppSession->create( "opensrf.math" );
+
+my @times; # "delta" times for each round trip
+
+# we're gonna call methods "add", "sub", "mult", and "div" with
+# params 1, 2.  The hash below maps the method name to the 
+# expected response value
+my %vals = ( add => 3, sub => -1, mult => 2, div => 0.5 );
+
+# print the counter grid 
+for my $x (1..100) {
+       if( $x % 10 ) { print ".";}
+       else{ print $x/10; };
+}
+print "\n";
+
+my $c = 0;
+
+for my $scale ( 1..$count ) {
+       for my $mname ( keys %vals ) { # cycle through add, sub, mult, and div
+
+               my $starttime = time();
+
+               # * Fires the request and gathers the response object, which in this case
+               # is just a string
+               my $resp = $session->request( $mname, 1, 2 )->gather(1);
+               push @times, time() - $starttime;
+
+
+               if( "$resp" eq $vals{$mname} ) { 
+                       # we got the response we expected
+                       print "+"; 
+
+               } elsif($resp) { 
+                       # we got some other response     
+                       print "\n* BAD Data:  $resp\n";
+
+               } else { 
+                       # we got no data
+                       print "Received nothing\n";     
+               }
+
+               $c++;
+
+       }
+
+       print " [$c] \n" unless $scale % 25;
+}
+
+my $total = 0;
+
+$total += $_ for (@times);
+
+$total /= scalar(@times);
+
+print "\n\n\tAverage Round Trip Time: $total Seconds\n";
+
+
diff --git a/examples/math_client.py b/examples/math_client.py
deleted file mode 100644 (file)
index 8e3587a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-import osrf.system
-import osrf.ses
-
-# XXX: Replace with command line arguments
-file = '/openils/conf/opensrf_core.xml'
-operator = 'add'
-operand1 = 5
-operand2 = 7
-
-# Pull connection settings from <config><opensrf> section of opensrf_core.xml
-osrf.system.System.connect(config_file=file, config_context='config.opensrf')
-
-# Set up a connection to the opensrf.math service
-session = osrf.ses.ClientSession('opensrf.math')
-
-# Call one of the methods defined by the opensrf.math service
-request = session.request(operator, operand1, operand2)
-
-# Retrieve the response from the method
-response = request.recv(timeout=2)
-
-print(response.content())
-
-# Cleanup request and connection resources
-request.cleanup()
-session.cleanup()
diff --git a/examples/math_client.py.in b/examples/math_client.py.in
new file mode 100644 (file)
index 0000000..77d5885
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+import osrf.system
+import osrf.ses
+
+# XXX: Replace with command line arguments
+file = '@sysconfdir@/opensrf_core.xml'
+operator = 'add'
+operand1 = 5
+operand2 = 7
+
+# Pull connection settings from <config><opensrf> section of opensrf_core.xml
+osrf.system.System.connect(config_file=file, config_context='config.opensrf')
+
+# Set up a connection to the opensrf.math service
+session = osrf.ses.ClientSession('opensrf.math')
+
+# Call one of the methods defined by the opensrf.math service
+request = session.request(operator, operand1, operand2)
+
+# Retrieve the response from the method
+response = request.recv(timeout=2)
+
+print(response.content())
+
+# Cleanup request and connection resources
+request.cleanup()
+session.cleanup()
diff --git a/examples/multisession-test.pl b/examples/multisession-test.pl
deleted file mode 100755 (executable)
index 01ad495..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/perl
-use lib 'LIBDIR/perl5/';
-use OpenSRF::System;
-use OpenILS::Application::AppUtils;
-use OpenILS::Event;
-use OpenSRF::EX qw/:try/;
-use OpenSRF::Utils::JSON;
-use Data::Dumper;
-use OpenILS::Utils::Fieldmapper;
-use Digest::MD5 qw/md5_hex/;
-use OpenSRF::Utils qw/:daemon/;
-use OpenSRF::MultiSession;
-use OpenSRF::AppSession;
-use Time::HiRes qw/time/;
-
-my $config = shift;
-
-unless (-e $config) {
-       die "Gimme a config file!!!";
-}
-OpenSRF::System->bootstrap_client( config_file => $config );
-
-if (!@ARGV) {
-       @ARGV = ('open-ils.storage','opensrf.system.echo');
-}
-
-my $app = shift;
-
-my $count = 100;
-
-my $overhead = time;
-
-my $mses = OpenSRF::MultiSession->new( app => $app, cap => 10, api_level => 1 );
-
-$mses->success_handler(
-       sub {
-               my $ses = shift;
-               my $req = shift;
-               print $req->{params}->[0] . "\t: " . OpenSRF::Utils::JSON->perl2JSON($req->{response}->[0]->content)."\n";
-       }
-);
-
-$mses->failure_handler(
-       sub {
-               my $ses = shift;
-               my $req = shift;
-               warn "record $req->{params}->[0] failed: " . OpenSRF::Utils::JSON->perl2JSON($req->{response});
-       }
-);
-
-
-$mses->connect;
-
-my $start = time;
-$overhead = $start - $overhead;
-
-for (1 .. $count) {
-       $mses->request( @ARGV,$_ );
-}
-$mses->session_wait(1);
-$mses->disconnect;
-
-my $end = time;
-
-my @c = $mses->completed;
-my @f = $mses->failed;
-
-my $x = 0;
-$x += $_->{duration} for (@c);
-
-print "\n". '-'x40 . "\n";
-print "Startup Overhead: ".sprintf('%0.3f',$overhead)."s\n";
-print "Completed Commands: ".@c."\n";
-print "Failed Commands: ".@f."\n";
-print "Serial Run Time: ".sprintf('%0.3f',$x)."s\n";
-print "Serial Avg Time: ".sprintf('%0.3f',$x/$count)."s\n";
-print "Total Run Time: ".sprintf('%0.3f',$end-$start)."s\n";
-print "Total Avg Time: ".sprintf('%0.3f',($end-$start)/$count)."s\n";
-
diff --git a/examples/multisession-test.pl.in b/examples/multisession-test.pl.in
new file mode 100755 (executable)
index 0000000..e571d96
--- /dev/null
@@ -0,0 +1,79 @@
+#!/usr/bin/perl
+use lib '@libdir@/perl5/';
+use OpenSRF::System;
+use OpenILS::Application::AppUtils;
+use OpenILS::Event;
+use OpenSRF::EX qw/:try/;
+use OpenSRF::Utils::JSON;
+use Data::Dumper;
+use OpenILS::Utils::Fieldmapper;
+use Digest::MD5 qw/md5_hex/;
+use OpenSRF::Utils qw/:daemon/;
+use OpenSRF::MultiSession;
+use OpenSRF::AppSession;
+use Time::HiRes qw/time/;
+
+my $config = shift;
+
+unless (-e $config) {
+       die "Gimme a config file!!!";
+}
+OpenSRF::System->bootstrap_client( config_file => $config );
+
+if (!@ARGV) {
+       @ARGV = ('open-ils.storage','opensrf.system.echo');
+}
+
+my $app = shift;
+
+my $count = 100;
+
+my $overhead = time;
+
+my $mses = OpenSRF::MultiSession->new( app => $app, cap => 10, api_level => 1 );
+
+$mses->success_handler(
+       sub {
+               my $ses = shift;
+               my $req = shift;
+               print $req->{params}->[0] . "\t: " . OpenSRF::Utils::JSON->perl2JSON($req->{response}->[0]->content)."\n";
+       }
+);
+
+$mses->failure_handler(
+       sub {
+               my $ses = shift;
+               my $req = shift;
+               warn "record $req->{params}->[0] failed: " . OpenSRF::Utils::JSON->perl2JSON($req->{response});
+       }
+);
+
+
+$mses->connect;
+
+my $start = time;
+$overhead = $start - $overhead;
+
+for (1 .. $count) {
+       $mses->request( @ARGV,$_ );
+}
+$mses->session_wait(1);
+$mses->disconnect;
+
+my $end = time;
+
+my @c = $mses->completed;
+my @f = $mses->failed;
+
+my $x = 0;
+$x += $_->{duration} for (@c);
+
+print "\n". '-'x40 . "\n";
+print "Startup Overhead: ".sprintf('%0.3f',$overhead)."s\n";
+print "Completed Commands: ".@c."\n";
+print "Failed Commands: ".@f."\n";
+print "Serial Run Time: ".sprintf('%0.3f',$x)."s\n";
+print "Serial Avg Time: ".sprintf('%0.3f',$x/$count)."s\n";
+print "Total Run Time: ".sprintf('%0.3f',$end-$start)."s\n";
+print "Total Avg Time: ".sprintf('%0.3f',($end-$start)/$count)."s\n";
+
index 4dd2d9e..7a75064 100644 (file)
@@ -55,10 +55,6 @@ install-exec-hook:
        sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
        sed -i 's|LOCALSTATEDIR|$(VAR)|g' '$(DESTDIR)@sysconfdir@/srfsh.xml.example'
        sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '$(DESTDIR)@sysconfdir@/srfsh.xml.example'
-       sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '@abs_top_srcdir@/examples/math_bench.pl'
-       sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '@abs_top_srcdir@/examples/math_client.py'
-       sed -i 's|LIBDIR|$(LIBDIR)|g' '@abs_top_srcdir@/examples/multisession-test.pl'
-       sed -i 's|SYSCONFDIR|$(ETCDIR)|g' '@abs_top_srcdir@/doc/dokuwiki-doc-stubber.pl'
        cp -r @srcdir@/javascript/* $(jsdir)/