Received: by 10.223.185.116 with SMTP id b49csp4259610wrg; Tue, 6 Mar 2018 12:33:37 -0800 (PST) X-Google-Smtp-Source: AG47ELtlE4YIODOS8Dg1Gmvfkgfvhn53s5lSqGf/DEO+mF3YlNjC/G+qsrR1j0RDpMkN/GlT5WFk X-Received: by 10.98.141.205 with SMTP id p74mr20047820pfk.211.1520368417717; Tue, 06 Mar 2018 12:33:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520368417; cv=none; d=google.com; s=arc-20160816; b=aOjha92Y6b4Y2V5p95ECr+OjIB+x3p4ONSa07cyRPV3DLiKVd5oIDDKzHG77BWUihi 256COhuaoZ3oFL4MwLvifr9TkB9ZlJDYKbKxFYXZ8aFH6qVmthwLFdREs0gukQ4yIRN5 nzp5IUpj3QWHs/APS1BHmXA80q595SHfsQqpDGR/qhMxVJEBhyI0O19Sl/ytalJS7Yze 45vmFiP3hnJ1DDgoDS0I7iAykhft9H6Q0lBskLFIJMtWlfI4qv4uhgj+tsJIjEHtqXxA bCCbUCbh8/oZ0qvgp6LTdqHc2TkIWPb2wsACjlNchnWyWCP0/ITW5SSOCmtwU7KJfy6O +2eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=wzB2jncqg5jwmwtJ8XCaPy/L62rNkRACcfUgzyy1a0Y=; b=eOT+sHqo13lRqMA4RCJ/vSqHMgI9HmNiBW0UaIvl6rOljzXul/m7bYe+fylV6//+5t cjcNdtSyCUS5IRUKFgCNciPHBm/W79oy1DH6aM5SwnW9uBnbrN9/GK0FCgh4jUrxqBNV iySKfnIw/jFxQ1ZxB+xhi6ga7JVPATSKOlictaIBwYVez83qZo6MsYg9+Q03LFFmLk2q D49dhHohJwcja6PLUoRqVoyjyr/qNyADYEE4oy5BgTNDu38s2BOYMfMguPF7iFXjdmij MP3f+QN4g76/kJhWcfYlIS9HpE4XYm4dkXtObbrWVvLVDGjH8h93zBLwoYhJinXRrQ7n DRNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@twitter.com header.s=google header.b=ismSpthD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=twitter.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22si12441215pfa.4.2018.03.06.12.33.22; Tue, 06 Mar 2018 12:33:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@twitter.com header.s=google header.b=ismSpthD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=twitter.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932906AbeCFUbG (ORCPT + 99 others); Tue, 6 Mar 2018 15:31:06 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:33954 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932287AbeCFUbF (ORCPT ); Tue, 6 Mar 2018 15:31:05 -0500 Received: by mail-wm0-f53.google.com with SMTP id a20so19669367wmd.1 for ; Tue, 06 Mar 2018 12:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=twitter.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wzB2jncqg5jwmwtJ8XCaPy/L62rNkRACcfUgzyy1a0Y=; b=ismSpthD79Gn3isYuxvQp0x+qPu1cUurERQ6DngGsqpzvEeIAyDP6CW5J4nMceUOtl LFpzNJA5uSuMuPzWRqfHXDGBdeQjt09119t4HwtSb5mOOnf1tmVW+idH96DuP+9Olc2o saWVcN4+YbrT3gp/0F5IDVjJEzmxK+gdEyQf8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wzB2jncqg5jwmwtJ8XCaPy/L62rNkRACcfUgzyy1a0Y=; b=mRee+pKWwaS55RIG8MC0gVDQcQebvs8i2lTTwedmJhx88CzXcHDmDyYwbUcsAbB6kX HlGq1QhiCMtGG49MoelIpq0ESHVmkZ+WWSCwYe7fHjE/6dGnq8i8d3oj7QTWo/0Mg5Cu UDlL3Qrn9sEqpUTY3PA9BKiVsNKXLqed4mY4N7FaInmUXMQMuPRsnb8jioquyy2tiTKa cfmlRFyeJ9yCgVMZi00N7AsyUDaWxMMPS7oIhp9zXogdwrzzLKsc8pML2ARQR5212wKb +RKEo+2L1IWEEx/CFZUIhFntamQuKcXjWb0F8kUbOo8MNNgDQk0lEhjYeMDmTDnS3WNH QwCQ== X-Gm-Message-State: AElRT7F5qJKzpfhjLOM2r8ArcmtLPwx9R8oh9jjF/0zZLLlJVcwTJ1iS aE8kXovAWBR5PrxPR3tKI0IIRr19wKg/Zyw8PlxFXw== X-Received: by 10.80.165.66 with SMTP id z2mr15436134edb.98.1520368264389; Tue, 06 Mar 2018 12:31:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.139.150 with HTTP; Tue, 6 Mar 2018 12:31:03 -0800 (PST) In-Reply-To: References: <20180306064353.31930-1-xiyou.wangcong@gmail.com> <20180306170011.GD25017@tassilo.jf.intel.com> <20180306175320.GE25017@tassilo.jf.intel.com> From: Ilya Pronin Date: Tue, 6 Mar 2018 12:31:03 -0800 Message-ID: Subject: Re: [PATCH] perf stat: fix cvs output format To: Cong Wang Cc: Andi Kleen , LKML , Arnaldo Carvalho de Melo , Jiri Olsa Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Speaking from the user's seat. An optional (not just empty) cgroup field is fine as long it consistently appears when requested with -G option. The problem with print_metric_csv() was that in the case of unsupported counters 2 additional empty fields in the output are completely unexpected and not documented anywhere. Andi, in the output example in your commit 92a61f6412d3a09d6462252a522fa79c9290f405 stalled-cycles-backend event has counter run time field, counter run time percentage field, empty metric value, empty metric unit, and then 2 other empty fields. Are they expected? If yes, what are they and why other events, e.g. stalled-cycles-frontend, don't have them? Am I missing something here? On Tue, Mar 6, 2018 at 11:03 AM, Cong Wang wrote: > On Tue, Mar 6, 2018 at 9:53 AM, Andi Kleen wrote: >>> Here is the output from your own commit: >>> >>> 423470,,stalled-cycles-frontend,509102,100.00,65.69,frontend cycles idle >>> ,,stalled-cycles-backend,0,100.00,,,, >>> >>> so line 1 has 7 fields, line 2 has 9 fields, and this is expected? >> >> If you had metrics on line 1 it would be correct. >> >> So you just shifted it to break that case. >> >> If you always want to have the same number of fields >> you need to add two empty fields to the normal output >> when there are no metrics. > > The number of separators is the only way to learn the number > of fields, therefore it must be a fixed number. > > Yeah, it could be the other way that supported ones have less > separators than it should. If we look at print_metric_csv() alone, > it should produce a same number of separators for all cases, > otherwise hard to count. > > So I believe we need an additional patch, like the one attached, > to make it complete? Note, I only spot the cgroup field here. -- Ilya Pronin