-
Notifications
You must be signed in to change notification settings - Fork 215
/
client.m
41 lines (32 loc) · 1.02 KB
/
client.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
%
% Copyright (c) ZeroC, Inc. All rights reserved.
%
function client()
addpath('generated');
if ~libisloaded('ice')
loadlibrary('ice', @iceproto);
end
import Demo.*;
try
% Initializes a communicator and then destroys it when cleanup is collected
communicator = Ice.initialize({'--Ice.Config=config.client'});
cleanup = onCleanup(@() communicator.destroy());
ping = PingPrx.checkedCast(communicator.propertyToProxy('Ping.Proxy'));
if isempty(ping)
fprintf('invalid proxy\n');
return;
end
repetitions = 50000;
fprintf('pinging server %d times (this may take a while)\n', repetitions);
tic();
for i = 1:repetitions
ping.ice_ping();
end
total = toc() * 1000.0;
fprintf('time for %d pings: %f ms\n', repetitions, total);
fprintf('time per ping: %f ms\n', total / repetitions);
catch ex
fprintf('%s\n', getReport(ex));
end
rmpath('generated');
end