[systemd-commits] 4 commits - man/bootchart.conf.xml man/systemd-bootchart.xml src/bootchart src/libudev
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Thu Apr 24 16:23:12 PDT 2014
man/bootchart.conf.xml | 5 ++
man/systemd-bootchart.xml | 7 ++++
src/bootchart/bootchart.c | 73 ++++++++++++++++++++++++++++--------------
src/bootchart/bootchart.conf | 1
src/bootchart/bootchart.h | 2 +
src/bootchart/store.c | 6 +++
src/bootchart/svg.c | 5 +-
src/libudev/libudev-monitor.c | 5 ++
8 files changed, 78 insertions(+), 26 deletions(-)
New commits:
commit c7fc641ea349a08291dd3cd6db4a99262f834271
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Apr 24 19:16:37 2014 -0400
bootchart: print to stdout and display default values in help
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index 84497cc..958a668 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -72,6 +72,13 @@ int overrun = 0;
static int exiting = 0;
int sysfd=-1;
+#define DEFAULT_SAMPLES_LEN 500
+#define DEFAULT_HZ 25.0
+#define DEFAULT_SCALE_X 100.0 /* 100px = 1sec */
+#define DEFAULT_SCALE_Y 20.0 /* 16px = 1 process bar */
+#define DEFAULT_INIT "/sbin/init"
+#define DEFAULT_OUTPUT "/run/log"
+
/* graph defaults */
bool arg_entropy = false;
bool initcall = true;
@@ -81,15 +88,15 @@ 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) */
-double arg_hz = 25.0; /* 20 seconds log time */
-double arg_scale_x = 100.0; /* 100px = 1sec */
-double arg_scale_y = 20.0; /* 16px = 1 process bar */
+int arg_samples_len = DEFAULT_SAMPLES_LEN; /* we record len+1 (1 start sample) */
+double arg_hz = DEFAULT_HZ;
+double arg_scale_x = DEFAULT_SCALE_X;
+double arg_scale_y = DEFAULT_SCALE_Y;
static struct list_sample_data *sampledata;
struct list_sample_data *head;
-char arg_init_path[PATH_MAX] = "/sbin/init";
-char arg_output_path[PATH_MAX] = "/run/log";
+char arg_init_path[PATH_MAX] = DEFAULT_INIT;
+char arg_output_path[PATH_MAX] = DEFAULT_OUTPUT;
static void signal_handler(int sig) {
if (sig++)
@@ -135,6 +142,33 @@ static void parse_conf(void) {
strscpy(arg_output_path, sizeof(arg_output_path), output);
}
+static void help(void) {
+ fprintf(stdout,
+ "Usage: %s [OPTIONS]\n\n"
+ "Options:\n"
+ " -r, --rel Record time relative to recording\n"
+ " -f, --freq=FREQ Sample frequency [%g]\n"
+ " -n, --samples=N Stop sampling at [%d] samples\n"
+ " -x, --scale-x=N Scale the graph horizontally [%g] \n"
+ " -y, --scale-y=N Scale the graph vertically [%g] \n"
+ " -p, --pss Enable PSS graph (CPU intensive)\n"
+ " -e, --entropy Enable the entropy_avail graph\n"
+ " -o, --output=PATH Path to output files [%s]\n"
+ " -i, --init=PATH Path to init executable [%s]\n"
+ " -F, --no-filter Disable filtering of unimportant or ephemeral processes\n"
+ " -C, --cmdline Display full command lines with arguments\n"
+ " -c, --control-group Display process control group\n"
+ " -h, --help Display this message\n\n"
+ "See bootchart.conf for more information.\n",
+ program_invocation_short_name,
+ DEFAULT_HZ,
+ DEFAULT_SAMPLES_LEN,
+ DEFAULT_SCALE_X,
+ DEFAULT_SCALE_Y,
+ DEFAULT_OUTPUT,
+ DEFAULT_INIT);
+}
+
static int parse_args(int argc, char *argv[]) {
static struct option options[] = {
{"rel", no_argument, NULL, 'r'},
@@ -209,24 +243,7 @@ static int parse_args(int argc, char *argv[]) {
arg_entropy = true;
break;
case 'h':
- fprintf(stderr, "Usage: %s [OPTIONS]\n\n", argv[0]);
- fprintf(stderr, "Options:\n");
- fprintf(stderr, " -r, --rel Record time relative to recording\n");
- fprintf(stderr, " -f, --freq=FREQ Sample frequency [%f]\n", arg_hz);
- fprintf(stderr, " -n, --samples=N Stop sampling at [%d] samples\n", arg_samples_len);
- fprintf(stderr, " -x, --scale-x=N Scale the graph horizontally [%f] \n", arg_scale_x);
- fprintf(stderr, " -y, --scale-y=N Scale the graph vertically [%f] \n", arg_scale_y);
- fprintf(stderr, " -p, --pss Enable PSS graph (CPU intensive)\n");
- fprintf(stderr, " -e, --entropy Enable the entropy_avail graph\n");
- fprintf(stderr, " -o, --output=PATH Path to output files [%s]\n", arg_output_path);
- fprintf(stderr, " -i, --init=PATH Path to init executable [%s]\n", arg_init_path);
- fprintf(stderr, " -F, --no-filter Disable filtering of processes from the graph\n");
- fprintf(stderr, " that are of less importance or short-lived\n");
- fprintf(stderr, " -C, --cmdline Display the full command line with arguments\n");
- fprintf(stderr, " of processes, instead of only the process name\n");
- fprintf(stderr, " -c, --control-group Display process control group\n");
- fprintf(stderr, " -h, --help Display this message\n\n");
- fprintf(stderr, "See bootchart.conf for more information.\n");
+ help();
exit (EXIT_SUCCESS);
default:
break;
commit 7e6798df26c8b77120797b9f7609a9700be2e80b
Author: WaLyong Cho <walyong.cho at samsung.com>
Date: Fri Apr 25 00:50:52 2014 +0900
bootchart: rewrite usage message more generally
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index a73418a..84497cc 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -209,22 +209,23 @@ static int parse_args(int argc, char *argv[]) {
arg_entropy = true;
break;
case 'h':
- fprintf(stderr, "Usage: %s [OPTIONS]\n", argv[0]);
- fprintf(stderr, " --rel, -r Record time relative to recording\n");
- fprintf(stderr, " --freq, -f f Sample frequency [%f]\n", arg_hz);
- fprintf(stderr, " --samples, -n N Stop sampling at [%d] samples\n", arg_samples_len);
- fprintf(stderr, " --scale-x, -x N Scale the graph horizontally [%f] \n", arg_scale_x);
- fprintf(stderr, " --scale-y, -y N Scale the graph vertically [%f] \n", arg_scale_y);
- fprintf(stderr, " --pss, -p Enable PSS graph (CPU intensive)\n");
- fprintf(stderr, " --entropy, -e Enable the entropy_avail graph\n");
- fprintf(stderr, " --output, -o [PATH] Path to output files [%s]\n", arg_output_path);
- fprintf(stderr, " --init, -i [PATH] Path to init executable [%s]\n", arg_init_path);
- fprintf(stderr, " --no-filter, -F Disable filtering of processes from the graph\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, "Usage: %s [OPTIONS]\n\n", argv[0]);
+ fprintf(stderr, "Options:\n");
+ fprintf(stderr, " -r, --rel Record time relative to recording\n");
+ fprintf(stderr, " -f, --freq=FREQ Sample frequency [%f]\n", arg_hz);
+ fprintf(stderr, " -n, --samples=N Stop sampling at [%d] samples\n", arg_samples_len);
+ fprintf(stderr, " -x, --scale-x=N Scale the graph horizontally [%f] \n", arg_scale_x);
+ fprintf(stderr, " -y, --scale-y=N Scale the graph vertically [%f] \n", arg_scale_y);
+ fprintf(stderr, " -p, --pss Enable PSS graph (CPU intensive)\n");
+ fprintf(stderr, " -e, --entropy Enable the entropy_avail graph\n");
+ fprintf(stderr, " -o, --output=PATH Path to output files [%s]\n", arg_output_path);
+ fprintf(stderr, " -i, --init=PATH Path to init executable [%s]\n", arg_init_path);
+ fprintf(stderr, " -F, --no-filter Disable filtering of processes from the graph\n");
+ fprintf(stderr, " that are of less importance or short-lived\n");
+ fprintf(stderr, " -C, --cmdline Display the full command line with arguments\n");
+ fprintf(stderr, " of processes, instead of only the process name\n");
+ fprintf(stderr, " -c, --control-group Display process control group\n");
+ fprintf(stderr, " -h, --help Display this message\n\n");
fprintf(stderr, "See bootchart.conf for more information.\n");
exit (EXIT_SUCCESS);
default:
commit 49e5b2a93339869703d581a06f8d903f8371ab60
Author: WaLyong Cho <walyong.cho at samsung.com>
Date: Fri Apr 25 00:50:51 2014 +0900
bootchart: add control group option
diff --git a/man/bootchart.conf.xml b/man/bootchart.conf.xml
index 68d10d4..68834c7 100644
--- a/man/bootchart.conf.xml
+++ b/man/bootchart.conf.xml
@@ -145,6 +145,11 @@
graph components.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>ControlGroup=no</varname></term>
+ <listitem><para>Display process control group.</para></listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
diff --git a/man/systemd-bootchart.xml b/man/systemd-bootchart.xml
index 1715d5d..d83d032 100644
--- a/man/systemd-bootchart.xml
+++ b/man/systemd-bootchart.xml
@@ -198,6 +198,13 @@
</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>
<listitem><para>Specify the output directory for the
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index 9f72d98..a73418a 100644
--- 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_show_cgroup = false;
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", "ControlGroup", config_parse_bool, 0, &arg_show_cgroup },
{ 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'},
+ {"control-group", no_argument, NULL, 'c'},
{"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;
- 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:FCchx:y:", options, NULL)) >= 0) {
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_cgroup = true;
+ break;
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, " --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);
@@ -458,9 +465,11 @@ int main(int argc, char *argv[]) {
old->sample = old->sample->next;
free(oldsample);
}
+ free(old->cgroup);
free(old->sample);
free(old);
}
+ free(ps->cgroup);
free(ps->sample);
free(ps);
diff --git a/src/bootchart/bootchart.conf b/src/bootchart/bootchart.conf
index 48fad02..d7e0dab 100644
--- a/src/bootchart/bootchart.conf
+++ b/src/bootchart/bootchart.conf
@@ -18,3 +18,4 @@
#PlotEntropyGraph=no
#ScaleX=100
#ScaleY=20
+#ControlGroup=no
diff --git a/src/bootchart/bootchart.h b/src/bootchart/bootchart.h
index 968c38d..2c37835 100644
--- 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 *cgroup;
/* 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_show_cgroup;
extern bool arg_pss;
extern bool arg_entropy;
extern bool initcall;
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index 78c5cf8..e071983 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -37,6 +37,7 @@
#include "strxcpyx.h"
#include "store.h"
#include "bootchart.h"
+#include "cgroup-util.h"
/*
* Alloc a static 4k buffer for stdio - primarily used to increase
@@ -315,6 +316,11 @@ schedstat_next:
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);
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index 7438e47..a53f98a 100644
--- 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 */
- 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,
- (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 */
commit e6c474723dc66cd4765fd09453d6b48bd5905ba4
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Apr 20 13:57:26 2014 -0400
udev: warn when name_to_handle_at is not implemented
We have a bunch of reports from people who have a custom kernel and
are confused why udev is not running. Issue a warning on
error. Barring an error in the code, the only error that is possible
is ENOSYS.
https://bugzilla.redhat.com/show_bug.cgi?id=1072966
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index c05cb3e..186e5e1 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -119,8 +119,11 @@ static bool udev_has_devtmpfs(struct udev *udev) {
int r;
r = name_to_handle_at(AT_FDCWD, "/dev", &h.handle, &mount_id, 0);
- if (r < 0)
+ if (r < 0) {
+ if (errno != EOPNOTSUPP)
+ udev_err(udev, "name_to_handle_at on /dev: %m\n");
return false;
+ }
f = fopen("/proc/self/mountinfo", "re");
if (!f)
More information about the systemd-commits
mailing list