Mailing List Archive

[PATCH 5/7] perf lock: do not cut lock name
While this could be seen as personal taste, there really isn't any
reason for being so stingy printing the lock name. Furthermore, some
symbol names are really just too long, and cutting them at 16 characters
doesn't help at all.

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
---
tools/perf/builtin-lock.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 780484f..2674a42 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -696,10 +696,9 @@ static void print_bad_events(int bad, int total)
static void print_result(void)
{
struct lock_stat *st;
- char cut_name[20];
int bad, total;

- pr_info("%20s ", "Name");
+ pr_info("%40s ", "Name");
pr_info("%10s ", "acquired");
pr_info("%10s ", "contended");

@@ -716,21 +715,8 @@ static void print_result(void)
bad++;
continue;
}
- bzero(cut_name, 20);
-
- if (strlen(st->name) < 16) {
- /* output raw name */
- pr_info("%20s ", st->name);
- } else {
- strncpy(cut_name, st->name, 16);
- cut_name[16] = '.';
- cut_name[17] = '.';
- cut_name[18] = '.';
- cut_name[19] = '\0';
- /* cut off name for saving output style */
- pr_info("%20s ", cut_name);
- }

+ pr_info("%40s ", st->name);
pr_info("%10u ", st->nr_acquired);
pr_info("%10u ", st->nr_contended);

--
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/7] perf lock: do not cut lock name [ In reply to ]
Hi Davidlohr, thanks for your enhancements and cleanings!

At Sun, 8 Sep 2013 19:19:17 -0700,
Bueso wrote:
>
> While this could be seen as personal taste, there really isn't any
> reason for being so stingy printing the lock name. Furthermore, some
> symbol names are really just too long, and cutting them at 16 characters
> doesn't help at all.

I agree with your opinion that 16 chars are too short for lock names,
but I think if we should print "..." for indicating the abbreviation.

Thanks,
Hitoshi

>
> Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
> ---
> tools/perf/builtin-lock.c | 18 ++----------------
> 1 file changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
> index 780484f..2674a42 100644
> --- a/tools/perf/builtin-lock.c
> +++ b/tools/perf/builtin-lock.c
> @@ -696,10 +696,9 @@ static void print_bad_events(int bad, int total)
> static void print_result(void)
> {
> struct lock_stat *st;
> - char cut_name[20];
> int bad, total;
>
> - pr_info("%20s ", "Name");
> + pr_info("%40s ", "Name");
> pr_info("%10s ", "acquired");
> pr_info("%10s ", "contended");
>
> @@ -716,21 +715,8 @@ static void print_result(void)
> bad++;
> continue;
> }
> - bzero(cut_name, 20);
> -
> - if (strlen(st->name) < 16) {
> - /* output raw name */
> - pr_info("%20s ", st->name);
> - } else {
> - strncpy(cut_name, st->name, 16);
> - cut_name[16] = '.';
> - cut_name[17] = '.';
> - cut_name[18] = '.';
> - cut_name[19] = '\0';
> - /* cut off name for saving output style */
> - pr_info("%20s ", cut_name);
> - }
>
> + pr_info("%40s ", st->name);
> pr_info("%10u ", st->nr_acquired);
> pr_info("%10u ", st->nr_contended);
>
> --
> 1.7.11.7
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/