Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp578386lql; Mon, 11 Mar 2024 10:52:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUr4G67rG5h+KG4n6RSFPay5D3NQ9V4r2GDcYIB1WddNht+qiXNQehCaVzUibRYdaPfoyBoq00wgTk+b9XlEboGI6HaXLyf9bYtiForJA== X-Google-Smtp-Source: AGHT+IGl85bT/NzR3Q3dJ0HScwO/dJcBwLBruu52mqh8RGJbYVDaZHN09wotqVWUGg1vvkeSpsMp X-Received: by 2002:a05:620a:4624:b0:788:497b:38cf with SMTP id br36-20020a05620a462400b00788497b38cfmr11779780qkb.36.1710179540286; Mon, 11 Mar 2024 10:52:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710179540; cv=pass; d=google.com; s=arc-20160816; b=KI+hDXM7IAH2ZlVUcuCEV4H0bHNz8Ia3zKeDet0vPAgeyC6Gs6wOrLeWn8ekh98C0v ZBUroSw2uvSVARSwMrlsBxzu7j0IgFwr1pLGjmACG3O4tqrq9kuLPWovCvOnt5NhjYxu sZRCsHhvlZB029z+3SWj5KtnXXmQC8nLpS9iiq60sbjr4AKQS8phc/5cT27HFrsGuNN1 4ZoXPT3gmPPe70eSPfu0m5I46n/C776tyNfcd+ooo/BsGg77j2300jrrnDYhc780+pNN f993peS9+AdjPjPhSb7OoeQRwRzCMR4AJdgaWAF3ExGyzlGX4LCwyJg6armd1jextOL/ 6nGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=+OFsk9n51lzvyR55ZOMflkPq20XLa07QfhppRNo2l14=; fh=We8yln/oQJO1GDp8S11amFd67YwLltXbpA7RsuMKke0=; b=HJz4xiM5ucBOaX4TCokw0cqHZm2jqPDpyvD6GDP92OVbJ3yYWHg4SSy0/ichHDdLNG +hNOQ89De4PJiFjAR5Kf10nR0lsnoCRTEBLh0HVY+m9N6H4FNclTJqQIB6ybneJvMAcM 5GZURJ/aE44dL3nCNsNo46QDio+jbAkgXj5+z8dBaF6ZKfi9yRQlTW7WokzP2euyTJEk LCEr38qWKEXWJYzMxA/H/dSzrLmq2LYaPrVEsJnmOjqiJBKO8Dh0pm8D3Rju9/UXTPCm ZS4E6fDPZC2ni7+vXfeJuf3CId7gE6c4rM+9kGK7lzThEKSMrkPc82wBx5xMGFRWPKgv 98mg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F0tVV5DE; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-99329-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99329-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e28-20020a05620a12dc00b007884012c16fsi5801274qkl.448.2024.03.11.10.52.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 10:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99329-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F0tVV5DE; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-99329-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99329-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0A9D71C20F36 for ; Mon, 11 Mar 2024 17:52:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6E0552F61; Mon, 11 Mar 2024 17:52:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="F0tVV5DE" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B203753E00; Mon, 11 Mar 2024 17:52:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710179531; cv=none; b=fC9sXT23iOHUJ0J3mRPFlTVp59rO1meDOIE5Ewj4g9g9LcyJvlCFW3hQev/hQiru8dZhBe2Q2+p9C1Pc+z4DpzflFBCNA3p8dezuoN43GSnvZapzRd58wb94T+9KVUOuo1bRogxl5PeQZoeubTeZojWcZcfRahSbj1gi3KzgzZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710179531; c=relaxed/simple; bh=0xbA3b4MdRDSG9lBEC4D6pcd9ZmnWOomaUTYuVXJLnA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XrJx15oQ2IYtyH0LJGKrDVKiYE5i0Vttju2cGVUjrUBhmat4tKa9528xcgAed+Qmsq9zIZ6ZG3vUPa6M4rNzlESVI8aYH3bJA8jONPtt7KngBZD9AR1JgFaI+fVzhW1NNvmiNRIq9GOWCtbOSHQcqVy4rukis+N95Fjksebk1i0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=F0tVV5DE; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710179528; x=1741715528; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=0xbA3b4MdRDSG9lBEC4D6pcd9ZmnWOomaUTYuVXJLnA=; b=F0tVV5DEKxMlhFjD6YP2yrIP4OVO8GtbDu7zoH587stxN9GuYnNbEqyz e0lpWkQkn9G3Mi53UdDuKj3/EQc2vWYJwUJFVeaXdYEAVag8blWsZdGFm NFuZ13OhQ8c0u7PygUCmdo9nNA5sTOE8cQHyamdO7VHuEmbnh0RYZhOLZ F3PxSwHHuLv32OPDyQh2tl92XT5FtzUdj7n06K4m1NE9uH9HMxeOEZMke KimK0MTysWkPVWvgyG/B6VRmfyvMX/Itnigl5QAdkE8EK80LTwU9LvJzm mPXnLE9FIv0NxSpIr0s9s5ebtWSrSAkWOzRQ8IfdHe21/AcvDhwwoApfY w==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="4973442" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="4973442" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 10:52:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="15902421" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.52.80]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 10:52:06 -0700 Message-ID: <3a92ebdb-8923-46af-a020-0e12233262a9@intel.com> Date: Mon, 11 Mar 2024 19:52:01 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] perf scripts python: Add a script to run instances of perf script in parallel To: Andi Kleen Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org References: <20240310193502.2334-1-adrian.hunter@intel.com> Content-Language: en-US From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/03/24 18:13, Andi Kleen wrote: > On Sun, Mar 10, 2024 at 09:35:02PM +0200, Adrian Hunter wrote: >> Add a Python script to run a perf script command multiple times in >> parallel, using perf script options --cpu and --time so that each job >> processes a different chunk of the data. >> >> Refer to the script's own help text at the end of the patch for more >> details. >> >> The script is useful for Intel PT traces, that can be efficiently >> decoded by perf script when split by CPU and/or time ranges. Running >> jobs in parallel can decrease the overall decoding time. > > This only optimizes for the run time of the decoder. Often when you do > analysis you have a non trivial part of it in some analysis script too, > but you currently have no directi / easy way to paralelize that. It would > be better to support parallel pipelines. It will parallelize any scripts and / or dlfilters that perf script itself executes. > > TBH I'm not sure the script is worth it. If you need to do parallel > pipelines (which imho is the common case) it's probably better to just > write a custom shell script, which is not that difficult. It can be a pain to figure out how best to split the data if it is not evenly distributed. The script also has value as a reference or starting point for users. > It might be > better to have a helper that makes writing such scripts easier, > e.g. figuring out reasonable options for manual parallelization > based on the input file. I think parts of your script do that, maybe > it is usable for that. The --dry-run option shows the perf script commands, but an option to pipe through another command could be added. > > Also as a default output it would be better to just merge the > original output in order and output it on stdout. That assumes that the output comes from perf script printf output and not a perf script _script_. If the data is split by CPU, it will not be in time order if it is simply concatenated back together. > > You should probably limit the number of jobs to some minimum > length, otherwise on systems with many CPUs there might be > inefficiently short jobs. That happens for Intel PT (64 PSB minimum), but could be added for the normal case also.