Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3051552pxb; Tue, 12 Jan 2021 05:17:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7rgTCeJf475ZnFW09V4HS/kVKy1frb+Rd+CGcj2iJwDLP0VA3Eiv6L0XBqItMcpjRm7Rr X-Received: by 2002:a17:906:3b8b:: with SMTP id u11mr3148113ejf.489.1610457452450; Tue, 12 Jan 2021 05:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610457452; cv=none; d=google.com; s=arc-20160816; b=krN/i/GWaJ9xt/Imyb6VnhMu/EzWK8S0Mm1Pv5vA4/hSisEb3oTlZmN3A/KRK0o836 euIVe+TtHDTgCW7nOaF3KqjW9LlzedZvXtmoE+Bal+clBUWDKUOzeHcoOvhBi+IgTsiB FPIZ2PRcET6cG7REiX4Xinvex0BJ53FleSAxanrh1mPfVpTbacVilD8tgjrOIV+Aus6r aYfBQIQ+Z4h5aO/SEQKjVcMaabS6F9tn2fNXCa8PtjddO+R3Ygqb58Ki5qAAABnYBwnv H/Bk7vsUec9IGVGQdyey7eYDwi03rbjxMTvkfFYBNuPGIhHvbqD+WUL9HkNpfnL7s/F6 9rwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=9Np735NRjIEEWPqUTPoZeNLJcbVxZOgu14xBR41rufE=; b=S5GtIeUeRKHOXxFpdvEQ22R1vj+zRyPw/X0vxldsRKSiJ1COtqZ1yvqGKnoMs2look lSNsM8nJSS72hO0wERBZ2vxmty+StAJnINJvc6E+L+Kdg/X61lC/gLeVaOvLv1J8nhyI iBQoWTzIjZUC9cvYWJ77omlPp3qbk48MYzhZmztnwthjCZ2cZIOaIO+SPzKTjdsT+Nvu DmAUyeEeE1OLqURbpyG3U66p8/TUScrp+za+kQqL3tInqsnErxUIz9e5Z/jHQn+Cr+++ F4bF13UVEKnGY8X2LLIdmxwYj4749lB4ms3qNIalUWWMlI2WhuJZ1iJo5KCx68VuQwP9 4BvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 97si1287600edr.29.2021.01.12.05.17.08; Tue, 12 Jan 2021 05:17:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728044AbhALNN0 (ORCPT + 99 others); Tue, 12 Jan 2021 08:13:26 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10714 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404179AbhALM5w (ORCPT ); Tue, 12 Jan 2021 07:57:52 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DFVtQ6zYVzl4CW; Tue, 12 Jan 2021 20:55:42 +0800 (CST) Received: from huawei.com (10.174.28.241) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Tue, 12 Jan 2021 20:56:49 +0800 From: Bixuan Cui To: , , , , , , , CC: Subject: [PATCH 0/2] perf tools: add 'perf irq' to measure the hardware interrupts Date: Tue, 12 Jan 2021 20:55:56 +0800 Message-ID: <20210112125558.72989-1-cuibixuan@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.28.241] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the hardware interrupt processing function is executed, the interrupt and preemption of current cpu are disabled. As a result, the task is suspended. The execution of the hardware processing function takes a long time (for example 5 ms), will affect the task scheduling performance. This patches provides the 'perf irq' command to trace and calculate the time consumed of the hardware irq function. [verse] 'perf irq' {record|timeconsume|script} There are several variants of 'perf irq': 'perf irq record ' to record the irq handler events of an arbitrary workload. 'perf irq script' to see a detailed trace of the workload that was recorded (aliased to 'perf script' for now). 'perf irq timeconsume' to calculate the time consumed by each hardware interrupt processing function. Example usage: perf irq record -- sleep 1 perf irq timeconsume By default it shows the individual irq events, including the irq name, cpu(execute the hardware interrupt processing function), time consumed, entry time and exit time for the each hardware irq: ------------------------------------------------------------------------------------------------------------------------------------------- Irq name | CPU | Time consume us | Handler entry time | Handler exit time ------------------------------------------------------------------------------------------------------------------------------------------- enp2s0f2-tx-0 | [0006] | 0.000001 s | 6631263.313329 s | 6631263.313330 s ------------------------------------------------------------------------------------------------------------------------------------------- Irq name | CPU | Time consume us | Handler entry time | Handler exit time ------------------------------------------------------------------------------------------------------------------------------------------- megasas | [0013] | 0.000003 s | 6631263.209564 s | 6631263.209567 s ------------------------------------------------------------------------------------------------------------------------------------------- Irq name | CPU | Time consume us | Handler entry time | Handler exit time ------------------------------------------------------------------------------------------------------------------------------------------- acpi | [0016] | 0.000018 s | 6631263.085787 s | 6631263.085805 s Bixuan Cui (2): perf tools: add 'perf irq' to measure the hardware interrupts perf tools: Add documentation for 'perf irq' command tools/perf/Build | 1 + tools/perf/Documentation/perf-irq.txt | 58 ++++++ tools/perf/builtin-irq.c | 288 ++++++++++++++++++++++++++ tools/perf/builtin.h | 1 + tools/perf/command-list.txt | 1 + tools/perf/perf.c | 1 + 6 files changed, 350 insertions(+) create mode 100644 tools/perf/Documentation/perf-irq.txt create mode 100644 tools/perf/builtin-irq.c -- 2.17.1