Error reporting improvement
PATCH 1/1 Error reporting improvement
In the current version, when using perf record, if something goes wrong in tools/perf/builtin-record.c:375 session = perf_session__new(file, false, NULL); The error message:
"Not enough memory for reading per file header"
is issued. This error message seems to be outdated and is not very helpful. This patch propose to replace this error message by
"Perf session creation failed"
I believe this issue has been brought to lkml :
https://lkml.org/lkml/2014/2/24/458
although this patch only tackle a (small) part of the issue.
Additionnaly, this patch improves error reporting in tools/perf/util/data.c open_file_write
Currently, if the call to open fails, the user is unaware of it. This patch logs the error, before returning the error code to the caller.
---
tools/perf/builtin-record.c +1 -1
@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) session =perf_session__new (file, false,NULL );if (session ==NULL ) { -pr_err ("Not enough memory for reading perf file header\n" ); +pr_err ("Perf session creation failed.\n" );return -1 ; }
tools/perf/util/data.c +7 -1
@@ -86,10 +86,16 @@ static int open_file_read(struct perf_data_file *file)static int open_file_write (struct perf_data_file *file) { +int fd;if (check_backup (file))return -1 ; -return open (file->path,O_CREAT |O_RDWR |O_TRUNC ,S_IRUSR |S_IWUSR ); + fd =open (file->path,O_CREAT |O_RDWR |O_TRUNC ,S_IRUSR |S_IWUSR ); + +if (fd <0 ) +pr_err ("failed to open %s : %s\n" , file->path,strerror (errno)); + +return fd; }static int open_file (struct perf_data_file *file)
Hi Adrien,
Quoted 13 lines · Adrien BAK
In the current version, when using perf record, if something goes wrong in
tools/perf/builtin-record.c:375session =perf_session__new(file, false, NULL);
The error message:
"Not enough memory for reading per file header"
is issued. This error message seems to be outdated and is not very helpful. This patch propose to replace this error message by
"Perf session creation failed"I believe this issue has been brought to lkml :
https://lkml.org/lkml/2014/2/24/458
although this patch only tackle a (small) part of the issue.
Quoted 6 lines
Additionnaly, this patch improves error reporting in
tools/perf/util/data.copen_file_write
Currently, if the call to open fails, the user is unaware of it. This patch logs the error, before returning the error code to the caller.Signed-off-by Adrien BAK <[email protected]>
Whilst this patch (admittedly) only solves part of the problem, I think it makes the error I encountered a lot easier to understand.
Thanks,
Will
Quoted 40 lines
---
tools/perf/builtin-record.c +1
-1@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) session =perf_session__new (file, false,NULL );if (session ==NULL ) { -pr_err ("Not enough memory for reading perf file header\n" ); +pr_err ("Perf session creation failed.\n" );return -1 ; }tools/perf/util/data.c +7
-1@@ -86,10 +86,16 @@ static int open_file_read(struct perf_data_file *file)static int open_file_write (struct perf_data_file *file) { +int fd;if (check_backup (file))return -1 ; -return open (file->path,O_CREAT |O_RDWR |O_TRUNC ,S_IRUSR |S_IWUSR ); + fd =open (file->path,O_CREAT |O_RDWR |O_TRUNC ,S_IRUSR |S_IWUSR ); + +if (fd <0 ) +pr_err ("failed to open %s : %s\n" , file->path,strerror (errno)); + +return fd; }static int open_file (struct perf_data_file *file)
Quoted 21 lines · Will Deacon
Hi Adrien,
Quoted 18 lines · Adrien BAK
In the current version, when using perf record, if something goes wrong in
tools/perf/builtin-record.c:375session =perf_session__new(file, false, NULL);
The error message:
"Not enough memory for reading per file header"
is issued. This error message seems to be outdated and is not very helpful. This patch propose to replace this error message by
"Perf session creation failed"I believe this issue has been brought to lkml :
https://lkml.org/lkml/2014/2/24/458
although this patch only tackle a (small) part of the issue.Additionnaly, this patch improves error reporting in
tools/perf/util/data.copen_file_write
Currently, if the call to open fails, the user is unaware of it. This patch logs the error, before returning the error code to the caller.
Quoted 8 lines
Quoted 1 line
Signed-off-by Adrien BAK <[email protected]>Whilst this patch (admittedly) only solves part of the problem, I think it makes the error I encountered a lot easier to understand.
Thanks,
Reported-by Will Deacon <[email protected]>
seems ok to me, but the patch is mangled:
[jolsa@krava perf]$ git am /tmp/b
Applying: Error reporting improvement
fatal: corrupt patch at line 7
Patch failed at 0001 Error reporting improvement
The copy of the patch that failed is found in:
/home/jolsa/kernel.org/linux-perf/.git/rebase-apply/patch
When you have resolved this problem, run "git am --resolved". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
[jolsa@krava perf]$ patch -p3 < /tmp/b1
patching file builtin-record.c
patch: **** malformed patch at line 87: argc, const char **argv)
please check Documentation/email-clients.txt and resend
thanks,
jirka
Quoted 47 lines
Will
Quoted 30 lines
---
tools/perf/builtin-record.c +1
-1@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) session =perf_session__new (file, false,NULL );if (session ==NULL ) { -pr_err ("Not enough memory for reading perf file header\n" ); +pr_err ("Perf session creation failed.\n" );return -1 ; }tools/perf/util/data.c +1
-0@@ -86,10 +86,16 @@ static int open_file_read(struct perf_data_file *file)static int open_file_write (struct perf_data_file *file) { +int fd;if (check_backup (file))return -1 ;tools/perf/util/data.c static int open_file_read(struct perf_data_file *file) · line 101
Quoted 10 lines
tools/perf/util/data.c +6
-1-return open (file->path,O_CREAT |O_RDWR |O_TRUNC ,S_IRUSR |S_IWUSR ); + fd =open (file->path,O_CREAT |O_RDWR |O_TRUNC ,S_IRUSR |S_IWUSR ); + +if (fd <0 ) +pr_err ("failed to open %s : %s\n" , file->path,strerror (errno)); + +return fd; }static int open_file (struct perf_data_file *file)--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html