Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4114521pxv; Mon, 19 Jul 2021 17:24:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHjXW37DNeLKhbQ748sSNMurFDv85imewiO1ngxlkGflhxsZbsHqQF9pzhQuLDIoNJV9w/ X-Received: by 2002:a17:906:4e09:: with SMTP id z9mr23931083eju.226.1626740682356; Mon, 19 Jul 2021 17:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626740682; cv=none; d=google.com; s=arc-20160816; b=fpRt6hQ2JEKFUN3IVdOQfV0tpA5yRcLbquAKS2bjgGzslO/564zwjATDoHGNpei84T cSNG/wm91vx5cvHOQelMNlF8fxCkfDea/9epDU1u2fooIXYKlB1IcCmJXzDSUiSENoba 6xH/2rnriJr/c9+84KmxK5/7I3MpvtF8xGlld6a3QGZs+vAob9jQtM7PyT6F/Cq/kVGc LWsZSXHExTCEep+BLGUuNsi+tGBK/1ID54NM4yWDwysW7OqYIZeEseVIz6IeUS4PMyMD XAQ/P+rlJpKtKKCYmWR1mQg75AV8RU4RIq/vzV1fZ5KV570E9C0pNqvZ+NanvkgAKd8p SLLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=OKFGPZSjOp/qW6q1mXcXpbNAjO5OGS/hWfxwbZXcdo0=; b=mju8QwM/FGQb31a8qHxWdaVHlh8MrnWryU23jTuQExCrNUHwKhPFahKt13ThgMtJ08 G3AdqwMOI4TXxZViWCZV1kqS4HWm+6mHMK6DONgGfxUhGg12XGKtkQnfT6DgjD8DXOYj t2uT8hy3hxBgYQfAGA0Hfjsxffa9HE4ymzqEcwJpFSAzKodR7He4c6Y+SBqmdd7XrcGA T8axZ0ig1YqUTBc/GmDCbsmHSusq3G4KQDF+pKouX93cBgD3wkGEpBBJnl2/gsLlX9Qt tNn5jL8NcGkncEyPC+wpCyeqBVEI9LDZu2CJAjxJff7088zW2rAevOYpQbQoGX+t36OT OY7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sVsOJPzG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si21658739edv.70.2021.07.19.17.24.17; Mon, 19 Jul 2021 17:24:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sVsOJPzG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377813AbhGSXgQ (ORCPT + 99 others); Mon, 19 Jul 2021 19:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348430AbhGSWHy (ORCPT ); Mon, 19 Jul 2021 18:07:54 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85F35C08EADF for ; Mon, 19 Jul 2021 15:32:01 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id i14so5923130pfd.5 for ; Mon, 19 Jul 2021 15:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OKFGPZSjOp/qW6q1mXcXpbNAjO5OGS/hWfxwbZXcdo0=; b=sVsOJPzGT8JNFtN6AfSOY7YVPfvQgkW/r1U3nX7YGP7whHu8yZoQlQfK9PAG9OzLW9 bgdSKKzQBPRDs2nMVykJcgIkpFXD7j0QINfW0wnI34dFWCzC8N0GSYBxT4hrnYNwXL8x OQPHk+7qcuPEOb2RQfwUJQqILUmbw4sdtH1U3Dgdx1/0xLgLOOAPkhlLqzIGoFsTaRW1 E0+QD3BzwSVD56rfHQgSK4al/PJGLagv5Fl9vuDSL1RZf8ISR1KU7Jv7NEwje2jFd6EX nl7aqpTmaP7POhpLaVQxllpKaG5SyHA0cLaNv9vzjWordgv7kOeO2vG5GFpriX8MhZIF FSTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=OKFGPZSjOp/qW6q1mXcXpbNAjO5OGS/hWfxwbZXcdo0=; b=Qgbr1z8CnJ3T2liPuSnmMLbpLEZoWR7x0FHw0jP8GzhormLHs10LXGWzms7c6NZKou 6wMSct0w3rOwBIEPt2Jqq4xg3+jgk+ou/g6QOYMP5WDWBFrdgxWnP/ErmaPeJT2oAMf2 AoufMHFnCJlTd9IOBcQAMpMIhVuCKasKNCr5UdlLAD0W4huKhHp8eoSwszaJRsNeQtLp 6iY55HsNkLybICIvKztFx8M1snfvPNSN6ABGc1P4+AXpxoWHWsytomFUfHQSVSZhz52Q tSdkobesyZUQ+seDMNCuRdHf8NoKZyyo6pYEJVeZ0zCDnxTYYbuhglqxHHegQ1Px8hYJ hbrw== X-Gm-Message-State: AOAM5323uFQemshnxE4oTXycFbeqLKhVCiUf3tQDXgVO7vmx6mor5i00 3vdzoZof/h5zFZ4ynQNer2w= X-Received: by 2002:a63:3704:: with SMTP id e4mr27427154pga.310.1626733920980; Mon, 19 Jul 2021 15:32:00 -0700 (PDT) Received: from balhae.hsd1.ca.comcast.net ([2601:647:4801:c8d0:ff4e:db29:48ff:3778]) by smtp.gmail.com with ESMTPSA id q19sm6921569pgj.17.2021.07.19.15.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 15:32:00 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Andi Kleen , Ian Rogers , Adrian Hunter Subject: [PATCHSET v3 0/5] perf inject: Fix broken data with mixed input/output Date: Mon, 19 Jul 2021 15:31:48 -0700 Message-Id: <20210719223153.1618812-1-namhyung@kernel.org> X-Mailer: git-send-email 2.32.0.402.g57bb445576-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, The perf inject processes the input data and produces an output with injected data according to the given options. During the work, it assumes the input and output files have the same format - either a regular file or a pipe. This works for the obvious cases, but sometimes makes a trouble when input and output have different formats (like for debugging). * changes in v3 - use task-clock:u in the pipe-test.sh * changes in v2 - factor out perf_event__synthesize_for_pipe - add a shell test for pipe operations For example, this patchset fixed the following cases 1. input: pipe, output: file # perf record -a -o - sleep 1 | perf inject -b -o perf-pipe.data # perf report -i perf-pipe.data 2. input: file, output: pipe # perf record -a -B sleep 1 # perf inject -b -i perf.data | perf report -i - Thanks, Namhyung Namhyung Kim (5): perf tools: Remove repipe argument from perf_session__new() perf tools: Pass a fd to perf_file_header__read_pipe() perf inject: Fix output from a pipe to a file perf inject: Fix output from a file to a pipe perf tools: Add pipe_test.sh to verify pipe operations tools/perf/bench/synthesize.c | 4 +- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-buildid-cache.c | 2 +- tools/perf/builtin-buildid-list.c | 2 +- tools/perf/builtin-c2c.c | 2 +- tools/perf/builtin-diff.c | 4 +- tools/perf/builtin-evlist.c | 2 +- tools/perf/builtin-inject.c | 38 ++++++++++++++-- tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-kvm.c | 4 +- tools/perf/builtin-lock.c | 2 +- tools/perf/builtin-mem.c | 3 +- tools/perf/builtin-record.c | 40 +++-------------- tools/perf/builtin-report.c | 2 +- tools/perf/builtin-sched.c | 4 +- tools/perf/builtin-script.c | 4 +- tools/perf/builtin-stat.c | 4 +- tools/perf/builtin-timechart.c | 3 +- tools/perf/builtin-top.c | 2 +- tools/perf/builtin-trace.c | 2 +- tools/perf/tests/shell/pipe_test.sh | 69 +++++++++++++++++++++++++++++ tools/perf/tests/topology.c | 4 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/data-convert-json.c | 2 +- tools/perf/util/header.c | 12 ++--- tools/perf/util/header.h | 2 +- tools/perf/util/session.c | 11 ++--- tools/perf/util/session.h | 12 ++++- tools/perf/util/synthetic-events.c | 53 +++++++++++++++++++++- tools/perf/util/synthetic-events.h | 6 +++ 30 files changed, 217 insertions(+), 84 deletions(-) create mode 100755 tools/perf/tests/shell/pipe_test.sh -- 2.32.0.402.g57bb445576-goog