summaryrefslogtreecommitdiff
path: root/src/bootchart/svg.c
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-09-30 16:35:49 +0200
committerDaniel Mack <github@zonque.org>2015-09-30 16:35:49 +0200
commita19c7a4a4b773e25671a5fa874e7c421685d1bde (patch)
tree3b7e20eb79359b4f3579870beb279df35ae207cd /src/bootchart/svg.c
parent6e8337580862037d0639961cb51ef82270c1a30f (diff)
parentf2d28e80bc6260c90396e9fc798d559775dbde23 (diff)
Merge pull request #1415 from aakoskin/bootchart-v2
[v2] bootchart: don't fail if "model name" is missing from cpuinfo
Diffstat (limited to 'src/bootchart/svg.c')
-rw-r--r--src/bootchart/svg.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index c66f12e3a6..db5fc863b0 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -30,6 +30,7 @@
#include <sys/utsname.h>
#include <fcntl.h>
+#include "architecture.h"
#include "util.h"
#include "fileio.h"
#include "macro.h"
@@ -147,7 +148,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 +189,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);