Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1115782imw; Fri, 8 Jul 2022 19:33:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vTEOKqWu7kqIaTEdFRuhj4KcQELqhGy0NfITFNnWxN/lhJJw6AJzXkpW5/Y0KUouIYbr/3 X-Received: by 2002:a05:6402:448e:b0:43a:9d20:a4ec with SMTP id er14-20020a056402448e00b0043a9d20a4ecmr8902390edb.269.1657334018537; Fri, 08 Jul 2022 19:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657334018; cv=none; d=google.com; s=arc-20160816; b=OvkZVXkQ6cry44rWtj7KT4QUE+mVRM64iRJogySivusDygJ4H5toM/kyEcmsXaTJ/o OZB9yQ/S+X/dUMbNG/ozuqJHhCFZe2Uwrh7rFcYu4h6U7Zs0yi6k2igwGtOdb0PK/WML NFDnf6k2K/4/+6XNSwJ8xeJg4IGyygBjbCv1Jf3Cem4XbFXj2qJwkOKAFn3/ePopp8Te Vdl1keWuZTovZZHzfPLZ6yOb5f8elv4KtVAJ3hGsuFYKZYttbvG6eHKfJJJwf1uy5kKs qtsVWY2Q+cQ9QQG3ogZsZjNCp999OUcYSBQn5m4IGmS3c1rkVYWTXIDw6Q2ppzNfNxli 0rKQ== 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; bh=bqDlPJGpUYDh9BLi/D4A/I/3+jyAb2S0Nmm3x47KeX4=; b=o4+Te8euMB5/r26m+8vsUwMRR5nCe8NJ+qiiDaPTHCH41Phcm5tUKyucY4Gpj9wKWq Le26/gJcnzYJJawqLHY3dxs8QUBxmu+lLpNP9YidEmSOB9nIFApcRWKCYA2zfcS8avF3 O+mrdeM1PhGiB3O6Q56XmCmEOxh3TffCEr2FS9rQQoPu0h+aaV53Z3I5Q0wwauqrhEVr cOnZf59E3RBw4GAl7ZGZicavnwG8Qa2/OEPhfoiiGXH2wgtmlDn0WA3sJfUOHWk0foRn K3kC+TRH65LhWD1I96pixH/RkVh1H7DraNkKvvNbIK4uiUp+6RLoVzWEPbttKaan4/8j /3mg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a056402191000b0043a50590dabsi717745edz.87.2022.07.08.19.33.13; Fri, 08 Jul 2022 19:33:38 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbiGIBxq (ORCPT + 99 others); Fri, 8 Jul 2022 21:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbiGIBxG (ORCPT ); Fri, 8 Jul 2022 21:53:06 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09EFB7AB02; Fri, 8 Jul 2022 18:53:05 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LftQL2P5yz1L9CW; Sat, 9 Jul 2022 09:50:34 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 9 Jul 2022 09:53:03 +0800 Received: from ubuntu1804.huawei.com (10.67.174.61) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 9 Jul 2022 09:53:02 +0800 From: Yang Jihong To: , , , , , , , , , CC: Subject: [RFC v3 12/17] perf kwork: Add workqueue latency support Date: Sat, 9 Jul 2022 09:50:28 +0800 Message-ID: <20220709015033.38326-13-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20220709015033.38326-1-yangjihong1@huawei.com> References: <20220709015033.38326-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.61] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Implements workqueue latency function. Test cases: # perf kwork -k workqueue lat Kwork Name | Cpu | Avg delay | Count | Max delay | Max delay start | Max delay end | -------------------------------------------------------------------------------------------------------------------------------- (w)vmstat_update | 0001 | 5.004 ms | 1 | 5.004 ms | 44001.745646 s | 44001.750650 s | (w)vmstat_update | 0006 | 1.773 ms | 1 | 1.773 ms | 44000.830840 s | 44000.832613 s | (w)vmstat_shepherd | 0000 | 0.992 ms | 8 | 2.474 ms | 44007.717845 s | 44007.720318 s | (w)vmstat_update | 0000 | 0.974 ms | 5 | 2.624 ms | 44004.785970 s | 44004.788594 s | (w)e1000_watchdog | 0002 | 0.687 ms | 5 | 2.632 ms | 44005.009334 s | 44005.011966 s | (w)vmstat_update | 0002 | 0.307 ms | 1 | 0.307 ms | 44004.817395 s | 44004.817702 s | (w)vmstat_update | 0004 | 0.296 ms | 1 | 0.296 ms | 43997.913677 s | 43997.913973 s | (w)mix_interrupt_randomness | 0000 | 0.283 ms | 285 | 3.724 ms | 44006.790889 s | 44006.794613 s | (w)neigh_managed_work | 0001 | 0.271 ms | 1 | 0.271 ms | 43997.665542 s | 43997.665813 s | (w)vmstat_update | 0005 | 0.261 ms | 1 | 0.261 ms | 44007.820542 s | 44007.820803 s | (w)neigh_managed_work | 0004 | 0.220 ms | 1 | 0.220 ms | 44002.953287 s | 44002.953507 s | (w)neigh_periodic_work | 0004 | 0.217 ms | 1 | 0.217 ms | 43999.929718 s | 43999.929935 s | (w)mix_interrupt_randomness | 0002 | 0.199 ms | 5 | 0.310 ms | 44005.012316 s | 44005.012625 s | (w)vmstat_update | 0003 | 0.199 ms | 4 | 0.307 ms | 44005.714391 s | 44005.714699 s | (w)gc_worker | 0001 | 0.071 ms | 173 | 1.128 ms | 44002.062579 s | 44002.063707 s | -------------------------------------------------------------------------------------------------------------------------------- INFO: 0.020% skipped events (17 including 10 raise, 7 entry, 0 exit) Signed-off-by: Yang Jihong --- tools/perf/builtin-kwork.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c index fa09d4eea913..4902bc73aca1 100644 --- a/tools/perf/builtin-kwork.c +++ b/tools/perf/builtin-kwork.c @@ -767,6 +767,20 @@ static struct kwork_class kwork_softirq = { }; static struct kwork_class kwork_workqueue; +static int process_workqueue_activate_work_event(struct perf_tool *tool, + struct evsel *evsel, + struct perf_sample *sample, + struct machine *machine) +{ + struct perf_kwork *kwork = container_of(tool, struct perf_kwork, tool); + + if (kwork->tp_handler->raise_event) + return kwork->tp_handler->raise_event(kwork, &kwork_workqueue, + evsel, sample, machine); + + return 0; +} + static int process_workqueue_execute_start_event(struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, @@ -796,7 +810,7 @@ static int process_workqueue_execute_end_event(struct perf_tool *tool, } const struct evsel_str_handler workqueue_tp_handlers[] = { - { "workqueue:workqueue_activate_work", NULL, }, + { "workqueue:workqueue_activate_work", process_workqueue_activate_work_event, }, { "workqueue:workqueue_execute_start", process_workqueue_execute_start_event, }, { "workqueue:workqueue_execute_end", process_workqueue_execute_end_event, }, }; -- 2.30.GIT