1

I am trying to solve the high CPU issue, when tracing one of lsphp process, I see the command getppid() take more than 1 second each execution. See trace log below:

strace: Process 21945 attached
     0.000000 select(5, 0x7fffadebf9e0, NULL, NULL, 0x7fffadebf9d0) = 0 (Timeout)
     0.992306 getppid()                 = 31441
     0.000169 select(5, 0x7fffadebf9e0, NULL, NULL, 0x7fffadebf9d0) = 1 (in [4], left 0x7fffadebf9d0)
     0.714351 accept(4, 0x7fffadebf920, 0x7fffadebf91c) = -1 EAGAIN (Resource temporarily unavailable)
     0.000121 select(5, 0x7fffadebf9e0, NULL, NULL, 0x7fffadebf9d0) = 0 (Timeout)
     1.000415 getppid()                 = 31441
     0.000030 select(5, 0x7fffadebf9e0, NULL, NULL, 0x7fffadebf9d0) = 0 (Timeout)
     1.001052 getppid()                 = 31441
     0.000030 select(5, 0x7fffadebf9e0, NULL, NULL, 0x7fffadebf9d0) = 0 (Timeout)
     1.000785 getppid()                 = 31441
     0.000083 select(5, 0x7fffadebf9e0, NULL, NULL, 0x7fffadebf9d0) = 0 (Timeout)
     1.000875 getppid()                 = 31441
     0.000038 select(5, 0x7fffadebf9e0, NULL, NULL, 0x7fffadebf9d0) = 0 (Timeout)

Can somebody tell me how can I reduce the time spent for this command?

1
  • It is actually the select calls that are taking about 1 second, probably because they are using a 1 second timeout. The relative timestamps show the time since the previous syscall. For example, try strace --relative-timestamps sleep 1 and look at the timestamps for clock_nanosleep and the syscall that follows it.
    – Ian Abbott
    Commented Jul 9 at 11:44

0