lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4BA089C0.8090406@dcl.info.waseda.ac.jp>
Date:	Wed, 17 Mar 2010 16:50:24 +0900
From:	Hitoshi Mitake <mitake@....info.waseda.ac.jp>
To:	Arnaldo Carvalho de Melo <acme@...radead.org>
CC:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	h.mitake@...il.com, Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH] perf: Make printing table easily

On 03/11/10 23:06, Arnaldo Carvalho de Melo wrote:
 > Em Thu, Mar 11, 2010 at 01:51:26PM +0100, Ingo Molnar escreveu:
 >>
 >> * Hitoshi Mitake<mitake@....info.waseda.ac.jp>  wrote:
 >>
 >>> Hi,
 >>>
 >>> Making table of matrix by printf is painful work,
 >>> but it can be found in perf here and there.
 >>> So I'd like to propose semi-automation of making table.
 >>> New files util/table.c provides stuffs for easy table printing.
 >>
 >> Looks quite reasonable in theory. I suspect it would be useful to 
see a few
 >> table printing places converted to this facility, to see the 
simplification
 >> factor in practice.
 >
 > I'm going thru the printing routines now to get them usable by TUI/GUIs,
 > starting with a libnewt based browser integrating initially report and
 > annotate, after I get the first patch in shape for merging I'll revisit
 > this table class of yours :-)

Thanks Arnaldo!

But I noticed fatal weak point of table.c.

User of table.c can reduce the cost of specifying
format specifier for printf, but like this case:

	table_add_fixed(t, "%p", SIZE_OF_ADDR);
	if (some_cond1)
		table_add_fixed(t, "%10d", sizeof(int));
	if (some_cond2)
		table_add_string(t, "%30s", 30);

table_printf() may produces a lot of if-branch like this:

	if (some_cond1 && some_cond2)
  		table_printf(t, table_test, 2501, "one");
	else if (!some_cond1 && some_cond2)
  		table_printf(t, table_test, "one");
	else if (some_cond1 && !some_cond2)
  		table_printf(t, table_test, 2501);

It is not so good, as Ingo told, at least table of this style
is not useful in real world...

But, how about this style?

First, user declare column with name like this:
        table_add_column(t, "num1", "%10d", sizeof(int));

Then, user can add values with name,
       table_add_field(t, "num1", 2501);

Finally, flush stored column
	 table_flush_line(t);

This way will be good for making title of table.
How about this?

Thanks,
	Hitoshi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ