chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e6c4747
)
bootchart: add control group option
author
WaLyong Cho
<walyong.cho@samsung.com>
Thu, 24 Apr 2014 15:50:51 +0000
(
00:50
+0900)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 24 Apr 2014 23:21:51 +0000
(19:21 -0400)
man/bootchart.conf.xml
patch
|
blob
|
history
man/systemd-bootchart.xml
patch
|
blob
|
history
src/bootchart/bootchart.c
patch
|
blob
|
history
src/bootchart/bootchart.conf
patch
|
blob
|
history
src/bootchart/bootchart.h
patch
|
blob
|
history
src/bootchart/store.c
patch
|
blob
|
history
src/bootchart/svg.c
patch
|
blob
|
history
diff --git
a/man/bootchart.conf.xml
b/man/bootchart.conf.xml
index 68d10d4415db6a51d4204b97d548dc1e967cfbb6..68834c73b7bae1e54ce7df492303a0ce5b45c3b6 100644
(file)
--- a/
man/bootchart.conf.xml
+++ b/
man/bootchart.conf.xml
@@
-145,6
+145,11
@@
graph components.</para></listitem>
</varlistentry>
graph components.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>ControlGroup=no</varname></term>
+ <listitem><para>Display process control group.</para></listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
</variablelist>
</refsect1>
diff --git
a/man/systemd-bootchart.xml
b/man/systemd-bootchart.xml
index 1715d5dcf1719e262a0d86dd854a75eaf57374c0..d83d032553c5f0c0a0448ae6b4ba4c932abb9cef 100644
(file)
--- a/
man/systemd-bootchart.xml
+++ b/
man/systemd-bootchart.xml
@@
-197,6
+197,13
@@
</para></listitem>
</varlistentry>
</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>-g</option></term>
+ <term><option>--control-group</option></term>
+ <listitem><para>Display process control group
+ </para></listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>-o</option></term>
<term><option>--output <replaceable>path</replaceable></option></term>
<varlistentry>
<term><option>-o</option></term>
<term><option>--output <replaceable>path</replaceable></option></term>
diff --git
a/src/bootchart/bootchart.c
b/src/bootchart/bootchart.c
index 9f72d98126c1b4d8e02934b0e6fd0932835ea1ea..a73418af7ee4736831f22d301e59736eced0a772 100644
(file)
--- a/
src/bootchart/bootchart.c
+++ b/
src/bootchart/bootchart.c
@@
-78,6
+78,7
@@
bool initcall = true;
bool arg_relative = false;
bool arg_filter = true;
bool arg_show_cmdline = false;
bool arg_relative = false;
bool arg_filter = true;
bool arg_show_cmdline = false;
+bool arg_show_cgroup = false;
bool arg_pss = false;
int samples;
int arg_samples_len = 500; /* we record len+1 (1 start sample) */
bool arg_pss = false;
int samples;
int arg_samples_len = 500; /* we record len+1 (1 start sample) */
@@
-113,6
+114,7
@@
static void parse_conf(void) {
{ "Bootchart", "PlotEntropyGraph", config_parse_bool, 0, &arg_entropy },
{ "Bootchart", "ScaleX", config_parse_double, 0, &arg_scale_x },
{ "Bootchart", "ScaleY", config_parse_double, 0, &arg_scale_y },
{ "Bootchart", "PlotEntropyGraph", config_parse_bool, 0, &arg_entropy },
{ "Bootchart", "ScaleX", config_parse_double, 0, &arg_scale_x },
{ "Bootchart", "ScaleY", config_parse_double, 0, &arg_scale_y },
+ { "Bootchart", "ControlGroup", config_parse_bool, 0, &arg_show_cgroup },
{ NULL, NULL, NULL, 0, NULL }
};
_cleanup_fclose_ FILE *f;
{ NULL, NULL, NULL, 0, NULL }
};
_cleanup_fclose_ FILE *f;
@@
-143,6
+145,7
@@
static int parse_args(int argc, char *argv[]) {
{"init", required_argument, NULL, 'i'},
{"no-filter", no_argument, NULL, 'F'},
{"cmdline", no_argument, NULL, 'C'},
{"init", required_argument, NULL, 'i'},
{"no-filter", no_argument, NULL, 'F'},
{"cmdline", no_argument, NULL, 'C'},
+ {"control-group", no_argument, NULL, 'c'},
{"help", no_argument, NULL, 'h'},
{"scale-x", required_argument, NULL, 'x'},
{"scale-y", required_argument, NULL, 'y'},
{"help", no_argument, NULL, 'h'},
{"scale-x", required_argument, NULL, 'x'},
{"scale-y", required_argument, NULL, 'y'},
@@
-151,7
+154,7
@@
static int parse_args(int argc, char *argv[]) {
};
int c;
};
int c;
- while ((c = getopt_long(argc, argv, "erpf:n:o:i:FChx:y:", options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "erpf:n:o:i:FC
c
hx:y:", options, NULL)) >= 0) {
int r;
switch (c) {
int r;
switch (c) {
@@
-170,6
+173,9
@@
static int parse_args(int argc, char *argv[]) {
case 'C':
arg_show_cmdline = true;
break;
case 'C':
arg_show_cmdline = true;
break;
+ case 'c':
+ arg_show_cgroup = true;
+ break;
case 'n':
r = safe_atoi(optarg, &arg_samples_len);
if (r < 0)
case 'n':
r = safe_atoi(optarg, &arg_samples_len);
if (r < 0)
@@
-217,6
+223,7
@@
static int parse_args(int argc, char *argv[]) {
fprintf(stderr, " that are of less importance or short-lived\n");
fprintf(stderr, " --cmdline, -C Display the full command line with arguments\n");
fprintf(stderr, " of processes, instead of only the process name\n");
fprintf(stderr, " that are of less importance or short-lived\n");
fprintf(stderr, " --cmdline, -C Display the full command line with arguments\n");
fprintf(stderr, " of processes, instead of only the process name\n");
+ fprintf(stderr, " --control-group, -c Display process control group\n");
fprintf(stderr, " --help, -h Display this message\n");
fprintf(stderr, "See bootchart.conf for more information.\n");
exit (EXIT_SUCCESS);
fprintf(stderr, " --help, -h Display this message\n");
fprintf(stderr, "See bootchart.conf for more information.\n");
exit (EXIT_SUCCESS);
@@
-458,9
+465,11
@@
int main(int argc, char *argv[]) {
old->sample = old->sample->next;
free(oldsample);
}
old->sample = old->sample->next;
free(oldsample);
}
+ free(old->cgroup);
free(old->sample);
free(old);
}
free(old->sample);
free(old);
}
+ free(ps->cgroup);
free(ps->sample);
free(ps);
free(ps->sample);
free(ps);
diff --git
a/src/bootchart/bootchart.conf
b/src/bootchart/bootchart.conf
index 48fad027265a90545c2c8dbcad6385da200e1fda..d7e0dabe09f1beba604474c46aac6c3deb627032 100644
(file)
--- a/
src/bootchart/bootchart.conf
+++ b/
src/bootchart/bootchart.conf
@@
-18,3
+18,4
@@
#PlotEntropyGraph=no
#ScaleX=100
#ScaleY=20
#PlotEntropyGraph=no
#ScaleX=100
#ScaleY=20
+#ControlGroup=no
diff --git
a/src/bootchart/bootchart.h
b/src/bootchart/bootchart.h
index 968c38da26a9ad483eba7b5129186bfe871991a7..2c3783580df9bfa1f4e89cbc0cd5d83776ab1260 100644
(file)
--- a/
src/bootchart/bootchart.h
+++ b/
src/bootchart/bootchart.h
@@
-77,6
+77,7
@@
struct ps_struct {
char name[256];
int pid;
int ppid;
char name[256];
int pid;
int ppid;
+ char *cgroup;
/* cache fd's */
int sched;
/* cache fd's */
int sched;
@@
-114,6
+115,7
@@
extern int pscount;
extern bool arg_relative;
extern bool arg_filter;
extern bool arg_show_cmdline;
extern bool arg_relative;
extern bool arg_filter;
extern bool arg_show_cmdline;
+extern bool arg_show_cgroup;
extern bool arg_pss;
extern bool arg_entropy;
extern bool initcall;
extern bool arg_pss;
extern bool arg_entropy;
extern bool initcall;
diff --git
a/src/bootchart/store.c
b/src/bootchart/store.c
index 78c5cf85ecd3cf70d30b6f90f678816d53800819..e0719838d5089a6e369ae546715335fc4b4c91c2 100644
(file)
--- a/
src/bootchart/store.c
+++ b/
src/bootchart/store.c
@@
-37,6
+37,7
@@
#include "strxcpyx.h"
#include "store.h"
#include "bootchart.h"
#include "strxcpyx.h"
#include "store.h"
#include "bootchart.h"
+#include "cgroup-util.h"
/*
* Alloc a static 4k buffer for stdio - primarily used to increase
/*
* Alloc a static 4k buffer for stdio - primarily used to increase
@@
-315,6
+316,11
@@
schedstat_next:
ps->starttime = strtod(t, NULL) / 1000.0;
ps->starttime = strtod(t, NULL) / 1000.0;
+ if (arg_show_cgroup)
+ /* if this fails, that's OK */
+ cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER,
+ ps->pid, &ps->cgroup);
+
/* ppid */
sprintf(filename, "%d/stat", pid);
fd = openat(procfd, filename, O_RDONLY);
/* ppid */
sprintf(filename, "%d/stat", pid);
fd = openat(procfd, filename, O_RDONLY);
diff --git
a/src/bootchart/svg.c
b/src/bootchart/svg.c
index 7438e472fb29415af15294b33c57c9a14310cdb3..a53f98a941fea55d7fe980e144dde85ceb6d9623 100644
(file)
--- a/
src/bootchart/svg.c
+++ b/
src/bootchart/svg.c
@@
-1093,12
+1093,13
@@
static void svg_ps_bars(void) {
w = starttime;
/* text label of process name */
w = starttime;
/* text label of process name */
- svg(" <text x=\"%.03f\" y=\"%.03f\"><![CDATA[%s]]> [%i]<tspan class=\"run\">%.03fs</tspan></text>\n",
+ svg(" <text x=\"%.03f\" y=\"%.03f\"><![CDATA[%s]]> [%i]<tspan class=\"run\">%.03fs</tspan>
%s
</text>\n",
time_to_graph(w - graph_start) + 5.0,
ps_to_graph(j) + 14.0,
ps->name,
ps->pid,
time_to_graph(w - graph_start) + 5.0,
ps_to_graph(j) + 14.0,
ps->name,
ps->pid,
- (ps->last->runtime - ps->first->runtime) / 1000000000.0);
+ (ps->last->runtime - ps->first->runtime) / 1000000000.0,
+ arg_show_cgroup ? ps->cgroup : "");
/* paint lines to the parent process */
if (ps->parent) {
/* horizontal part */
/* paint lines to the parent process */
if (ps->parent) {
/* horizontal part */