[Opensrf-commits] r1488 - in branches/rel_1_0: . examples src

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Nov 3 22:04:26 EST 2008


Author: dbs
Date: 2008-11-03 22:04:24 -0500 (Mon, 03 Nov 2008)
New Revision: 1488

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

Modified: branches/rel_1_0/configure.ac
===================================================================
--- branches/rel_1_0/configure.ac	2008-11-04 03:02:47 UTC (rev 1487)
+++ branches/rel_1_0/configure.ac	2008-11-04 03:04:24 UTC (rev 1488)
@@ -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: branches/rel_1_0/examples/math_bench.pl
===================================================================
--- branches/rel_1_0/examples/math_bench.pl	2008-11-04 03:02:47 UTC (rev 1487)
+++ branches/rel_1_0/examples/math_bench.pl	2008-11-04 03:04:24 UTC (rev 1488)
@@ -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";
-
-

Copied: branches/rel_1_0/examples/math_bench.pl.in (from rev 1487, trunk/examples/math_bench.pl.in)
===================================================================
--- branches/rel_1_0/examples/math_bench.pl.in	                        (rev 0)
+++ branches/rel_1_0/examples/math_bench.pl.in	2008-11-04 03:04:24 UTC (rev 1488)
@@ -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";
+
+

Deleted: branches/rel_1_0/examples/math_client.py
===================================================================
--- branches/rel_1_0/examples/math_client.py	2008-11-04 03:02:47 UTC (rev 1487)
+++ branches/rel_1_0/examples/math_client.py	2008-11-04 03:04:24 UTC (rev 1488)
@@ -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()

Copied: branches/rel_1_0/examples/math_client.py.in (from rev 1487, trunk/examples/math_client.py.in)
===================================================================
--- branches/rel_1_0/examples/math_client.py.in	                        (rev 0)
+++ branches/rel_1_0/examples/math_client.py.in	2008-11-04 03:04:24 UTC (rev 1488)
@@ -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: branches/rel_1_0/examples/multisession-test.pl
===================================================================
--- branches/rel_1_0/examples/multisession-test.pl	2008-11-04 03:02:47 UTC (rev 1487)
+++ branches/rel_1_0/examples/multisession-test.pl	2008-11-04 03:04:24 UTC (rev 1488)
@@ -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";
-

Copied: branches/rel_1_0/examples/multisession-test.pl.in (from rev 1487, trunk/examples/multisession-test.pl.in)
===================================================================
--- branches/rel_1_0/examples/multisession-test.pl.in	                        (rev 0)
+++ branches/rel_1_0/examples/multisession-test.pl.in	2008-11-04 03:04:24 UTC (rev 1488)
@@ -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";
+

Modified: branches/rel_1_0/src/Makefile.am
===================================================================
--- branches/rel_1_0/src/Makefile.am	2008-11-04 03:02:47 UTC (rev 1487)
+++ branches/rel_1_0/src/Makefile.am	2008-11-04 03:04:24 UTC (rev 1488)
@@ -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