<cmdsynopsis>
<command>systemd-cgtop</command>
<arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg choice="opt">GROUP</arg>
</cmdsynopsis>
</refsynopsisdiv>
groups of the local Linux control group hierarchy, ordered by
their CPU, memory, or disk I/O load. The display is refreshed in
regular intervals (by default every 1s), similar in style to
- <citerefentry project='man-pages'><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
+ <citerefentry project='man-pages'><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
+ If a control group path is specified, shows only the services of
+ the specified control group.</para>
<para>If <command>systemd-cgtop</command> is not connected to a
tty, no column headers are printed and the default is to only run
<listitem><para>Limit control groups shown to the part
corresponding to the container
- <replaceable>MACHINE</replaceable>.</para></listitem>
+ <replaceable>MACHINE</replaceable>.
+ This option may not be used when a control group path is specified.</para></listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="help" />
static bool arg_raw = false;
static usec_t arg_delay = 1*USEC_PER_SEC;
static char* arg_machine = NULL;
+static char* arg_root = NULL;
static bool arg_recursive = true;
static enum {
}
static void help(void) {
- printf("%s [OPTIONS...]\n\n"
+ printf("%s [OPTIONS...] [CGROUP]\n\n"
"Show top control groups by their resource usage.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
assert_not_reached("Unhandled option");
}
- if (optind < argc) {
+ if (optind == argc-1) {
+ if (arg_machine) {
+ log_error("Specifying a control group path together with the -M option is not allowed");
+ return -EINVAL;
+ }
+ arg_root = argv[optind];
+ } else if (optind < argc) {
log_error("Too many arguments.");
return -EINVAL;
}
const char *m;
int r;
+ if (arg_root) {
+ *ret = strdup(arg_root);
+ if (!*ret)
+ return log_oom();
+ return 0;
+ }
+
if (!arg_machine) {
r = cg_get_root_path(ret);
if (r < 0)