From patchwork Wed Dec 14 14:25:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 13073217 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A51EFC001B2 for ; Wed, 14 Dec 2022 14:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238269AbiLNO0S (ORCPT ); Wed, 14 Dec 2022 09:26:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238316AbiLNO0M (ORCPT ); Wed, 14 Dec 2022 09:26:12 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CAC1275DE for ; Wed, 14 Dec 2022 06:26:10 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id s7so3491113plk.5 for ; Wed, 14 Dec 2022 06:26:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7LZlR6Bad0hmj0yfP1fW6/YZEKORyAPx8ltFpb+vzAg=; b=jCFbjQgKtfcgCHc2e84cyzJSja23Rhz1Pu6DW53VjJ/hM5ZUXvH9DyKrkTg5FaUBXq WjyDaa/oGN5WB/qrNJel3S5WHo3Nslm2E8YAzYRNgtAYKEuDI0BVQt9ctI5LCb3AQ779 N9qomZc7y1M91JV4IqNMN/VCDwI1hiS23dhNZMpeuKSPvB/VQox8BZPT40t3EMyGBov7 bM6DPN4ivoBEshb5Qo65SlvwHvY1fCNFEVRgsHkpdoPy7VjS/tIcMuBsYje+L9QlA616 SFaMmd8fv3sDUwyZ+jB0woUzxuqfmhNYYhFz+20T+5CT+LQx/KHKZozrkbptdlo+3SUx o3MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7LZlR6Bad0hmj0yfP1fW6/YZEKORyAPx8ltFpb+vzAg=; b=eG53U1Ga/yMfmYwicWJVwcb5saARzsBTrpm9FM2oCZLWs6Crh6DL2e4NdpOmiBHxiO C/JA33KCekLQCOmJCnhHf2UpidZr7Vi/F3Zbb7bt4+XYBS1n6xK+EW/R1QGw+a4Ksisy UBlT9j5y1REH4YPgLphdStT+bPDZbb/axTZOPi1FpEpTndwuG56AF3N4UNdOg7lOsTdq ZASjErawZUf9Tw+yi2FvXVPoHfNDlWkKW042OefmNPKzK6QzNeoMUEsI/uFcUKPBIBYf 45VzaS/7ndCuVJgKfen8VNFua1RhTCZm73+lVmRX0HvjIY9C7eYZ0oWCComF3Nlf0qMF FzCg== X-Gm-Message-State: ANoB5pnW9t7s5GJe+JeiicCrt8vsa/1iiWfjKtmbhZqYpg1CJWwh/3NU KSoArCsbQmuvPMuTDXbPEqORt/AqJOECMg== X-Google-Smtp-Source: AA0mqf6mfAoL+O9CVLmj9ta1KHQJQUAAWv9dT0mBzBKvWKAvOfs96jn20ncMYwbeEnPSFm5AUr7OnA== X-Received: by 2002:a05:6a20:c887:b0:a7:9c6a:4a64 with SMTP id hb7-20020a056a20c88700b000a79c6a4a64mr27646809pzb.8.1671027969148; Wed, 14 Dec 2022 06:26:09 -0800 (PST) Received: from localhost.localdomain ([111.201.145.40]) by smtp.gmail.com with ESMTPSA id u4-20020a17090341c400b00187033cac81sm1942915ple.145.2022.12.14.06.26.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Dec 2022 06:26:08 -0800 (PST) From: xiangxia.m.yue@gmail.com To: bpf@vger.kernel.org Cc: Tonghao Zhang , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Hou Tao Subject: [bpf-next 2/2] bpftool: add runtime stats, max cost Date: Wed, 14 Dec 2022 22:25:39 +0800 Message-Id: <20221214142539.73650-2-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20221214142539.73650-1-xiangxia.m.yue@gmail.com> References: <20221214142539.73650-1-xiangxia.m.yue@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net From: Tonghao Zhang Signed-off-by: Tonghao Zhang Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Andrii Nakryiko Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: John Fastabend Cc: KP Singh Cc: Stanislav Fomichev Cc: Hao Luo Cc: Jiri Olsa Cc: Hou Tao --- tools/bpf/bpftool/prog.c | 1 + tools/include/uapi/linux/bpf.h | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index cfc9fdc1e863..c7764ff4079c 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c @@ -437,6 +437,7 @@ static void print_prog_header_json(struct bpf_prog_info *info, int fd) if (info->run_time_ns) { jsonw_uint_field(json_wtr, "run_time_ns", info->run_time_ns); jsonw_uint_field(json_wtr, "run_cnt", info->run_cnt); + jsonw_uint_field(json_wtr, "run_max_cost_ns", info->run_max_cost_ns); } if (info->recursion_misses) jsonw_uint_field(json_wtr, "recursion_misses", info->recursion_misses); diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 464ca3f01fe7..da4d1f2d7bc2 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -6259,6 +6259,7 @@ struct bpf_prog_info { __u32 verified_insns; __u32 attach_btf_obj_id; __u32 attach_btf_id; + __u64 run_max_cost_ns; } __attribute__((aligned(8))); struct bpf_map_info {