[Opensrf-commits] r1487 - in trunk: . examples src

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Nov 3 22:02:49 EST 2008


Author: dbs
Date: 2008-11-03 22:02:47 -0500 (Mon, 03 Nov 2008)
New Revision: 1487

Added:
   trunk/examples/math_bench.pl.in
   trunk/examples/math_client.py.in
   trunk/examples/multisession-test.pl.in
Removed:
   trunk/examples/math_bench.pl
   trunk/examples/math_client.py
   trunk/examples/multisession-test.pl
Modified:
   trunk/configure.ac
   trunk/src/Makefile.am
Log:
Replace in-place modification with built files; enables one to re-run configure multiple times

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2008-10-27 05:10:21 UTC (rev 1486)
+++ trunk/configure.ac	2008-11-04 03:02:47 UTC (rev 1487)
@@ -246,7 +246,11 @@
 #------------------------------------
 
 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 @@
                  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

Deleted: trunk/examples/math_bench.pl
===================================================================
--- trunk/examples/math_bench.pl	2008-10-27 05:10:21 UTC (rev 1486)
+++ trunk/examples/math_bench.pl	2008-11-04 03:02:47 UTC (rev 1487)
@@ -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";
-
-

Added: trunk/examples/math_bench.pl.in
===================================================================
--- trunk/examples/math_bench.pl.in	                        (rev 0)
+++ trunk/examples/math_bench.pl.in	2008-11-04 03:02:47 UTC (rev 1487)
@@ -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";
+
+


Property changes on: trunk/examples/math_bench.pl.in
___________________________________________________________________
Name: svn:executable
   + *

Deleted: trunk/examples/math_client.py
===================================================================
--- trunk/examples/math_client.py	2008-10-27 05:10:21 UTC (rev 1486)
+++ trunk/examples/math_client.py	2008-11-04 03:02:47 UTC (rev 1487)
@@ -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()

Added: trunk/examples/math_client.py.in
===================================================================
--- trunk/examples/math_client.py.in	                        (rev 0)
+++ trunk/examples/math_client.py.in	2008-11-04 03:02:47 UTC (rev 1487)
@@ -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()

Deleted: trunk/examples/multisession-test.pl
===================================================================
--- trunk/examples/multisession-test.pl	2008-10-27 05:10:21 UTC (rev 1486)
+++ trunk/examples/multisession-test.pl	2008-11-04 03:02:47 UTC (rev 1487)
@@ -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: ". at c."\n";
-print "Failed Commands: ". at 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";
-

Added: trunk/examples/multisession-test.pl.in
===================================================================
--- trunk/examples/multisession-test.pl.in	                        (rev 0)
+++ trunk/examples/multisession-test.pl.in	2008-11-04 03:02:47 UTC (rev 1487)
@@ -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: ". at c."\n";
+print "Failed Commands: ". at 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";
+


Property changes on: trunk/examples/multisession-test.pl.in
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2008-10-27 05:10:21 UTC (rev 1486)
+++ trunk/src/Makefile.am	2008-11-04 03:02:47 UTC (rev 1487)
@@ -55,10 +55,6 @@
 	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)/
 
 



More information about the opensrf-commits mailing list