forked from libcgroup/libcgroup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python: tools: Add tool for displaying a list of realtime data
Add a tool for displaying the realtime allocations for a cgroup hierarchy. ADD EXAMPLES HERE Signed-off-by: Tom Hromatka <[email protected]>
- Loading branch information
1 parent
5797eea
commit 6efae6c
Showing
3 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python3 | ||
# SPDX-License-Identifier: LGPL-2.1-only | ||
# | ||
# Display a list of cgroups and their realtime usage | ||
# | ||
# Copyright (c) 2021-2024 Oracle and/or its affiliates. | ||
# Author: Tom Hromatka <[email protected]> | ||
# | ||
|
||
from libcgroup import LibcgroupRealtimeList | ||
import argparse | ||
import os | ||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser('Libcgroup PSI List') | ||
parser.add_argument('-C', '--cgroup', type=str, required=False, default=None, | ||
help='Relative path to the cgroup of interest, e.g. machine.slice/foo.scope') | ||
parser.add_argument('-d', '--depth', type=int, required=False, default=None, | ||
help='Depth to recurse into the cgroup path. 0 == only this cgroup, 1 == this cgroup and its children, ...') | ||
parser.add_argument('-l', '--limit', type=int, required=False, default=None, | ||
help='Only display the first N cgroups. If not provided, all cgroups that match are displayed') | ||
|
||
args = parser.parse_args() | ||
|
||
return args | ||
|
||
def main(args): | ||
cglist = LibcgroupRealtimeList(args.cgroup, depth=args.depth, limit=args.limit) | ||
|
||
cglist.walk() | ||
cglist.show() | ||
|
||
if __name__ == '__main__': | ||
args = parse_args() | ||
main(args) |