From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94C0AC433E2 for ; Sun, 13 Sep 2020 21:05:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 598FF206A1 for ; Sun, 13 Sep 2020 21:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600031145; bh=LUzp/WPxq6tOlzM+2z4zDRjv2QcekTL1Z158OUwwcYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FMh6vVAvX7JuLmqeXvrIiG8Qh1mrLkZ0fXe//8gzD2yiO6stDKzhrlox87pmLZPy4 717SB/+wGO74FnPbOC3LDMLJRVXE7HN30oa2URGQAbOr1/KnHJxeiyZ+cWQVgd/4PF XJPf+jRPbL4CR6Zs2/NUsoKa21p94BwiMPPOfAuc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726099AbgIMVFo convert rfc822-to-8bit (ORCPT ); Sun, 13 Sep 2020 17:05:44 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:37675 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726058AbgIMVFF (ORCPT ); Sun, 13 Sep 2020 17:05:05 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-111-U6y8yudRMgKyQqaI_rSoJw-1; Sun, 13 Sep 2020 17:04:58 -0400 X-MC-Unique: U6y8yudRMgKyQqaI_rSoJw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 00215802B70; Sun, 13 Sep 2020 21:04:56 +0000 (UTC) Received: from krava.redhat.com (ovpn-112-4.ams2.redhat.com [10.36.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88C181002388; Sun, 13 Sep 2020 21:04:52 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Song Liu , "Frank Ch. Eigler" , Ian Rogers , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: [PATCH 21/26] perf tools: Add machine__for_each_dso function Date: Sun, 13 Sep 2020 23:03:08 +0200 Message-Id: <20200913210313.1985612-22-jolsa@kernel.org> In-Reply-To: <20200913210313.1985612-1-jolsa@kernel.org> References: <20200913210313.1985612-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding machine__for_each_dso to iterate over all dso objects defined for the within the machine. It will be used in following changes. Signed-off-by: Jiri Olsa --- tools/perf/util/machine.c | 12 ++++++++++++ tools/perf/util/machine.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 863d949ef967..f8e8d0d80847 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -3181,3 +3181,15 @@ char *machine__resolve_kernel_addr(void *vmachine, unsigned long long *addrp, ch *addrp = map->unmap_ip(map, sym->start); return sym->name; } + +int machine__for_each_dso(struct machine *machine, machine__dso_t fn, void *priv) +{ + struct dso *pos; + int err = 0; + + list_for_each_entry(pos, &machine->dsos.head, node) { + if (fn(pos, machine, priv)) + err = -1; + } + return err; +} diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index a3c1d0bf89e5..504c707f22bb 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h @@ -252,6 +252,10 @@ void machines__destroy_kernel_maps(struct machines *machines); size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp); +typedef int (*machine__dso_t)(struct dso *dso, struct machine *machine, void *priv); + +int machine__for_each_dso(struct machine *machine, machine__dso_t fn, + void *priv); int machine__for_each_thread(struct machine *machine, int (*fn)(struct thread *thread, void *p), void *priv); -- 2.26.2