Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp2878907ima; Sun, 3 Feb 2019 08:37:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN75O0diy9ZjXrURmHpoB8VzHtrnEdup0pVByz6uKfUkDNVxJBduqmh7WELrqolwZInlW99l X-Received: by 2002:a17:902:1102:: with SMTP id d2mr48400087pla.138.1549211839027; Sun, 03 Feb 2019 08:37:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549211838; cv=none; d=google.com; s=arc-20160816; b=rtW2XcUSVFC45YwCYYo864mcBPSawFc7JQJPmilLUdbInOPaGGgz0C44hmg91A3Ot0 Nu6+phiHRCrXYKE3tvQ27rCprbN7F2RzB63UPBxiOpdJf36zB7p5QnOo2ZrHhqWk2IVb F+T7XCIEkVBDie0SPVV9EpZie+AuVYDFpkiZsW2+7wAejoIZd5s9FjNM8MinugeRYhvR ShozYqpZzlBWgo1IWK6MEGL8eA5IsV2aXR9JHjRx6cUoBViUCSuDK9hGFa6eUwRV6BiR cVFx4bSnX3pF3PxcDZnIje4A8jB+G3bJI59bTzMJMWV39IsGfbopt6ZQgR8yPcznJD+x WNGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=X731sddpHZ0VsO8g7Z3jVgFxuqQYy2J+kQyd6H8Zejg=; b=pBS7fpZVUKokvcLGNsHZsDINC9V1M7OWa5vnm4c4JwXR9N7ezyr4bRErTNnoLCXqC5 DKuiDiGmdDvPnmvNErtXeVVUhv9UiRgcMSNRJL75HbQAHjqSqJzZzLH5CZ6zNrFLWk0H PXjwttQptIEND+Er5VU+/mEKPG09SRJPDCsQtaiwhGOMIzM7lP9rekeDsNiy8NOBruTX s0dStLm6fuRM1AZ2RkVawshoQa3Dtqw+gKgls8Misx10+a4DIon7x95IpnjTjHbcrEL5 TdYQDIDDKaRe//7jn5G4fTC7MUxadMoFYLbhbTytCsxG07lkUoYvpR5ox6nrypXgZ5Eo 0Y/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si11387981pll.271.2019.02.03.08.37.03; Sun, 03 Feb 2019 08:37:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728329AbfBCPad (ORCPT + 99 others); Sun, 3 Feb 2019 10:30:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57292 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728266AbfBCPac (ORCPT ); Sun, 3 Feb 2019 10:30:32 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69E0581F10; Sun, 3 Feb 2019 15:30:31 +0000 (UTC) Received: from krava.redhat.com (ovpn-204-46.brq.redhat.com [10.40.204.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1ABF5C238; Sun, 3 Feb 2019 15:30:28 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Adrian Hunter , Andi Kleen , Stephane Eranian , Alexey Budankov Subject: [PATCH 03/14] perf data: Move size to struct perf_data_file Date: Sun, 3 Feb 2019 16:30:07 +0100 Message-Id: <20190203153018.9650-4-jolsa@kernel.org> In-Reply-To: <20190203153018.9650-1-jolsa@kernel.org> References: <20190203153018.9650-1-jolsa@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 03 Feb 2019 15:30:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We are about to add support for multiple files, so we need each file to keep its size. Link: http://lkml.kernel.org/n/tip-gcf5gtwxds3ggegu6evl0jvn@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/builtin-record.c | 5 ++--- tools/perf/util/data.c | 2 +- tools/perf/util/data.h | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 6cb587dcb60d..1ed48b488b50 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -659,10 +659,9 @@ static int process_sample_event(struct perf_tool *tool, static int process_buildids(struct record *rec) { - struct perf_data *data = &rec->data; struct perf_session *session = rec->session; - if (data->size == 0) + if (perf_data__size(&rec->data) == 0) return 0; /* @@ -850,7 +849,7 @@ record__finish_output(struct record *rec) return; rec->session->header.data_size += rec->bytes_written; - data->size = lseek(perf_data__fd(data), 0, SEEK_CUR); + data->file.size = lseek(perf_data__fd(data), 0, SEEK_CUR); if (!rec->no_buildid) { process_buildids(rec); diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index d8cfc19ddb10..09eceda17fc2 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c @@ -82,7 +82,7 @@ static int open_file_read(struct perf_data *data) goto out_close; } - data->size = st.st_size; + data->file.size = st.st_size; return fd; out_close: diff --git a/tools/perf/util/data.h b/tools/perf/util/data.h index 4828f7feea89..85f9c0dbf982 100644 --- a/tools/perf/util/data.h +++ b/tools/perf/util/data.h @@ -12,13 +12,13 @@ enum perf_data_mode { struct perf_data_file { const char *path; int fd; + unsigned long size; }; struct perf_data { struct perf_data_file file; bool is_pipe; bool force; - unsigned long size; enum perf_data_mode mode; }; @@ -44,7 +44,7 @@ static inline int perf_data__fd(struct perf_data *data) static inline unsigned long perf_data__size(struct perf_data *data) { - return data->size; + return data->file.size; } int perf_data__open(struct perf_data *data); -- 2.17.2