From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754906AbbJOHRI (ORCPT ); Thu, 15 Oct 2015 03:17:08 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:24566 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753794AbbJOHRG (ORCPT ); Thu, 15 Oct 2015 03:17:06 -0400 Message-ID: <561F51AB.4040302@huawei.com> Date: Thu, 15 Oct 2015 15:11:39 +0800 From: Yunlong Song User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo CC: Sriram Raghunathan , Wang Nan , Ramkumar Ramachandra , Namhyung Kim , Jiri Olsa , Ingo Molnar , Peter Zijlstra , "Linux Kernel Mailing List" , David Ahern , Adrian Hunter , "Arnaldo Carvalho de Melo" Subject: Re: [PATCH 1/1] perf:Adding --list-opts to usage string References: <1444282190-13605-1-git-send-email-sriram.r@nokia.com> <20151013145728.GT14409@kernel.org> <561DBDF1.1020503@huawei.com> <20151014031043.GA3775@kernel.org> <561E5939.90605@huawei.com> In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.111.74.205] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/10/14 21:40, Arnaldo Carvalho de Melo wrote: > > Le 14 oct. 2015 10:33 AM, "Yunlong Song" > a écrit : >> >> On 2015/10/14 11:10, Arnaldo Carvalho de Melo wrote: >> >> > One doesn't show what options can be used, the other does, so there is >> > an inconsistency, this and the fact that 'perf -h' outputs to stdout, >> > 'perf stat -h' and the other builtins output to stderr. I think all >> > should output to stdout, just like 'ls --help', what do you think? >> > >> > - Arnaldo >> > >> >> I think the reason that options do not show in 'perf -h' but show in >> other builtins is not the different use of stdout or stderr. I will >> send a patch to fix this instead. > > Sure, I mentioned two problems. The invonsistency in stdout/stderr usage has nothing to do with options being not showed in 'perf -h'. :-) >> Sorry, I understand now. I think it makes sense that the builtins use stderr everywhere to show its usage info when the opts or cmds are incorrectly used. Usually, there is an error description followed with the usage info, for example: # ./perf stat -f Error: unknown switch `f' Usage: perf stat [] [] -T, --transaction hardware transaction statistics -e, --event event selector. use 'perf list' to list available events --filter event filter -i, --no-inherit child tasks do not inherit counters -I, --interval-print print counts at regular interval in ms (>= 10) --per-socket aggregate counts per processor socket --per-core aggregate counts per physical processor core --per-thread aggregate counts per thread -D, --delay ms to wait before starting measurement after program start As shown above, I think the error description and the usage info should output to the same stderr area as it is now to be clear. Thus I think it is better to make perf output its usage info to stderr instead of stdout for consistency. I will resend patches to fix this. -- Thanks, Yunlong Song