Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp198429rwb; Wed, 9 Nov 2022 00:53:58 -0800 (PST) X-Google-Smtp-Source: AMsMyM7/6DsUrPzj6Vg8oGbBuVmGl+tth2qYb/4m9BXxfJc1LoWEugofq5v9ecY33mdF13g40+zi X-Received: by 2002:a17:902:e493:b0:186:9de4:a7cd with SMTP id i19-20020a170902e49300b001869de4a7cdmr59823836ple.66.1667984037743; Wed, 09 Nov 2022 00:53:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667984037; cv=none; d=google.com; s=arc-20160816; b=YsBd+IPnr5fkVtihhKZvezgl6wTcEz/2p6tSotuRgOzbs3Bg+RD/CfOQBssHSb3s8B PjsktAmjEVeCTX6nmbF5I5nq24+85Hqufpl3HriUNL4vekgQohGyo+M+cnVb/Go79uWU V7urQ3etSrti9TDJ2HnpKoqwQN59V1mg5tmSthYVo/L/elCvm87mzorAFbRIPBqeDXd/ aMzrQVFS7Dr/cMyxMf6hHLgwIRP+1T6apS9+Wg3+I6QLywooqJrjxPanFwj8TFa+VRvZ rVhQoNHCqLBIbj/iTB/tCwKSxYW8ojuj7WZf5KynqoZ4I/O+jIN3Mur8rAFg3bnGbnAu sV2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=RJr0wA582tObpLjGkPrV81pbRCL92tNFMlfnw82H+7k=; b=kBPn7+hl92nL48nqyQImo94fbMcd05nLpcHcG+Zix0pfhlOfk8EUBl4QKxszy5JNkC 9gNNCYXXUZD28urwX250STafPyqraqJrmPI74+vgLHlIsC8+YdSh6ig18hd2B1VBPNpk Kv+mEZ9M77Ah6LLuPhfbdcCFvXSBetBVdI0XJqWT+H+9/LvFltEIdWUiK68yNo+dznEF BGR/S1thR/MhW7x2wWthPfwhtiJaZHH+uMNS0MyoSufto8F8g/AAZcsS2Hxed23IVOVI Nk0JONrrHfoTvMw3cPGBziWcT53cIXhZRAEikXx1Hj9Z4zoLa8VOcyF48TkYSe0xc2l8 73+g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020a63f90d000000b00439ae523fd2si17749078pgi.289.2022.11.09.00.53.46; Wed, 09 Nov 2022 00:53:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230161AbiKIIax (ORCPT + 93 others); Wed, 9 Nov 2022 03:30:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230028AbiKIIaT (ORCPT ); Wed, 9 Nov 2022 03:30:19 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 426AD22B10; Wed, 9 Nov 2022 00:29:19 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8DxTtvXZGtjgYEFAA--.17858S3; Wed, 09 Nov 2022 16:29:11 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxtuPTZGtjJnIPAA--.42697S5; Wed, 09 Nov 2022 16:29:10 +0800 (CST) From: Tiezhu Yang To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Cc: Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH v4 3/4] perf bench syscall: Add getpgrp syscall benchmark Date: Wed, 9 Nov 2022 16:29:06 +0800 Message-Id: <1667982547-22331-4-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1667982547-22331-1-git-send-email-yangtiezhu@loongson.cn> References: <1667982547-22331-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8BxtuPTZGtjJnIPAA--.42697S5 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoWxAF17Zr13ZFWUZF4rury8Zrb_yoW5uw43pF 97Cw48Aw4rWFWYvw1Iqr10gry7AwnrZryrK3Wak3yDZrW2q343tr47KFy3WF17Zw47ta45 uFs7ZrW8X3WrJaUanT9S1TB71UUUUj7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bSxYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l n4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6x ACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E 87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxV Aaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxY O2xFxVAFwI0_JF0_Jw1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGV WUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_ Xr0_Ar1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rV WUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4U JbIYCTnIWIevJa73UjIFyTuYvjxU4Xo7DUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 This commit adds a simple getpgrp syscall benchmark, more syscall benchmarks can be added in the future. Signed-off-by: Tiezhu Yang --- tools/arch/x86/include/uapi/asm/unistd_32.h | 3 +++ tools/arch/x86/include/uapi/asm/unistd_64.h | 3 +++ tools/perf/bench/bench.h | 1 + tools/perf/bench/syscall.c | 11 +++++++++++ tools/perf/builtin-bench.c | 1 + 5 files changed, 19 insertions(+) diff --git a/tools/arch/x86/include/uapi/asm/unistd_32.h b/tools/arch/x86/include/uapi/asm/unistd_32.h index 4d8873a..2bcf47f 100644 --- a/tools/arch/x86/include/uapi/asm/unistd_32.h +++ b/tools/arch/x86/include/uapi/asm/unistd_32.h @@ -2,6 +2,9 @@ #ifndef __NR_getppid #define __NR_getppid 64 #endif +#ifndef __NR_getpgrp +#define __NR_getpgrp 65 +#endif #ifndef __NR_gettid #define __NR_gettid 224 #endif diff --git a/tools/arch/x86/include/uapi/asm/unistd_64.h b/tools/arch/x86/include/uapi/asm/unistd_64.h index e29038a..5472203 100644 --- a/tools/arch/x86/include/uapi/asm/unistd_64.h +++ b/tools/arch/x86/include/uapi/asm/unistd_64.h @@ -2,6 +2,9 @@ #ifndef __NR_getppid #define __NR_getppid 110 #endif +#ifndef __NR_getpgrp +#define __NR_getpgrp 111 +#endif #ifndef __NR_gettid #define __NR_gettid 186 #endif diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h index 6cefb43..7ccc021 100644 --- a/tools/perf/bench/bench.h +++ b/tools/perf/bench/bench.h @@ -34,6 +34,7 @@ int bench_numa(int argc, const char **argv); int bench_sched_messaging(int argc, const char **argv); int bench_sched_pipe(int argc, const char **argv); int bench_syscall_basic(int argc, const char **argv); +int bench_syscall_getpgrp(int argc, const char **argv); int bench_mem_memcpy(int argc, const char **argv); int bench_mem_memset(int argc, const char **argv); int bench_mem_find_bit(int argc, const char **argv); diff --git a/tools/perf/bench/syscall.c b/tools/perf/bench/syscall.c index 746fd71..2b89884 100644 --- a/tools/perf/bench/syscall.c +++ b/tools/perf/bench/syscall.c @@ -46,6 +46,9 @@ static int bench_syscall_common(int argc, const char **argv, int syscall) case __NR_getppid: getppid(); break; + case __NR_getpgrp: + getpgrp(); + break; default: break; } @@ -58,6 +61,9 @@ static int bench_syscall_common(int argc, const char **argv, int syscall) case __NR_getppid: name = "getppid()"; break; + case __NR_getpgrp: + name = "getpgrp()"; + break; default: break; } @@ -100,3 +106,8 @@ int bench_syscall_basic(int argc, const char **argv) { return bench_syscall_common(argc, argv, __NR_getppid); } + +int bench_syscall_getpgrp(int argc, const char **argv) +{ + return bench_syscall_common(argc, argv, __NR_getpgrp); +} diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c index 334ab89..20ca4ac 100644 --- a/tools/perf/builtin-bench.c +++ b/tools/perf/builtin-bench.c @@ -52,6 +52,7 @@ static struct bench sched_benchmarks[] = { static struct bench syscall_benchmarks[] = { { "basic", "Benchmark for basic getppid(2) calls", bench_syscall_basic }, + { "getpgrp", "Benchmark for getpgrp(2) calls", bench_syscall_getpgrp }, { "all", "Run all syscall benchmarks", NULL }, { NULL, NULL, NULL }, }; -- 2.1.0