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 0494C6A8D2 for ; Thu, 18 Jul 2024 01:01:08 +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=1721264470; cv=none; b=S9qPNrjZoETs0Pla67X8iXYK0+zMvCzIoBQIVezkF0zBmHl1owATLA4r007BdNJSw/NCn6bXy9FM4jnuQZ8udquGAcMIwVHatRslJ2aIIESSv1XitbZWzM0wakCAggUPvVYd7nvhcuiGxvX2vYUeI+eFrvKVZY8XwB8KMHJiLvQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721264470; c=relaxed/simple; bh=/F7/4EIyw7D7CiUXDYCkLJycjGYVjLrkbxfIXcD/YaA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=NpJjhfThevtn+P1TONj8TjzXGUgCR6sIMSuxwX2CMpx8siUsZY07h3zPBUFuUvsStPrH67vqY6dDYShOBzwqVYjwKXbXJ7d5ZHyBGT/KWcgV594+VS3lAhCUyxJ8HTUWgIbFpQKTOL3ERz9uyYhmay8bitCOUKZ5aEKMO4vA2l4= 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=u/mu8pGn; 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="u/mu8pGn" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e03b3f48c65so850641276.0 for ; Wed, 17 Jul 2024 18:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721264467; x=1721869267; 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=pNFK3i3CL2hY169owdLoin8oWSW6A2yJIcLVmlGvbqE=; b=u/mu8pGnfVZd53SE9RvWYsGXBO7ib8pyHQD4tz4OFISD9nDYuvTh86SKqXxfKUMcxa tJz3vJLymxSgfGb1JzXwNVifckee4K/qSXld1EvndVTv+T6TvZ62jTdwe5PVAeRXEsUr NttKVpcKx4wE5+D/YU6syfplmKWhnJws00LrkxIqQJO12nzL86dnDmh7rXMTng70HEy4 SToj5iOKl/KxxztabbObJPc/AE6ha9hLVzIhg8uMxcOzL7qXbZIlkXTiKkuh+j73koXu 9X/qvior4wPtCJw9JZpbfGmGmjyq9Dng6t3jDWTPLkU1s/mD38b8AP2KEJPPaQe/yzHH ZLIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721264467; x=1721869267; 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=pNFK3i3CL2hY169owdLoin8oWSW6A2yJIcLVmlGvbqE=; b=Kzf4zPQSBKsBC0PA2br9w85lwt2AKdjJ6eRq8+Z6hDXd3cSd4aRRy29vyb8/ihluuI 8JQbuRNlcFFc784YJx/4pjDVhGCWxEX8Brgt4+wG+PZQ8Vns9oCtjP/f6k35ny+BMIi7 2hZvtNPKIYnzZbG64iZtdQtQyQo5Rj/ozmaaKxDwOR54lOtpweZ3U+d43v/IE1qExYDL s+3/W13Awr3sPapTHe01Olff3SRMU6f61SR/FvU+9EJCfUjomVfKQf8Q0KrwZZXvwYre jTY0HtX0HJha58efIyV6ZQh4aVlSVv7zadwIpAqDBgSLd8pkpD6lbnfOygEmiOIlftBO A4Yg== X-Forwarded-Encrypted: i=1; AJvYcCXOOmgzXJtZs4j3ielgpwqA+kvvl5Yos5w/z5uuiSNJDJ9EqoIpY/DQFZl4MpdI6WLRSWVW1YnZ1qYWUEm9U75qr8fS7MV4YYXdylmt X-Gm-Message-State: AOJu0YymA4W8grDPFzPyQbWzzFdyNvWpoXNKvAfxpDePCpBnQ9QE+aJQ /YLBVv/nnKv37gQuyzOB2bMBHE9fS+9DcSv/NIo8u3yRXHuDrohhHOTQW7d5RXhpFXOvNWKXFXd INPP56A== X-Google-Smtp-Source: AGHT+IFHPEUR6SHxDxIGONs3PPAyxDcCJ98okKUpCTVwExnLyEiQ71Kvctfkm9eZdP+bwodMy6NLwOHXvMHK X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:940b:9044:fa83:4060]) (user=irogers job=sendgmr) by 2002:a05:6902:1003:b0:e05:a345:259a with SMTP id 3f1490d57ef6-e05febdcb0bmr22837276.9.1721264467108; Wed, 17 Jul 2024 18:01:07 -0700 (PDT) Date: Wed, 17 Jul 2024 18:00:09 -0700 In-Reply-To: <20240718010023.1495687-1-irogers@google.com> Message-Id: <20240718010023.1495687-14-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240718010023.1495687-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.1089.g2a221341d9-goog Subject: [PATCH v6 13/27] perf script: Use perf_tool__init 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 , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Nick Terrell , Nick Desaulniers , Oliver Upton , Anshuman Khandual , Song Liu , Ilkka Koskinen , Athira Rajeev , Huacai Chen , Yanteng Si , Sun Haiyong , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Use perf_tool__init so that more uses of struct perf_tool can be const and not relying on perf_tool__fill_defaults. Signed-off-by: Ian Rogers Reviewed-by: Adrian Hunter --- tools/perf/builtin-script.c | 65 +++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 394bce9f5338..b4fc2971335b 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -3899,38 +3899,7 @@ int cmd_script(int argc, const char **argv) const char *dlfilter_file = NULL; const char **__argv; int i, j, err = 0; - struct perf_script script = { - .tool = { - .sample = process_sample_event, - .mmap = perf_event__process_mmap, - .mmap2 = perf_event__process_mmap2, - .comm = perf_event__process_comm, - .namespaces = perf_event__process_namespaces, - .cgroup = perf_event__process_cgroup, - .exit = perf_event__process_exit, - .fork = perf_event__process_fork, - .attr = process_attr, - .event_update = perf_event__process_event_update, -#ifdef HAVE_LIBTRACEEVENT - .tracing_data = perf_event__process_tracing_data, -#endif - .feature = process_feature_event, - .build_id = perf_event__process_build_id, - .id_index = perf_event__process_id_index, - .auxtrace_info = perf_script__process_auxtrace_info, - .auxtrace = perf_event__process_auxtrace, - .auxtrace_error = perf_event__process_auxtrace_error, - .stat = perf_event__process_stat_event, - .stat_round = process_stat_round_event, - .stat_config = process_stat_config_event, - .thread_map = process_thread_map_event, - .cpu_map = process_cpu_map_event, - .throttle = process_throttle_event, - .unthrottle = process_throttle_event, - .ordered_events = true, - .ordering_requires_timestamps = true, - }, - }; + struct perf_script script = {}; struct perf_data data = { .mode = PERF_DATA_MODE_READ, }; @@ -4102,10 +4071,8 @@ int cmd_script(int argc, const char **argv) data.path = input_name; data.force = symbol_conf.force; - if (unsorted_dump) { + if (unsorted_dump) dump_trace = true; - script.tool.ordered_events = false; - } if (symbol__validate_sym_arguments()) return -1; @@ -4296,6 +4263,34 @@ int cmd_script(int argc, const char **argv) use_browser = 0; } + perf_tool__init(&script.tool, !unsorted_dump); + script.tool.sample = process_sample_event; + script.tool.mmap = perf_event__process_mmap; + script.tool.mmap2 = perf_event__process_mmap2; + script.tool.comm = perf_event__process_comm; + script.tool.namespaces = perf_event__process_namespaces; + script.tool.cgroup = perf_event__process_cgroup; + script.tool.exit = perf_event__process_exit; + script.tool.fork = perf_event__process_fork; + script.tool.attr = process_attr; + script.tool.event_update = perf_event__process_event_update; +#ifdef HAVE_LIBTRACEEVENT + script.tool.tracing_data = perf_event__process_tracing_data; +#endif + script.tool.feature = process_feature_event; + script.tool.build_id = perf_event__process_build_id; + script.tool.id_index = perf_event__process_id_index; + script.tool.auxtrace_info = perf_script__process_auxtrace_info; + script.tool.auxtrace = perf_event__process_auxtrace; + script.tool.auxtrace_error = perf_event__process_auxtrace_error; + script.tool.stat = perf_event__process_stat_event; + script.tool.stat_round = process_stat_round_event; + script.tool.stat_config = process_stat_config_event; + script.tool.thread_map = process_thread_map_event; + script.tool.cpu_map = process_cpu_map_event; + script.tool.throttle = process_throttle_event; + script.tool.unthrottle = process_throttle_event; + script.tool.ordering_requires_timestamps = true; session = perf_session__new(&data, &script.tool); if (IS_ERR(session)) return PTR_ERR(session); -- 2.45.2.1089.g2a221341d9-goog