<s> import time <EOL> import msgpackrpc <EOL> import multiprocessing <EOL> NUM_CALLS = <NUM_LIT> <EOL> def run_sum_server ( ) : <EOL> class SumServer ( object ) : <EOL> def sum ( self , x , y ) : <EOL> return x + y <EOL> server = msgpackrpc . Server ( SumServer ( ) ) <EOL> server . listen ( msgpackrpc . Address ( "<STR_LIT:localhost>" , <NUM_LIT> ) ) <EOL> server . start ( ) <EOL> def call ( ) : <EOL> client = msgpackrpc . Client ( msgpackrpc . Address ( "<STR_LIT:localhost>" , <NUM_LIT> ) ) <EOL> start = time . time ( ) <EOL> [ client . call ( '<STR_LIT>' , <NUM_LIT:1> , <NUM_LIT:2> ) for _ in xrange ( NUM_CALLS ) ] <EOL> print '<STR_LIT>' % ( NUM_CALLS / ( time . time ( ) - start ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> p = multiprocessing . Process ( target = run_sum_server ) <EOL> p . start ( ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> call ( ) <EOL> p . terminate ( ) </s>
