From patchwork Wed Jun 28 20:01:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 11408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9182020vqr; Wed, 28 Jun 2023 13:11:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ596l8RRoeTLdsHwjVEp1bVCvMmkMuLDqg1S2aFRKO3yuMK9qrbpIiPnkvZ7LIrRFfxld65 X-Received: by 2002:a17:903:3303:b0:1b8:1591:9f81 with SMTP id jk3-20020a170903330300b001b815919f81mr7380983plb.4.1687983116541; Wed, 28 Jun 2023 13:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687983116; cv=none; d=google.com; s=arc-20160816; b=V/z+J7eHwCyCAYBK5V0eXVJROyiTKG21uJNIJslGEOQWpQynU6zIuVqExE3g3GrcTG pJ9YOnNa756hIhv3RLI6jXdWudYaLG53PCG6LPksyrhkRKLyAW6rbS4hLm6V2isEe9vG q1n5qQVGHnxb7rQmXbjhd9hpqXMKMwm9EEnZhwvNR0ALqgRkaXqB6tUuthE9Zm10YyD+ K0itUj9MfotzekPB0L7j3T65AXyJBrfnqxwbCI4s2uz/2xLHFCjJ5ftPgoeWFe6MS0OT RWd8t3qNvGECaMoTSq7Dn1EQnNJ3ZRcrHQC+lzPkpukfsuTqv6WGvtIl9+oMYrV77uHq uRIQ== 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 :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=J9UHeSAtDRa1tBV+A6elzPizNDbYef1MWO1gfBdmee8=; fh=qg0XpHrrfjSy6nePy3ZLIayRkwEhRnO8Y6NeBhcC42U=; b=LYVMaXQHEJRcbUhJIf8p2CFg/FXIuglwdkVrCwQEvbQJ+Xam7/mDsQ19KrQrNQ/Bi5 xR2JtEiPcGpmlqZL/UrCiOV2ghaxphHX9anxan8Z2QBhCN9efhHqnHP6JbAfSmmbmJN7 FL4UhpEiY1uQWiT7aRrsEdWIHH2YTtIFSfmHA9rcJCufQEu3g+Rg3l8zVvS2bb04tHyS Hu0rVEhA+kzH62lUByfgz8+2GF806Hm1szAlI6+wny8VA0J5Jz0ALG5o1acVKM8Z/HSv KkFXXrM0G250knKf3LjpsGUiK0gTXdLRRD/TBqM9uMMFSLwhpcz5A0oF357q9RqJ67Hp yHfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jYpyHokZ; 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 s7-20020a170902b18700b001b69bc74fd7si8767687plr.157.2023.06.28.13.11.42; Wed, 28 Jun 2023 13:11:56 -0700 (PDT) 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=20221208 header.b=jYpyHokZ; 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 S231571AbjF1UBw (ORCPT + 99 others); Wed, 28 Jun 2023 16:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231563AbjF1UBp (ORCPT ); Wed, 28 Jun 2023 16:01:45 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D13171FEF; Wed, 28 Jun 2023 13:01:44 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-666ed230c81so151775b3a.0; Wed, 28 Jun 2023 13:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687982504; x=1690574504; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=J9UHeSAtDRa1tBV+A6elzPizNDbYef1MWO1gfBdmee8=; b=jYpyHokZBf/wDq+Thhimi6BWl8Ao7q54AXXqyRDqWc9ylXCununK4TIZgB6ZQaOyXt il23nxf+D6HzYWRfPOL8sUo1mRRwFuuoP44OT4yEFoJgyyzmC9HwzSVQELJOWkdnY9nk f0N5qYS5TOkEEwFzkQ5ZVtp2XATmH2hx9u7iCm7J1c03X6Q4sqvNUym6ZLfeblFujBSz rNOW2EeK8Td0T5cshaQ8vm6cZ+RxBn72Gj/RxGBIR8Cbo9d1Ne9MQvl/tuOiRdhXZ1tz 8MAYeIjDBcRp1p74a+uH3+fASHHSBG9/2zH7YsjzlU5t/+JGOBLyiN7oy3SpNC7axqQi tdRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687982504; x=1690574504; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=J9UHeSAtDRa1tBV+A6elzPizNDbYef1MWO1gfBdmee8=; b=EOAw1gkRr1jJhbdevqm0po+HUbD9Fx1h02k2LNOIyEr87nACtc2MjmwMXulqx+87Nz 8IFAjCiEhecYDIINVXCNqX12ogiXVWv8NYXwHbome40KDkpv0rYr7xVdEtzAdh6Fs1oR MG8kTjfvpF0eVVniZBFqh0Ua/TnLX0Um6BE/QFwAESMjt+IuqjtGAUtpMwvNAt+mJT8I Y8/YvBbWoW8G8rozvNbvOdx+2KudBy8gLm4E7jVraFBc9yzoceXEOtYUZVZeHIk7344D 9DtXtJKxhb4ideW4ZMBX927oabs1vJrVy7Dr06EXZxBRRzlsroyL8NQytQdOMv+RegbZ 1VAw== X-Gm-Message-State: AC+VfDwVJsBWn1353lTpLnUHoe6C8AJEsgonnx194bUYIEO3/fDxRhtc d464NvYzmDs6BXYE3KIzFG0= X-Received: by 2002:a05:6a00:b90:b0:674:8fe0:126f with SMTP id g16-20020a056a000b9000b006748fe0126fmr14350665pfj.27.1687982504161; Wed, 28 Jun 2023 13:01:44 -0700 (PDT) Received: from bangji.corp.google.com ([2620:15c:2c0:5:fc6b:e50c:c8f0:b09b]) by smtp.gmail.com with ESMTPSA id f3-20020aa78b03000000b0065e154bac6dsm7340376pfd.133.2023.06.28.13.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 13:01:43 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Song Liu , Hao Luo Subject: [PATCHSET 0/4] perf lock contention: Add CSV style output support (v2) Date: Wed, 28 Jun 2023 13:01:37 -0700 Message-ID: <20230628200141.2739587-1-namhyung@kernel.org> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog 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,T_SCC_BODY_TEXT_LINE 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?1769978584516426519?= X-GMAIL-MSGID: =?utf-8?q?1769978584516426519?= Hello, This is v2 of perf lock contention CSV output change. I've added --output option and a test case according to Ian's feedback. Sometimes we want to process the output by external programs. Let's add the -x option to specify the field separator like perf stat. $ sudo ./perf lock con -ab -x, sleep 1 # output: contended, total wait, max wait, avg wait, type, caller 19, 194232, 21415, 10222, spinlock, process_one_work+0x1f0 15, 162748, 23843, 10849, rwsem:R, do_user_addr_fault+0x40e 4, 86740, 23415, 21685, rwlock:R, ep_poll_callback+0x2d 1, 84281, 84281, 84281, mutex, iwl_mvm_async_handlers_wk+0x135 8, 67608, 27404, 8451, spinlock, __queue_work+0x174 3, 58616, 31125, 19538, rwsem:W, do_mprotect_pkey+0xff 3, 52953, 21172, 17651, rwlock:W, do_epoll_wait+0x248 2, 30324, 19704, 15162, rwsem:R, do_madvise+0x3ad 1, 24619, 24619, 24619, spinlock, rcu_core+0xd4 The first line is a comment that shows the output format. Each line is separated by the given string ("," in this case). The time is printed in nsec without the unit so that it can be parsed easily. The code is available at 'perf/lock-con-csv-v2' branch in git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git Thanks, Namhyung Namhyung Kim (4): perf lock: Remove stale comments perf lock contention: Add -x option for CSV style output perf lock contention: Add --output option perf test: Test perf lock contention CSV output tools/perf/Documentation/perf-lock.txt | 5 + tools/perf/builtin-lock.c | 383 ++++++++++++++++------ tools/perf/tests/shell/lock_contention.sh | 36 ++ 3 files changed, 328 insertions(+), 96 deletions(-)