-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.rb
More file actions
executable file
·50 lines (38 loc) · 1.19 KB
/
Client.rb
File metadata and controls
executable file
·50 lines (38 loc) · 1.19 KB
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
42
43
44
45
46
47
48
49
50
#!/usr/bin/env ruby
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************
require 'Ice'
Ice::loadSlice('Latency.ice')
class Client < Ice::Application
def run(args)
if args.length > 0
puts $0 + ": too many argumnets"
return 1
end
ping = Demo::PingPrx::checkedCast(Ice::Application::communicator().propertyToProxy('Ping.Proxy'))
if not ping
puts "invalid proxy"
return 1
end
# Initial ping to setup the connection.
ping.ice_ping()
repetitions = 100000
puts "pinging server " + repetitions.to_s + " times (this may take a while)"
tsec = Time.now
i = repetitions
while i >= 0
ping.ice_ping()
i = i - 1
end
tsec = Time.now - tsec
tmsec = tsec * 1000.0
printf "time for %d pings: %.3fms\n", repetitions, tmsec
printf "time per ping: %.3fms\n", tmsec / repetitions
return 0
end
end
app = Client.new
exit(app.main(ARGV, "config.client"))