From patchwork Mon Mar 13 11:40:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 13172306 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50093C6FD1C for ; Mon, 13 Mar 2023 11:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ClTmUzslRhRb6wuuwabJV+32/MfIcT2lrbfmxUvZo4M=; b=ZSTz8DptVXG+AZ wLR0WXL17V6IcNSObhhTi9hHy8t3Mgp7rT2JoEpo5lZxMtJS/mnByN8h3LiJMmBKHX9M/KJbJf/Jw rOHbYttNxMtL3leiYmRsJiGcnPIIkfQskYcoVoL7DYgpdM4nitGMmXZPKg5K9/gESjWqZ/wVcf5jH 3FwYeIVxYw8t15Y9wFIQiS6cXVsgB6EyyYJOlmXqn97w0tJ6dJo2SyvG1RZkSpUEqHHvOXLuh7rKM 5keLg2Kk1kwc0o5retjFlul6IRisz+lk3dqgslyQ9VIg3zNl0IgoeJj7WtDvCA0vgKZHnU2ipZYOd LCX5Y73BhhbuTQGDwHow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbgZ9-005SXs-Bu; Mon, 13 Mar 2023 11:42:11 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbgY9-005S6j-78 for linux-arm-kernel@lists.infradead.org; Mon, 13 Mar 2023 11:41:10 +0000 Received: by mail-pj1-x102d.google.com with SMTP id d13so1652631pjh.0 for ; Mon, 13 Mar 2023 04:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678707667; 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=qSdUbtxY1+Pylww6c27L2gmYy3OoEmd30YUAl5uUuD4=; b=JdCN4DnjsIz8YM3uGExs6pbkHrIiWnJ/jCXj3wqhLn3yYf0rTHXThsN/8y65TcJYDH ORkO3CS9JgQi6TrHXBccQXUpAOoxrP3021V2614gp/rDRlP3XvIYGQMKNzOicBpd25ZY 1M/Ya7gznDe5xSpPhVONXi38ESzr9rkKoMeRnkyDrc62UjSY4LQ0l9U3SxEo3L4pOI5g wkbaVz0+wa8QCUqXc0INVPCGd9WXY/NqWEqahFhnCk4Uzp2aAasqU2mt8UZBzE4roxT6 j+THZ/H8Vb39Kj59OrEIRBUKLdFZ68n6gMWKI4H9zJaM5ShqvCeI4HPKnC0C/5Cp3PBL 7BZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678707667; 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=qSdUbtxY1+Pylww6c27L2gmYy3OoEmd30YUAl5uUuD4=; b=Ru7Cdqqwl8o2DzOMQL8IChVIn2b1jPOFwhZHRBv3BvTO0Sk/irge+wx/ix3lb3zbfK /d4Bx2IOIwnNdJlchjR9vhQhAWfGRNNr8XBTUo1Jv0HNn569C7GV6o+GByDxw0bwLAzy car327dFxjdlF23lyT7Li8A84/oiaQrCWN6f0Oo1DRM4IeQYIImjJYBDDMAKTHTOWm0X l45H0ypfGUcBRPY31egjSr6Pw2E95ef5gX0FpprwYugS0eixwOHlEuHW6ArBZSIkNPaS 7wOBHEsKKMhR/SjcWCGkXRmW1vY3wCWOjg0QQWDLpj/qHo9PYVQw1DkcJ2bJmvilwL4w JsmA== X-Gm-Message-State: AO0yUKWacyAsPOBWo/S9UpBMJ7NnO1w6BRyqDr1+SZ2e5s7HgVhx++AQ DUVFF+dvltEwYVt6uUOBUIF9hg== X-Google-Smtp-Source: AK7set+I4pJRklsniO4bIb9F5JsmmXbJnyucsWHWv8Gcq4NOTrgG603vO5mGR2pP4FkasqnfbzhYpQ== X-Received: by 2002:a17:90b:4d04:b0:230:81e9:ebb4 with SMTP id mw4-20020a17090b4d0400b0023081e9ebb4mr33650785pjb.10.1678707667093; Mon, 13 Mar 2023 04:41:07 -0700 (PDT) Received: from leoy-huanghe.lan ([156.59.236.112]) by smtp.gmail.com with ESMTPSA id q21-20020a17090a2e1500b0022335f1dae2sm4281625pjd.22.2023.03.13.04.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 04:41:06 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , James Clark , Adrian Hunter , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v4 06/16] perf kvm: Introduce histograms data structures Date: Mon, 13 Mar 2023 19:40:08 +0800 Message-Id: <20230313114018.543254-7-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230313114018.543254-1-leo.yan@linaro.org> References: <20230313114018.543254-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230313_044109_276001_6392657F X-CRM114-Status: GOOD ( 13.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is a preparation to support histograms in perf kvm tool. As first step, this patch defines histograms data structures and initialize them. Signed-off-by: Leo Yan Reviewed-by: James Clark --- tools/perf/builtin-kvm.c | 18 ++++++++++++++++++ tools/perf/util/kvm-stat.h | 1 + 2 files changed, 19 insertions(+) diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index d400434aa137..384992c8a01a 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -85,6 +85,20 @@ static struct kvm_event_key keys[] = { { NULL, NULL } }; +struct kvm_hists { + struct hists hists; + struct perf_hpp_list list; +}; + +static struct kvm_hists kvm_hists; + +static int kvm_hists__init(void) +{ + __hists__init(&kvm_hists.hists, &kvm_hists.list); + perf_hpp_list__init(&kvm_hists.list); + return 0; +} + static const char *get_filename_for_perf_kvm(void) { const char *filename; @@ -957,6 +971,8 @@ static int kvm_events_live_report(struct perf_kvm_stat *kvm) set_term_quiet_input(&save); init_kvm_event_record(kvm); + kvm_hists__init(); + signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); @@ -1152,6 +1168,8 @@ static int kvm_events_report_vcpu(struct perf_kvm_stat *kvm) init_kvm_event_record(kvm); setup_pager(); + kvm_hists__init(); + ret = read_events(kvm); if (ret) goto exit; diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h index e84f1cdcfe05..a53cebe519b3 100644 --- a/tools/perf/util/kvm-stat.h +++ b/tools/perf/util/kvm-stat.h @@ -5,6 +5,7 @@ #ifdef HAVE_KVM_STAT_SUPPORT #include "tool.h" +#include "sort.h" #include "stat.h" #include "record.h"