Top Level Namespace
Defined Under Namespace
Modules: Ucp
Instance Method Summary collapse
- #auth_handler(authreq) ⇒ Object
- #bench(test_name, test_code, *args) ⇒ Object
- #handle_me(smsreq) ⇒ Object
- #test_make_multi_ucps(msg_size) ⇒ Object
- #test_parse_str ⇒ Object
- #test_ucp30_basic_submit(msg_size) ⇒ Object
Instance Method Details
#auth_handler(authreq) ⇒ Object
38 39 40 41 |
# File 'lib/samples/main.rb', line 38 def auth_handler(authreq) puts "auth_handler [#{authreq.source_ip}:#{authreq.source_port}] (#{authreq.account},#{authreq.password})\n" return true end |
#bench(test_name, test_code, *args) ⇒ Object
36 37 38 39 40 |
# File 'lib/performance/stresser.rb', line 36 def bench(test_name,test_code,*args) total_runs = 1000 t=Benchmark.realtime { total_runs.times do; test_code.call(*args); end } puts "#{test_name}: #{(total_runs/t).to_i} req/sec" end |
#handle_me(smsreq) ⇒ Object
34 35 36 |
# File 'lib/samples/main.rb', line 34 def handle_me(smsreq) puts "handle_me [#{smsreq.source_ip}:#{smsreq.source_port}] (#{smsreq.originator},#{smsreq.recipient}) (#{smsreq.part_nr}/#{smsreq.total_parts}): #{smsreq.text}\n" end |
#test_make_multi_ucps(msg_size) ⇒ Object
49 50 51 |
# File 'lib/performance/stresser.rb', line 49 def test_make_multi_ucps(msg_size) UCP.make_multi_ucps(1235,961234568,"1234567890"*msg_size) end |
#test_parse_str ⇒ Object
44 45 46 47 |
# File 'lib/performance/stresser.rb', line 44 def test_parse_str ustr=2.chr+"01/00357/O/51/961234567/1234/////////////////4/1072/0031003200330034003500360037003800390030003100320033003400350036003700380039003000310032003300340035003600370038003900300031003200330034003500360037003800390030003100320033003400350036003700380039003000310032003300340035003600370038003900300031003200330034003500360037//////////0106050003450201020108///01"+3.chr ucp=UCP.parse_str(ustr) end |
#test_ucp30_basic_submit(msg_size) ⇒ Object
53 54 55 56 |
# File 'lib/performance/stresser.rb', line 53 def test_ucp30_basic_submit(msg_size) ucp=Ucp30Operation.new ucp.basic_submit(1234, 961234567, "z"*msg_size) end |