Mercurial > hg > ltpda
comparison m-toolbox/test/aorepo_proto_test/test1.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 function test1() | |
2 | |
3 % Tests the submit and retrieve time Vs the number of AOs in the database. | |
4 % | |
5 % M Hewitson 25-07-07 | |
6 % | |
7 % $Id: test1.m,v 1.5 2008/03/01 14:53:31 hewitson Exp $ | |
8 % | |
9 | |
10 [conn, username] = mysql_connect('130.75.117.61', 'LTPDA2'); | |
11 | |
12 | |
13 % Make an AO | |
14 | |
15 | |
16 start_time = now; | |
17 | |
18 nsecs = 10; | |
19 fs = 10; | |
20 | |
21 pl = plist(); | |
22 pl = append(pl, param('nsecs', nsecs)); | |
23 pl = append(pl, param('fs', fs)); | |
24 pl = append(pl, param('tsfcn', 'randn(size(t))')); | |
25 a1 = ao(pl); | |
26 | |
27 % Run over N submit and retrieves | |
28 N = 1:50000; | |
29 S = zeros(size(N)); | |
30 R = zeros(size(N)); | |
31 T = zeros(size(N)); | |
32 | |
33 for n=N | |
34 | |
35 disp(' ') | |
36 disp(sprintf('*===== Test %d =========', n)) | |
37 disp(' ') | |
38 | |
39 [stime, rtime, status] = submitretrieve(conn, username, a1, n); | |
40 | |
41 S(n) = stime; | |
42 R(n) = rtime; | |
43 T(n) = status; | |
44 | |
45 stop_time = now; | |
46 results.start = start_time; | |
47 results.stop = stop_time; | |
48 results.S = S; | |
49 results.R = R; | |
50 results.T = T; | |
51 results.N = N; | |
52 | |
53 save 'test1_results.mat' results | |
54 end | |
55 | |
56 close(conn); | |
57 | |
58 %------------------------------------ | |
59 function [st, rt, status] = submitretrieve(conn, username, a, N) | |
60 | |
61 sinfo.conn = conn; | |
62 sinfo.username = username; | |
63 sinfo.experiment_title = 'Repository Test 1'; | |
64 sinfo.experiment_description = sprintf('Submit/retrieve of AO # %d', N); | |
65 sinfo.reference_ids = ''; | |
66 sinfo.additional_comments = ''; | |
67 sinfo.additional_authors = ''; | |
68 | |
69 % submit the ao | |
70 tic | |
71 [AOids, cid] = ltpda_obj_submit(a, sinfo); | |
72 st = toc; | |
73 | |
74 % retrieve the ao | |
75 tic | |
76 b = ltpda_obj_retrieve(conn, cid); | |
77 rt = toc; | |
78 | |
79 % check consistency | |
80 if a ~= b | |
81 status = 0; | |
82 else | |
83 status = 1; | |
84 end | |
85 | |
86 | |
87 | |
88 % END |