view m-toolbox/test/aorepo_proto_test/test2.m @ 20:d58813ab1b92 database-connection-manager

Update ltpda_uo.submit
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

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