Behavior of base::ThreadTicks and blocking IO

172 views
Skip to first unread message

Charles Harrison

unread,
Jun 10, 2024, 11:00:56 PMJun 10
to scheduler-dev, Daniel Cheng
Hello scheduler-dev@,
dcheng pointed me your way with this question. I was wondering if base::ThreadTicks counts the time a thread is doing blocking IO? e.g. if I read() a large file, will ThreadTicks count that time?

My sense from reading the documentation from CLOCK_THREAD_CPUTIME_ID on linux is that no, it will not. Can you confirm?

Regardless of the answer, I would be happy to improve the documentation in time.h. Thanks!

Wez

unread,
Jun 11, 2024, 4:06:15 AMJun 11
to Charles Harrison, scheduler-dev, Daniel Cheng
Normally thread-time is time spent scheduled on the CPU, so doesn't include time spent blocked on I/O, ready-to-run, etc.

ThreadTicks documentation says:
// `ThreadTicks` will "stand still" whenever the thread has been de-scheduled
// by the operating system.
so I think you can assume that that is an invariant across the platforms Chromium supports.

--
You received this message because you are subscribed to the Google Groups "scheduler-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheduler-de...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/scheduler-dev/CADjAqN5j1AtEQ7N2JJLg6o4m5mtpO%2BmTcg3-dWyGdGqM_Dx3Nw%40mail.gmail.com.

Charlie Harrison

unread,
Jun 11, 2024, 9:45:41 AMJun 11
to Wez, scheduler-dev, Daniel Cheng
Thanks Wez!

Wez

unread,
Jun 11, 2024, 9:52:04 AMJun 11
to Charlie Harrison, scheduler-dev, Daniel Cheng
No problem!  If you'd like to improve the documentation to make that expectation more obvious, feel free to send me a CL to review :)

Charles Harrison

unread,
Jun 11, 2024, 9:53:37 AMJun 11
to Wez, scheduler-dev, Daniel Cheng
Yes I will, I think my gap in knowledge is a precise understanding of what it means for a thread to be "scheduled" on the CPU and how that relates to IO. I will think about how to convey this in the documentation.
Reply all
Reply to author
Forward
0 new messages