[Xorp-hackers] FEA performance improvements: only 'pull' active interfaces.

Ben Greear greearb at candelatech.com
Fri Mar 21 14:37:12 PDT 2008


Bruce M. Simpson wrote:

> In any event, XORP should now prefer the use of clock_gettime() in the 
> event loop where it's available, and trying to optimize the calls away 
> might not buy that much CPU back.
> 
> It is very easy to hose the event loop by making the wrong changes here, 
> speaking from experience.

You are correct that it is using clock_gettime, but it's still
a system call and I'd prefer to get rid of as many as those as
possible.

select(67, [15 16 17 25 26 27 28 29 30 31 32 33 34 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63 64 65 66], [54], [], {19, 872830}) = 2 (in [61], out [54], left {19, 872830})
clock_gettime(CLOCK_MONOTONIC, {952353, 316825858}) = 0
send(54, "STCP\1\1\0\4\27\330\0\3\0\0\0d\0\0\0\0\0\0\0\4\314\0\0\0", 28, MSG_NOSIGNAL) = 28
recvmsg(61, {msg_name(16)={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("10.25.26.25")}, msg_iov(1)=[{"E\300\0\314*\354\0\0\1Y\210\366\n\31\32\31\340\0\0\5\2\4\0\270\177\1\0\31\0\0\0\0"..., 65536}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 204
clock_gettime(CLOCK_MONOTONIC, {952353, 317042741}) = 0
clock_gettime(CLOCK_MONOTONIC, {952353, 317069312}) = 0
select(67, [15 16 17 25 26 27 28 29 30 31 32 33 34 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63 64 65 66], [], [], {19, 871169}) = 1 (in [66], left {19, 871169})
clock_gettime(CLOCK_MONOTONIC, {952353, 317322836}) = 0
read(66, "STCP\1\1\0\3\t\274\0\3\0\0\0d\0\0\0\0\0\0\0\4\314\0\0\0STCP"..., 193376) = 56
clock_gettime(CLOCK_MONOTONIC, {952353, 317437482}) = 0
clock_gettime(CLOCK_MONOTONIC, {952353, 317463985}) = 0
clock_gettime(CLOCK_MONOTONIC, {952353, 317489131}) = 0
clock_gettime(CLOCK_MONOTONIC, {952353, 317514145}) = 0
clock_gettime(CLOCK_MONOTONIC, {952353, 317548782}) = 0
select(67, [15 16 17 25 26 27 28 29 30 31 32 33 34 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63 64 65 66], [], [], {0, 0}) = 0 (Timeout)
clock_gettime(CLOCK_MONOTONIC, {952353, 317627603}) = 0
clock_gettime(CLOCK_MONOTONIC, {952353, 317654158}) = 0
clock_gettime(CLOCK_MONOTONIC, {952353, 317679387}) = 0
select(67, [15 16 17 25 26 27 28 29 30 31 32 33 34 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63 64 65 66], [], [], {19, 870559}) = 1 (in [54], left {19, 868000})
clock_gettime(CLOCK_MONOTONIC, {952353, 320980102}) = 0


But, it seems to me that we can *probably* fix up the code to only
grab time once, right after select() returns and then pass the 'now'
value to whatever code needs it.

This means that we might be off by a few ms here and there, but probably
this won't matter.

Anyway, I have some other issues to resolve before I start hacking
on this...

Thanks,
Ben


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



More information about the Xorp-hackers mailing list