-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue-1444: Use kernel delay accounting to calculate cpu wait #1630
base: main
Are you sure you want to change the base?
Conversation
9416d9c
to
d491e70
Compare
2044242
to
487a76d
Compare
487a76d
to
3bc2042
Compare
4701cd8
to
52f2bd0
Compare
a08f79b
to
497d987
Compare
f5b8b26
to
68aa05f
Compare
b8b085c
to
be4fec9
Compare
f58ff78
to
50f14dd
Compare
57a7799
to
3dd7d98
Compare
8cbd414
to
7c3c9b6
Compare
7c3c9b6
to
6ae006d
Compare
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
struct TTaskStatsFetcher final: public IStatsFetcher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TTaskStatsFetcher - основное изменение в этом пул реквесте
|
||
TResultOrError<TDuration> GetCpuWait() override | ||
{ | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
может, использовать function try
блок, чтобы не было двойной табуляции?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Прикольно. Я не знал про такую фичу.
Я бы оставил как есть для единообразия кода(По крайней мере я не нашел примеров использования function try в нашем коде).
auto cpuDelay = NThreading::NewPromise<TResultOrError<TDuration>>(); | ||
netlinkSocket.SetCallback( | ||
NL_CB_VALID, | ||
[this, &cpuDelay](nl_msg* nlmsg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
чем гарантируется что this не протухнет к моменту вызова колбэка?
return NL_OK; | ||
}); | ||
netlinkSocket.Send(message); | ||
auto cpuWait = cpuDelay.GetFuture().GetValue(NetlinkSocketTimeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
аа, получается мы тут повиснем на ожидании коллбэка
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мы блокируемся в Send на самом деле. Там синхронная реализация https://github.com/ydb-platform/nbs/blob/main/cloud/storage/core/libs/netlink/socket.cpp#L45
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в целом ничего не мешает сделать его асинхронным, но тогда нужно будет аккуратно проставить error колбэки и пошарить контекст, например, через shared_from_this как сделано в nbd
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
struct TCgroupStatsFetcher final |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше в разных файлах оставить разные реализации, тогда будет видно что код просто перенесли.
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
ICgroupStatsFetcherPtr CreateCgroupStatsFetcher( | ||
IStatsFetcherPtr CreateCgroupStatsFetcher( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а чем CreateCgroupStatsFetcher/CreateTaskStatsFetcher отличается от BuildStatsFetcher не достаточно одной функции?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Теперь точно нужны, так как я разнес реализации CGroupStatsFetcher и TaskStatsFetcher по разным cpp файлам
cloud/storage/core/protos | ||
|
||
library/cpp/lwtrace/mon | ||
|
||
contrib/restricted/libnl/lib/nl-3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
от contrib/restricted/libnl начинает зависеть еще один ya.make нам снова прописывать исключения (((
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть re-implementation of libnl-2 с лицензий apache 2.0 https://android.googlesource.com/platform/system/core/+/29d238d/libnl_2/README
@tpashkin Может мы можем на нее перейти?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tpashkin Может мы можем на нее перейти?
Почему бы и нет, нам нужен довольно базовый набор функций
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я создал отдельный тикет: #2869
Попробуем перейти на другую реализацию
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
от contrib/restricted/libnl начинает зависеть еще один ya.make нам снова прописывать исключения (((
@drbasic а напомни, плиз, что за исключения. вы сейчас не линкуетесь с libnl в аркадии?
3b4deb3
to
c3a8efa
Compare
issue: #1444
taskstats doc:
https://www.kernel.org/doc/Documentation/accounting/taskstats.txt
https://www.kernel.org/doc/Documentation/accounting/delay-accounting.rst