Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1003971lqm; Thu, 2 May 2024 02:15:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMuWVcRBUI2E8H551KjfYftGzPJTInC4m9nHsCYUngrzmwAiTg4U6vHWpqVBUSDpEq8+IA4pEgPgxw8ryZGcI53IO6u9HUSZKxzdq0sA== X-Google-Smtp-Source: AGHT+IEoENRSe9aC+0IkpFu2mAyMghtSwOA3hnmBdTdbQ5GI0pgDcLE+LFF8Zxl4UDcwwAH516v5 X-Received: by 2002:a17:903:2693:b0:1e4:dcfe:848f with SMTP id jf19-20020a170903269300b001e4dcfe848fmr4615356plb.16.1714641333998; Thu, 02 May 2024 02:15:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714641333; cv=pass; d=google.com; s=arc-20160816; b=QLz2VEtTfPPpuJvOtDEorNKDwxD222DQvEBqRw8gyOLLQCG5DKqk5qLM9g6gP3qxFS SgSpi+gXRY7aQK7LR4CaStd0xIGdwN8fTt8VItD+7B27Cs0Furgp34M6yEQqx9mr8l/T It02i9TPXVGEQOoFAkwLk6W5c1bvpXEj/0G4iBYG0KpBZtlS+wfatGVuybMZMc/AnJJb pZ9am3gmxCvfTeiWorJpH+WTL9dKqXddaLiIn4Y+gpWLXtLR+l9LqDmvhKwTd3JBIT7J X48tBNRXVwzanrFwmJhPKHtleVxnvmElQAn9T61xYpjxp3bwpTFfSn1jfoTujy6wKKfC EzsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=wGQ5Zfq5EVsw409bQ2LvVV72slLXZAdWCfxSDngbCIc=; fh=MdU3VyQnrFaW1GIB4buG2JmU6lAGIkqBx/KgcKwyPqg=; b=JhOwVm54rlOmIa4b6ouhg80wEdw6AGLuLsWtNQKC1v+JSv4XK5oigIZJP06Q+s4OwM 4vmCiSkCC3og0pgvLHoEHpmx7/TCzjUjTfqgFYcu2eSM73DNfCCbwcuQ+J6ysYIlFcwf devAGxNkUKL5+zcygwXPtJeHcF2YZs7zE3DEssuhx1hSsl1VlemZoZ6KKJMJkzyNkWtj XYF5sHR0jZyH/ILKLVsHTR0BpSpRWfrd3n22wXWF9FAIhuKRWb6g7WmIGVySOJNn3JEB mixhvSw5xduvnppiYbJoTWd+0OD38tqQTCmPOs2BK1vbhfghg6R+NqokBcBQpiLOa2LE HgFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-166191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166191-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m1-20020a170902db0100b001ea594ae4d0si636886plx.222.2024.05.02.02.15.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 02:15:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-166191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166191-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9AFA82808DF for ; Thu, 2 May 2024 09:15:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87AC554777; Thu, 2 May 2024 09:15:15 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACFE9524D4; Thu, 2 May 2024 09:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714641315; cv=none; b=oUNQ5D7mVmDMnCSdpZ8wnnqm/ouM1ce055UC1aZAm6yCnvHXNfs4yD5F4CXrtUlM5b9P6kcN/mQIurf8WRF+V/t3C9Hi/kwcnWroycGmz05rwVxv7fKTIx0lOfScQMXUVWerCxwXUR8JVUwBeKCgrFmGlP8PrQrfJYg/UsfrzVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714641315; c=relaxed/simple; bh=V+fMi3wAVPt94aZ1od5h3gV+HlEfxFhPy0HJtK9h5wY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nEjlmwSdTIWvssf/EQTBht0yAFZFSvOndcN0nnbUft8ucJ2RdM0/oF5PCNT4s2/NXi6iRHUd72eZavbM7/LEOA33rUWRwgGvisk4+4nFg2Zj51CCIPZNY/CT/6tAhBZR86s6FgliiDycOs2GOsC6e0f3oup0uiphxR8Kf6jJxBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9834B2F4; Thu, 2 May 2024 02:15:38 -0700 (PDT) Received: from dsg-hive-n1sdp-01.cambridge.arm.com (dsg-hive-n1sdp-01.cambridge.arm.com [10.2.3.10]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AB9823F71E; Thu, 2 May 2024 02:15:11 -0700 (PDT) From: Nick Forrington To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Nick Forrington , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" Subject: [PATCH v2 1/1] perf lock info: Display both map and thread by default Date: Thu, 2 May 2024 09:14:45 +0000 Message-ID: <20240502091446.3037-2-nick.forrington@arm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502091446.3037-1-nick.forrington@arm.com> References: <20240502091446.3037-1-nick.forrington@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Change "perf lock info" argument handling to: Display both map and thread info (rather than an error) when neither are specified. Display both map and thread info (rather than just thread info) when both are requested. Signed-off-by: Nick Forrington --- tools/perf/Documentation/perf-lock.txt | 4 ++-- tools/perf/builtin-lock.c | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tools/perf/Documentation/perf-lock.txt b/tools/perf/Documentation/perf-lock.txt index f5938d616d75..57a940399de0 100644 --- a/tools/perf/Documentation/perf-lock.txt +++ b/tools/perf/Documentation/perf-lock.txt @@ -111,11 +111,11 @@ INFO OPTIONS -t:: --threads:: - dump thread list in perf.data + dump only the thread list in perf.data -m:: --map:: - dump map of lock instances (address:name table) + dump only the map of lock instances (address:name table) CONTENTION OPTIONS diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 230461280e45..86c68c39aac0 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -1483,11 +1483,16 @@ static int dump_info(void) if (info_threads) dump_threads(); - else if (info_map) + + if (info_map) { + if (info_threads) + fputc('\n', lock_output); dump_map(); - else { + } + + if (!info_threads && !info_map) { rc = -1; - pr_err("Unknown type of information\n"); + pr_err("No lock info specified\n"); } return rc; @@ -2578,9 +2583,9 @@ int cmd_lock(int argc, const char **argv) const struct option info_options[] = { OPT_BOOLEAN('t', "threads", &info_threads, - "dump thread list in perf.data"), + "dump only the thread list in perf.data"), OPT_BOOLEAN('m', "map", &info_map, - "map of lock instances (address:name table)"), + "dump only the map of lock instances (address:name table)"), OPT_PARENT(lock_options) }; @@ -2694,6 +2699,13 @@ int cmd_lock(int argc, const char **argv) if (argc) usage_with_options(info_usage, info_options); } + + /* If neither threads nor map requested, display both */ + if (!info_threads && !info_map) { + info_threads = true; + info_map = true; + } + /* recycling report_lock_ops */ trace_handler = &report_lock_ops; rc = __cmd_report(true); -- 2.44.0