-
Notifications
You must be signed in to change notification settings - Fork 78
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
cgroups: Add support to dump fake attach events #135
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,6 +287,11 @@ def get_tasks(self): | |
logging.debug('Tasks: %s', task_ids) | ||
return map(int, task_ids) | ||
|
||
# Used to insert fake cgroup attach events to know existing cgroup assignments | ||
def trace_cgroup_tasks(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are already into the CGroup class, thous I would suggest to rename this to be just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moreover, I think we should also add a method to the class CgroupModule(Module):
def trace_cgroups(self, controllers=None, cgroups=None):
if controllers is None:
controllers = [ss.name for ss in self.controllers]
for controller in self.controllers:
if controller not in controllers:
continue
controller.trace_cgroups(cgroups) Which ultimately requires an additional method in the If you don't have time, I can provide such a patch in the next few days... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly I think this can be a wrapper on top of my patch. I do believe my patch is clean enough but all that's missing is a wrapper to take controller and group parameters. IMO the core dumping into trace logic should be as low as possible (infact right fully in the If you still want to do this differently, I am Ok with that. But I would like it to be as simple as my approach. Maybe you can just add a wrapper to this patch in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My concern is that, since we are adding a new API, is should be properly implemented to be fully usable... while this one is a "partial implementation". I guess your code which uses this API is already doing most of the things I'm asking for here, at least looping on all cgroups of a controller. Since this is a quite common use case, I would like we merge the API once we provide these minimal set of functionalities covered. To summarise, what you did is simple, clean and ok... but a bit limited in scope to require additional client code. Let's try to factor in this client code in the new API. If you do not have time to provide such an extension it's ok for me to add some patches on top of this PR before merging it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think if you can add some PRs on top of this with your idea, that will be the quickest. I think the high level implementation can be simple wrapper to this lower level functionality. Thanks @derkling |
||
exec_cmd = "cgroup_trace_attach_task {} {} {}".format(self.controller.hid, self.directory, self.tasks_file) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can save some columns by splitting before There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. |
||
self.target._execute_util(exec_cmd) | ||
|
||
def add_task(self, tid): | ||
self.target.write_value(self.tasks_file, tid, verify=False) | ||
|
||
|
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.
Maybe this format is less aggressive on the 80 cols limit?
Moreover, this is not the same format of the original (i.e. kernel generated) event... but I guess we cannot do otherwise since we don't know the source groups.
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.
Yes I believe, only the extra fields are dropped but the existing fields have the same format, so that's not an issue
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.
Agreed with comment on 80 line limit and will fix, thanks