1

I've been profiling my linux app and in my single threaded build I noticed real/user/sys being 1900/1250/140. If I add up user and sys its 1390 which is far from 1900. 1900-is 510 which is a LARGE percentage.

What's considered as part of sys? I thought it was all system calls. After measuring some more it appears calling write takes up 500ms which is much larger than what sys is reporting and seems to be almost the entire missing time.

Stan
  • 161
  • 8
  • I'm not sure if this comment should be a question but what can I do while the OS is stalling for 500ms? I was thinking maybe creating a thread only to write might be a good idea? Or maybe I can mess with io_uring but I don't know if that's going to be more overhead than a thread if I only execute for about a second. I never tried nonblocking, if its a pipe with a child processes on the other end reading, can it be nonblocking or set up in a way with a large buffer so I don't get blocked as long? – Stan Dec 13 '22 at 01:28
  • 2
    Real includes time when your process is not running at all, because of timesharing. – Barmar Dec 13 '22 at 01:30
  • 1
    It also doesn't include time when you're blocked waiting for a slow device like a terminal or network. – Barmar Dec 13 '22 at 01:31
  • Looks like writing to file is fast and I was accidentally writing to the process. Is there a way I can have a larger pipe? – Stan Dec 13 '22 at 01:53
  • I think [ipe buffer size is configured when compiling the kernel, I don't think it can be modified dynamically. – Barmar Dec 13 '22 at 01:54
  • 1
    time is a builtin in bash. It's probably using wait3(2) to get the information it gives you. – John Dec 13 '22 at 03:12

0 Answers0