From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (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 01660329E5D for ; Thu, 6 Aug 2026 04:14:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785989671; cv=none; b=lME/QDE8PA69rIb+XkVTGACTGw4b3OkGpVn7OkGn6ruk3lTZ1xxQwVRn63G4GpKlU8n4vHuQhsFocJGlslJbv5+9UdbnkGnBuRSiT9sIy/IhSC3GQEhz/W5BmGKzBLJF926liz2M2iWFkXVYho+XjHieMoDOOGwd8+5cF7LYPHY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785989671; c=relaxed/simple; bh=iZPeBgLnOWluHySgECX5Z9pOvjpbIHDIZlcKBk1CwUA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=bCcUN5+Br9N1a8o5jX8lp3CdasQN6/OXy7QwM9zkEMhKo8rMZydd9jHwOlrW6VkYpy07EjW9F8xm2VvGhZBbEP97gqWStMGJUSEhbkq6Bco9/jqL6EmdnQon1yFolPfUnPm0aEdO8b33gvqxO78lUjOAIZMhBajNRRsAAI33utk= 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=RU6hUEx4; arc=none smtp.client-ip=209.85.216.70 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="RU6hUEx4" Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-38e8fee6af3so1925095a91.1 for ; Wed, 05 Aug 2026 21:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785989668; x=1786594468; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=qGNBxIMbjF6ue7QVP0Xn9VPejnBt+3k4MwG5g+tGNLI=; b=RU6hUEx4YoB7gONWRglLpJGzD/1hPEoaZxMvkVS2gmfFKxW1/fylrboNGmuDY1bBhu k2Im+oqGTjXg5hgZVVYWqeD7/Zmiyr0Km7q5IgsYd/HG0JpD9aDzg72F2sBkjVbSayAc miUb5IqZYVWWi69vAcb4WGDIIcW8uyMzwYKA7itLoG07IEfmY3C8HybYMBORlCdhledd SPECwag5x3a2f2pzrIiY2qW3ji1kXKYjwvYeoSyWQvc+Crip1CQJc8Zz49Tg53P7O9WZ C3YgPq6PXzuA4z6Rnj3BmvV4z8/p3Pw0lpUsiyAPpMMB95C34CCDm23d7+NwXw7N0PbL 4PuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785989668; x=1786594468; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qGNBxIMbjF6ue7QVP0Xn9VPejnBt+3k4MwG5g+tGNLI=; b=LxlkUiSZZ5Qvb5IKaX+89kTvd6L5lbW5/pEuh9NBYtZB0AO/oacKP2y5ApclYcvio4 oZccGIs6g2fkWKN8sPo63Qmy60+LLpzRI5kAGxGf2Y+9gvdR0dQKe1hQXaPVvhAcmweX OocP1eE0+2n57Nnr8pO4wzGAwLt0eFZ6tobdSNcn0Zr/qaVwjUaE9P/kooRkxSsNT1CZ 6/vGnfVW58qqaeRtRIFHMe3ozkAzL1dWhMpIDcBOh4F4pKxTW0iz/vc88AsvG39UYsJ8 PsH5fUUiRT8fibFjIrd7ue787ysNsYJ+hQpDfREettp042EOwI/kLUc/a6aYhUuYa0th GuTQ== X-Forwarded-Encrypted: i=1; AHgh+RqObkNjQcx9Qacb9dL6b4xNPpm99nmkvMMQ5FRldkGGYknFqihXjQnpf0+icOAoZq5FdeiM3ffFuozmWBA=@vger.kernel.org X-Gm-Message-State: AOJu0YwTso3OvJialkkx/Cw9tKcalqkH2WRmHPuGD8cdFjtydgCt0RnU RUbce94VPJlHP+sYpcGwlFtB8uJxNN8FI3jrY84GqeJDxrLMi5P1UHPUW0w+39amYV9nYL0DeyN Kikqs5BuLdg== X-Received: from dlbeg24.prod.google.com ([2002:a05:7022:f98:b0:13b:76f7:a531]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:520a:b0:366:10f1:3d91 with SMTP id 98e67ed59e1d1-3903c54adbamr11877174a91.1.1785989668073; Wed, 05 Aug 2026 21:14:28 -0700 (PDT) Date: Wed, 5 Aug 2026 21:14:14 -0700 In-Reply-To: <20260806021038.2291417-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260806021038.2291417-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.629.g250fe7f194-goog Message-ID: <20260806041414.20327-1-irogers@google.com> Subject: [PATCH v2] perf evlist: Warn when 'sleep' workload is used without system-wide (-a) option From: Ian Rogers To: irogers@google.com, acme@kernel.org, namhyung@kernel.org Cc: adrian.hunter@intel.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, tshah@linux.ibm.com Content-Type: text/plain; charset="UTF-8" A common mistake when trying to record system-wide profiles for a given duration is running commands like 'perf record sleep 1' or 'perf stat sleep 1' without passing '-a' / '--all-cpus'. When '-a' is omitted, perf defaults to per-process monitoring of the sleep process itself, which does not collect system-wide activity and records very few events. Add a warning in evlist__prepare_workload() when the workload executable is 'sleep' and system-wide mode is not enabled. Assisted-by: Antigravity:gemini-3.6-flash Signed-off-by: Ian Rogers --- tools/perf/util/evlist.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index eb7c0d7be064..b3dd097fbb2c 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -1562,6 +1563,20 @@ int evlist__prepare_workload(struct evlist *evlist, struct target *target, const int child_ready_pipe[2], go_pipe[2]; char bf; + if (argv && argv[0] && target && target__none(target)) { + const char *cmd = strrchr(argv[0], '/'); + + if (cmd) + cmd++; + else + cmd = argv[0]; + + if (!strcmp(cmd, "sleep")) { + ui__warning("workload '%s' specified without the system-wide (-a) option\n", + cmd); + } + } + evlist__set_workload_cork_fd(evlist, -1); if (pipe(child_ready_pipe) < 0) { -- 2.55.0.629.g250fe7f194-goog