chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
core: make setting the shutdown watchdog configuration via dbus work
[elogind.git]
/
src
/
bootchart
/
svg.c
diff --git
a/src/bootchart/svg.c
b/src/bootchart/svg.c
index bf6636cab1d8c26b0c2f9d12a2baac7869faf863..e5569e1622a6b7fc2123e27ea599ef52b13a0701 100644
(file)
--- a/
src/bootchart/svg.c
+++ b/
src/bootchart/svg.c
@@
-39,6
+39,7
@@
#include "svg.h"
#include "bootchart.h"
#include "list.h"
#include "svg.h"
#include "bootchart.h"
#include "list.h"
+#include "utf8.h"
#define time_to_graph(t) ((t) * arg_scale_x)
#define ps_to_graph(n) ((n) * arg_scale_y)
#define time_to_graph(t) ((t) * arg_scale_x)
#define ps_to_graph(n) ((n) * arg_scale_y)
@@
-162,7
+163,7
@@
static void svg_title(const char *build) {
char *c;
FILE *f;
time_t t;
char *c;
FILE *f;
time_t t;
- int fd;
+ int fd
, r
;
struct utsname uts;
/* grab /proc/cmdline */
struct utsname uts;
/* grab /proc/cmdline */
@@
-196,7
+197,8
@@
static void svg_title(const char *build) {
/* date */
t = time(NULL);
/* date */
t = time(NULL);
- strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", localtime(&t));
+ r = strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", localtime(&t));
+ assert_se(r > 0);
/* CPU type */
fd = openat(procfd, "cpuinfo", O_RDONLY);
/* CPU type */
fd = openat(procfd, "cpuinfo", O_RDONLY);
@@
-881,21
+883,21
@@
static struct ps_struct *get_next_ps(struct ps_struct *ps) {
return NULL;
}
return NULL;
}
-static
int
ps_filter(struct ps_struct *ps) {
+static
bool
ps_filter(struct ps_struct *ps) {
if (!arg_filter)
if (!arg_filter)
- return
0
;
+ return
false
;
/* can't draw data when there is only 1 sample (need start + stop) */
if (ps->first == ps->last)
/* can't draw data when there is only 1 sample (need start + stop) */
if (ps->first == ps->last)
- return
-1
;
+ return
true
;
/* don't filter kthreadd */
if (ps->pid == 2)
/* don't filter kthreadd */
if (ps->pid == 2)
- return
0
;
+ return
false
;
/* drop stuff that doesn't use any real CPU time */
if (ps->total <= 0.001)
/* drop stuff that doesn't use any real CPU time */
if (ps->total <= 0.001)
- return
-1
;
+ return
true
;
return 0;
}
return 0;
}
@@
-1005,12
+1007,15
@@
static void svg_ps_bars(void) {
/* pass 2 - ps boxes */
ps = ps_first;
while ((ps = get_next_ps(ps))) {
/* pass 2 - ps boxes */
ps = ps_first;
while ((ps = get_next_ps(ps))) {
- _cleanup_free_ char *enc_name = NULL;
+ _cleanup_free_ char *enc_name = NULL
, *escaped = NULL
;
double endtime;
double starttime;
int t;
double endtime;
double starttime;
int t;
- enc_name = xml_comment_encode(ps->name);
+ if (!utf8_is_printable(ps->name, strlen(ps->name)))
+ escaped = utf8_escape_non_printable(ps->name);
+
+ enc_name = xml_comment_encode(escaped ? escaped : ps->name);
if (!enc_name)
continue;
if (!enc_name)
continue;
@@
-1099,7
+1104,7
@@
static void svg_ps_bars(void) {
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,
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,
+
escaped ? escaped :
ps->name,
ps->pid,
(ps->last->runtime - ps->first->runtime) / 1000000000.0,
arg_show_cgroup ? ps->cgroup : "");
ps->pid,
(ps->last->runtime - ps->first->runtime) / 1000000000.0,
arg_show_cgroup ? ps->cgroup : "");