diff m-toolbox/test/aorepo_proto_test/test2.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/aorepo_proto_test/test2.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,90 @@
+function test2()
+
+% Tests the submit and retrieve time Vs the size of AOs in the database.
+% 
+% M Hewitson 25-07-07
+% 
+% $Id: test2.m,v 1.4 2008/03/01 14:53:31 hewitson Exp $
+% 
+
+
+
+[conn, username] = mysql_connect('130.75.117.63', 'ltpda_test');
+
+% Make an AO
+
+% Run over N submit and retrieves
+Tmax = 40*3600;
+S = [];
+R = [];
+T = [];
+
+k = 1;
+N = 1;
+n = [];
+while N <= Tmax
+  
+  n(k)  = N;
+  nsecs = N;
+  fs    = 10;
+
+  pl = plist();
+  pl = append(pl, param('nsecs', nsecs));
+  pl = append(pl, param('fs', fs));
+  pl = append(pl, param('tsfcn', 'randn(size(t))'));
+  a1 = ao(pl);
+  
+  disp(' ')
+  disp(sprintf('*===== Test %d (%d secs) =========', k, N))
+  disp(' ')
+  
+  [stime, rtime, status] = submitretrieve(conn, username, a1, k);
+  
+  S(k) = stime;
+  R(k) = rtime;  
+  T(k) = status;
+  
+  results.S = S;
+  results.R = R;
+  results.T = T;
+  results.N = n;
+  
+  save 'test2_results_64bit.mat' results
+  
+  k = k + 1;
+  N = round(N * 1.2);
+end
+
+
+
+
+%------------------------------------
+function [st, rt, status] = submitretrieve(conn, username, a, N)
+
+sinfo.conn                   = conn;
+sinfo.username               = username;
+sinfo.experiment_title       = 'Repository Test 2';
+sinfo.experiment_description = sprintf('Submit/retrieve of AO # %d', N);
+sinfo.reference_ids          = '';
+sinfo.additional_comments    = '';
+sinfo.additional_authors     = '';
+
+% submit the ao
+tic
+[AOids, cid] = ltpda_obj_submit(a, sinfo);
+st = toc;
+
+% retrieve the ao
+tic
+b = ltpda_obj_retrieve(conn, cid);
+rt = toc;
+
+% check consistency
+if a ~= b
+    status = 0;
+else
+    status = 1;
+end
+
+
+% END
\ No newline at end of file