From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5DC5215F45 for ; Thu, 9 Jan 2025 07:51:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736409104; cv=none; b=dQUMg9hwaMw/qfxeYauKCS3rYfMJwCg1e1N8m4uzPXLTKIcoI1C9hAYe2irKn55uZP4JfzZHAe2P9qIVNWSCL8ZihQ/CNr0LP68I60ZPXHxvRZXVBWZHmQzSJfBgq7ZxoresxKvPNDudHP7rfu5uQzO0hQrdOD3fIFJf1UZznyk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736409104; c=relaxed/simple; bh=LcuM1TfmrACoRI2O+KPtHudrA17c/H/ANDgc2PirYpI=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=se2j1Z/37V3QF3amevquKOehu1YkpIKrmPRW6D1fc079PqJ9Wq1z2bZxGSJdad1GHRuAOzotbnpzcRrkXU3GkhPS7Z2IJGy8bg2mLl6JC9eK3aeID1LwA4SQjxfXGWBz7Eca0O8Ya2CfMCLb++E7UFSTj3tmOMEIkLixJKUb3Bc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=MxYSYn8t; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="MxYSYn8t" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e54e14f7cbcso1559381276.1 for ; Wed, 08 Jan 2025 23:51:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736409102; x=1737013902; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=xj93vfuj55xARzsWpay/iUAHdI9qiQp37TLmSVo9jEs=; b=MxYSYn8tmyi+jww6/FQY1HAW1kH0JSThpvmlxc4yNSVhQaNlPZPw059cobsn59G0Tf fjelbxCeLQsIu3+aE4BWVMEtpLHzDYF+ddqdyZdvH2xe/sOjBv6zzV/RqR0iZSjxapXl SpXKntIcQNrVAc44u9iOt4LAfYIgBOE0fDkhoYKwtqDjJMKbChqnDa7Fnqvt8Ty6TOaQ j1T21MQPal2G2zaz8M73GqeqX29Fg6xHjclrmYZ9H79jnjAkiDa9TVFLM4drlfxp8v0K nReAVvbpCaTrqqW4SmCq0hZbXVs7gO1AZIuXwTNyYYuZfWtNatUxGXnQjtjkOJw6qqtC RGtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736409102; x=1737013902; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xj93vfuj55xARzsWpay/iUAHdI9qiQp37TLmSVo9jEs=; b=tKW7Ixt5HIx0WReJnkuSVw/QVtIHJ/yxkKndeFlbXfwsVESK6Cy6ZKK4ta6npKoQy/ QAvhDjiyuqsDEknTYtl7amSWCYVAOMZfNZzr6yskj2Wb2OhnpYSdddUcsf1+4E/cKB5X Krvg1sPfVpLbyukvhL5cDftSqcPcPlWyuS6u48BnnXuE4plq+iyQCcWf92uLKa9H2MTA hPkXzkHlBmxTmlTdPGECKwgZ1tQczfvnMw3jD9F+ug6tls1xBd2Qhey8Pq1ekRIahWnv rNoh9Zzbi/qQAB4mA/ZnbTvsSLJIyo2+zCbNgy8LHN2rWFlQ4fC+N0FX6yyISzWvrN9w eyiA== X-Forwarded-Encrypted: i=1; AJvYcCXkJSP17aiMSnUH3wyWZmbAdtM/GTfxMT9pRK759Pi0adavxV8Jj5zpEbVKHyMh0uS//XjFO+oMvXdHgZ8=@vger.kernel.org X-Gm-Message-State: AOJu0YwXDB+Z7f6s8bNTIcPSutxbcd/HTkQbXIABGNJXFCF3vmpOck7F 4G2yaQrhVFHE9LxBoZigXcaHrSYnQxBic+cNSadHiPgC5QiTmQrIlFRjLrho2jUHHV689yV0/kT UraJSLA== X-Google-Smtp-Source: AGHT+IFjYOBojDm05vXb6n8MqNDkJC7xm5062sZE/csmmFZ6aKOedVisiYs7brlL51+UYZb/a9LeQuTf5wiS X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:f801:f788:c7e5:c181]) (user=irogers job=sendgmr) by 2002:a25:aac6:0:b0:e38:225a:c3be with SMTP id 3f1490d57ef6-e55018e90b1mr7040276.5.1736409101643; Wed, 08 Jan 2025 23:51:41 -0800 (PST) Date: Wed, 8 Jan 2025 23:51:08 -0800 In-Reply-To: <20250109075108.7651-1-irogers@google.com> Message-Id: <20250109075108.7651-12-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250109075108.7651-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v1 11/11] perf python tracepoint: Switch to using parse_events From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Yicong Yang , James Clark , Howard Chu , "Dr. David Alan Gilbert" , Levi Yun , Ze Gao , Weilin Wang , Xu Yang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Rather than manually configuring an evsel, switch to using parse_events for greater commonality with the rest of the perf code. Signed-off-by: Ian Rogers --- tools/perf/python/tracepoint.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/perf/python/tracepoint.py b/tools/perf/python/tracepoint.py index bba68a6d4515..38b2b6d11f64 100755 --- a/tools/perf/python/tracepoint.py +++ b/tools/perf/python/tracepoint.py @@ -5,24 +5,23 @@ import perf -class tracepoint(perf.evsel): - def __init__(self, sys, name): - config = perf.tracepoint(sys, name) - perf.evsel.__init__(self, - type = perf.TYPE_TRACEPOINT, - config = config, - freq = 0, sample_period = 1, wakeup_events = 1, - sample_type = perf.SAMPLE_PERIOD | perf.SAMPLE_TID | perf.SAMPLE_CPU | perf.SAMPLE_RAW | perf.SAMPLE_TIME) - def main(): - tp = tracepoint("sched", "sched_switch") cpus = perf.cpu_map() threads = perf.thread_map(-1) + evlist = perf.parse_events("sched:sched_switch", cpus, threads) + # Disable tracking of mmaps and similar that are unnecessary. + for ev in evlist: + ev.tracking = False + # Configure evsels with default record options. + evlist.config() + # Simplify the sample_type and read_format of evsels + for ev in evlist: + ev.sample_type = ev.sample_type & ~perf.SAMPLE_IP + ev.read_format = 0 - evlist = perf.evlist(cpus, threads) - evlist.add(tp) evlist.open() evlist.mmap() + evlist.enable(); while True: evlist.poll(timeout = -1) -- 2.47.1.613.gc27f4b7a9f-goog