Message ID | 1402965211-23207-1-git-send-email-alex.hung@canonical.com |
---|---|
State | Rejected |
Headers | show |
On 17/06/14 01:33, Alex Hung wrote: > When running fwts-live, it is sometimes difficult to analyze the results > without the cpu information. This patch includes cpuinfo from /proc/cpuinfo > > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/lib/src/fwts_dump.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/src/lib/src/fwts_dump.c b/src/lib/src/fwts_dump.c > index 8c59f57..cb46371 100644 > --- a/src/lib/src/fwts_dump.c > +++ b/src/lib/src/fwts_dump.c > @@ -222,6 +222,17 @@ static int dump_readme(void) > } > > /* > + * dump_cpuinfo() > + * read cpuinfo, dump to path/filename > + */ > +static int dump_cpuinfo(void) > +{ > + char *command = "cat /proc/cpuinfo"; > + > + return dump_exec("cpuinfo.log", command); > +} Since this is a simple plain text dump, I'd avoid an exec to cat to dump this out. I'm trying to remove most exec's in fwts where possible. A simple fopen, fread, fwrite, fclose is probably better. > + > +/* > * fwts_dump_info() > * dump various system specific information: > * kernel log, dmidecode output, lspci output, > @@ -273,5 +284,10 @@ int fwts_dump_info(fwts_framework *fw) > } else > fprintf(stderr, "Need root privilege to dump ACPI tables.\n"); > > + if (dump_cpuinfo() != FWTS_OK) > + fprintf(stderr, "Failed to dump cpuinfo.\n"); > + else > + printf("Dumping cpuinfo to cpuinfo.log\n"); > + > return FWTS_OK; > } >
diff --git a/src/lib/src/fwts_dump.c b/src/lib/src/fwts_dump.c index 8c59f57..cb46371 100644 --- a/src/lib/src/fwts_dump.c +++ b/src/lib/src/fwts_dump.c @@ -222,6 +222,17 @@ static int dump_readme(void) } /* + * dump_cpuinfo() + * read cpuinfo, dump to path/filename + */ +static int dump_cpuinfo(void) +{ + char *command = "cat /proc/cpuinfo"; + + return dump_exec("cpuinfo.log", command); +} + +/* * fwts_dump_info() * dump various system specific information: * kernel log, dmidecode output, lspci output, @@ -273,5 +284,10 @@ int fwts_dump_info(fwts_framework *fw) } else fprintf(stderr, "Need root privilege to dump ACPI tables.\n"); + if (dump_cpuinfo() != FWTS_OK) + fprintf(stderr, "Failed to dump cpuinfo.\n"); + else + printf("Dumping cpuinfo to cpuinfo.log\n"); + return FWTS_OK; }
When running fwts-live, it is sometimes difficult to analyze the results without the cpu information. This patch includes cpuinfo from /proc/cpuinfo Signed-off-by: Alex Hung <alex.hung@canonical.com> --- src/lib/src/fwts_dump.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)