summaryrefslogtreecommitdiff
path: root/src/bootchart
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootchart')
-rw-r--r--src/bootchart/bootchart.c35
-rw-r--r--src/bootchart/store.c21
-rw-r--r--src/bootchart/svg.c22
3 files changed, 42 insertions, 36 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index 83ad90c222..852febb225 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -33,30 +33,37 @@
***/
-#include <sys/resource.h>
-#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <limits.h>
#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
+#include <sys/resource.h>
#include <time.h>
-#include <getopt.h>
-#include <limits.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdbool.h>
-#include "systemd/sd-journal.h"
+#include <unistd.h>
-#include "util.h"
+#include "sd-journal.h"
+
+#include "alloc-util.h"
+#include "bootchart.h"
+#include "conf-parser.h"
+#include "def.h"
+#include "fd-util.h"
#include "fileio.h"
+#include "io-util.h"
+#include "list.h"
#include "macro.h"
-#include "conf-parser.h"
-#include "strxcpyx.h"
+#include "parse-util.h"
#include "path-util.h"
#include "store.h"
+#include "string-util.h"
+#include "strxcpyx.h"
#include "svg.h"
-#include "bootchart.h"
-#include "list.h"
+#include "util.h"
static int exiting = 0;
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index caa97b97fc..c1b1e77e44 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -22,22 +22,27 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <unistd.h>
-#include <stdlib.h>
+#include <dirent.h>
+#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <dirent.h>
-#include <fcntl.h>
#include <time.h>
+#include <unistd.h>
-#include "util.h"
-#include "time-util.h"
-#include "strxcpyx.h"
-#include "store.h"
+#include "alloc-util.h"
#include "bootchart.h"
#include "cgroup-util.h"
+#include "dirent-util.h"
+#include "fd-util.h"
#include "fileio.h"
+#include "parse-util.h"
+#include "store.h"
+#include "string-util.h"
+#include "strxcpyx.h"
+#include "time-util.h"
+#include "util.h"
/*
* Alloc a static 4k buffer for stdio - primarily used to increase
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index c66f12e3a6..05330c0577 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -30,6 +30,8 @@
#include <sys/utsname.h>
#include <fcntl.h>
+#include "alloc-util.h"
+#include "architecture.h"
#include "util.h"
#include "fileio.h"
#include "macro.h"
@@ -38,6 +40,7 @@
#include "bootchart.h"
#include "list.h"
#include "utf8.h"
+#include "fd-util.h"
#define time_to_graph(t) ((t) * arg_scale_x)
#define ps_to_graph(n) ((n) * arg_scale_y)
@@ -147,7 +150,7 @@ static int svg_title(FILE *of, const char *build, int pscount, double log_start,
_cleanup_free_ char *model = NULL;
_cleanup_free_ char *buf = NULL;
char date[256] = "Unknown";
- char *cpu;
+ const char *cpu;
char *c;
time_t t;
int r;
@@ -188,20 +191,11 @@ static int svg_title(FILE *of, const char *build, int pscount, double log_start,
assert_se(r > 0);
/* CPU type */
- r = read_full_file("/proc/cpuinfo", &buf, NULL);
+ r = get_proc_field("/proc/cpuinfo", PROC_CPUINFO_MODEL, "\n", &buf);
if (r < 0)
- return log_error_errno(r, "Unable to read cpuinfo: %m");
-
- cpu = strstr(buf, "model name");
- if (!cpu) {
- log_error("Unable to read module name from cpuinfo.\n");
- return -ENOENT;
- }
-
- cpu += 13;
- c = strchr(cpu, '\n');
- if (c)
- *c = '\0';
+ cpu = "Unknown";
+ else
+ cpu = buf;
fprintf(of, "<text class=\"t1\" x=\"0\" y=\"30\">Bootchart for %s - %s</text>\n",
uts.nodename, date);