From patchwork Sat Nov 12 03:22:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19094 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089726wru; Fri, 11 Nov 2022 19:25:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf77xCimbzlQkA1qxQ0ScOfFE2Qn1oOGPCGkxidrWp+LkEbkeGiXtCMSKW6EjtLuBPgnsRqv X-Received: by 2002:a17:906:16d0:b0:7ae:31a0:5727 with SMTP id t16-20020a17090616d000b007ae31a05727mr4057866ejd.540.1668223504173; Fri, 11 Nov 2022 19:25:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223504; cv=none; d=google.com; s=arc-20160816; b=PPqZTWb7a4/ps/scynB0wMCr2bkqyjtzEN7hUP6wwMmRbwaR+ViCPcqBWJHalPgqzS CsXVHk8si1ZZJcHRN2hoai1jyqDK6pfAwy1daYQUf4VGN8MXXO52wrN1KOJszdLscxDT S9wdXj30MGEbV/nk954ClI5YM56GPRUGnppsef1QGsHhD5HczMoVoAZY9xGZinA2E65L a/ehpofMKZxZOpExTGLKamzFzkpSbA5eVDosddp+hizro9zUBksr9htFTv8yLNoquDki JDKbzsKLRWj44EbkGLZHkay4PPGt8A/YP0uJdevniExFeX3cMgUiuft9K6BvUBgXYZM6 wQLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=QbEusILygfyXCEYiRvFZYs6C5FIrT8mquksHXk+bSQE=; b=ce0dotqg/BVl81TNZh8NEMGrGwcV+hQDxw9yC5yDoF3jQl2KdX9YpPLbLpeoBufuxF CS9GKmhyvcISBrkx0xsZAptRthpB6pGYeewN69YEHQZLF65oWX6LE2v3qQOq3ZkFNhLb 5C6qtjEn0SYR2ymkfNJdxOlXWcAWk+i4r0RUAdxL0tmVZ1Lz/J3yAC8/tWWiJrpOSzsI g/7Wlfyrp+Q8heSjD3Ab0ozyfQknwBTjCLLULU5DasQ9pO/y6plf9b3v8Szfwq8+4lex hAU6+onWoPTrPtrA9bVf5KKq9uphkG+379jKOwp/jIqz0NatIV3qFw3hXT4sfI2X1gzs HvBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nFWYLFCB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp17-20020a170906c15100b007a9d456583bsi3486716ejc.62.2022.11.11.19.24.40; Fri, 11 Nov 2022 19:25:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nFWYLFCB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234603AbiKLDXP (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234431AbiKLDXC (ORCPT ); Fri, 11 Nov 2022 22:23:02 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44DA16BDEF; Fri, 11 Nov 2022 19:23:01 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id g62so6401919pfb.10; Fri, 11 Nov 2022 19:23:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=QbEusILygfyXCEYiRvFZYs6C5FIrT8mquksHXk+bSQE=; b=nFWYLFCBnNJIWO0i7LwEHho/IHZxZr9ZFzjAaSJ0N103+jj0CMLjuhKLu8cWWS9oox i3mEVOCCFaBd05ZpkrIjuv0ljua8sjwbR26wry1ReovQUOhTBr77hZNPPuhjuL4KqCMd LaMtQPUb/BqSPJzKQvYWILGIFyHcryi4bbwM1MiGvs2oQUC8AEhxjd1awBVSRwLLKR6R 34kNGr/yJvQ46fN04rkxH6NuLnW8TFLcdHUacFb4MHlgczWUiw13wYvChLtfoLXQBOFs +fxlDveeGlTqp6I/VPRZW6FHIoV8tAjmjF7xG1H2LOb5N7LL+Nu98j49F/kIznWdz1zb kKLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QbEusILygfyXCEYiRvFZYs6C5FIrT8mquksHXk+bSQE=; b=gnF2yUYvZQ7LGprX0vSyrpFRhhnmr60i1EYV6nKEbtfE3r5BdxpaUB7X3ILGlcfK23 DZ+WUVpps3MvAIR1SZOHoI9ynwBWTeGacwbQpXB3Fh+WyPDeArulZ3UQaTQFyb5texsu wA2EiZZXExK8SONf8wv7OBVjvOufPiUbBx0ynvutKwqUjPGlMkXJKwhiRznImcXV/vLr VM1lzaVN/CHUBD7WPthkyqeSoPnmrdhOsNPYB1y3KGCop8fBX7b2OfjUclR4BMORISWN K5MDsFK2YYiJmvoC3hUrAECbIWWl/d2mjoHprcsYySOsPjEE+8HhSuEuXADoZ6Lb2xW3 6S6w== X-Gm-Message-State: ANoB5pkHPmlSby5OjHPBfAULdrA9YXnZOsXMJNx2YWhZWgS4Aa070Bnu yUbssFDWCZhtrWoxUDRaFSE= X-Received: by 2002:a63:e60b:0:b0:470:3fc2:2b08 with SMTP id g11-20020a63e60b000000b004703fc22b08mr4006195pgh.162.1668223380465; Fri, 11 Nov 2022 19:23:00 -0800 (PST) Received: from balhae.roam.corp.google.com ([2607:fb90:27dc:8408:33d7:3b01:eee1:84b]) by smtp.gmail.com with ESMTPSA id ij25-20020a170902ab5900b00186f0f59d1esm2434552plb.192.2022.11.11.19.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:23:00 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Kan Liang , Zhengjun Xing , James Clark Subject: [PATCH 07/11] perf stat: Add header for interval in JSON output Date: Fri, 11 Nov 2022 19:22:40 -0800 Message-Id: <20221112032244.1077370-8-namhyung@kernel.org> X-Mailer: git-send-email 2.38.1.493.g58b659f92b-goog In-Reply-To: <20221112032244.1077370-1-namhyung@kernel.org> References: <20221112032244.1077370-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749259129009129772?= X-GMAIL-MSGID: =?utf-8?q?1749259129009129772?= It missed to print a matching header line for intervals. Before: # perf stat -a -e cycles,instructions --metric-only -j -I 500 {"unit" : "insn per cycle"} {"interval" : 0.500544283}{"metric-value" : "1.96"} ^C After: # perf stat -a -e cycles,instructions --metric-only -j -I 500 {"unit" : "sec"}{"unit" : "insn per cycle"} {"interval" : 0.500515681}{"metric-value" : "2.31"} ^C Acked-by: Ian Rogers Signed-off-by: Namhyung Kim --- tools/perf/util/stat-display.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index dbd3ba380c9f..03d58277e8d6 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -860,6 +860,10 @@ static void print_metric_headers(struct perf_stat_config *config, if (!config->iostat_run) fputs(aggr_header_csv[config->aggr_mode], config->output); } + if (config->json_output) { + if (config->interval) + fputs("{\"unit\" : \"sec\"}", config->output); + } if (config->iostat_run) iostat_print_header_prefix(config);