Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2251237ybg; Thu, 30 Jul 2020 14:43:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjgFoPRLppMryZKcHuTtmVnQsRXpK+i3Oc/GRZmZzunp1jKsyM5mDunev1bY2l8/ov/6v9 X-Received: by 2002:aa7:d6c7:: with SMTP id x7mr1008020edr.167.1596145380417; Thu, 30 Jul 2020 14:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596145380; cv=none; d=google.com; s=arc-20160816; b=ovnZttSpEHW8YZU2Y4fSJW/YFdDbk/UMjuThEll424yMzxrQ0aTTd1SFqQfCSWqlFO hH/oQ8YRSkB6UNzIpO06I9zcdHRF42UBuuksMCSkiJrv3D+0o/8NYF5EvSK0LJr0ELFX cgA5ytixQmbYCTj7EjMHPbmGdj0YLXh9FcdwtH+9zsA+LPeKj/PmVdUxlMI+fXp3JIG6 l0tzcnxYwRMlJW9LOp5bZ3eNvDuNPVxtvLWNDnWIwmau136+RV3hAaYqT8JU9E9zyCF9 1y6Daced7wxn6mcQ6rjnafCBYTQVwj9oP9qZ2O+olVNCY1BCVOeb/1rkiauMqKB5rBMe ooEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=i6tY9BLShTo1+jsAinZiTEsJ9RI9D49wN7Z5+44BVOg=; b=chkMKmklc25ujgxr8gDBymFNKzXQpvX3ovVsJ9oKCmnOwvdDN84mQjtDG9hZ9H1daY za3ngm2HBjsxmjnSi3o9jxU5PqS+vee+gt9wjmMIRBVRe1vTI/O5/mvUhwUaf2TMaw/m KNhSwObAX7/WLppHCt7zXLXKA9fu14mOO6y8iS4MWr//nB1yPmLVxlhdc5K+BZrn82so sHDPaJzhMuK4YJIetVIIHB9OR88OY8GxFZDgD3NmYT7ZoGX9zcgCMW4BHlfFXM1lQjAx SzOmUJph6nhAK4RRedX3QR9wd8DVgcvIc/9EigHzxXx1S/XVM2UUrEZlYkUtzRX17ja3 xRzw== ARC-Authentication-Results: i=1; mx.google.com; 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 y8si4196222edm.463.2020.07.30.14.42.38; Thu, 30 Jul 2020 14:43:00 -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; 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 S1730700AbgG3Vkn convert rfc822-to-8bit (ORCPT + 99 others); Thu, 30 Jul 2020 17:40:43 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:26211 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730684AbgG3Vkn (ORCPT ); Thu, 30 Jul 2020 17:40:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-JeE0oLJhNG6QCp0fP328ag-1; Thu, 30 Jul 2020 17:40:40 -0400 X-MC-Unique: JeE0oLJhNG6QCp0fP328ag-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C69101902ED4; Thu, 30 Jul 2020 21:40:32 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.194.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8E6F87E1C; Thu, 30 Jul 2020 21:40:29 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Ian Rogers , Andi Kleen , David Ahern , =?UTF-8?q?Genevi=C3=A8ve=20Bastien?= , Wang Nan , Jeremie Galarneau Subject: [PATCH 3/6] perf tools: Move clockid_res_ns under clock struct Date: Thu, 30 Jul 2020 23:39:47 +0200 Message-Id: <20200730213950.1503773-4-jolsa@kernel.org> In-Reply-To: <20200730213950.1503773-1-jolsa@kernel.org> References: <20200730213950.1503773-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Moving clockid_res_ns under clock struct, so we have clock related stuff in one place. Signed-off-by: Jiri Olsa --- tools/perf/builtin-record.c | 6 +++--- tools/perf/util/env.h | 2 +- tools/perf/util/header.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f8280e721e1a..955c621b0ff7 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1565,6 +1565,9 @@ static int record__init_clock(struct record *rec) if (!rec->opts.use_clockid) return 0; + if (rec->opts.use_clockid && rec->opts.clockid_res_ns) + session->header.env.clock.clockid_res_ns = rec->opts.clockid_res_ns; + session->header.env.clock.clockid = rec->opts.clockid; if (gettimeofday(&ref_tod, NULL) != 0) { @@ -1673,9 +1676,6 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) record__init_features(rec); - if (rec->opts.use_clockid && rec->opts.clockid_res_ns) - session->header.env.clockid_res_ns = rec->opts.clockid_res_ns; - if (forks) { err = perf_evlist__prepare_workload(rec->evlist, &opts->target, argv, data->is_pipe, diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h index 4098a63d5e64..d50c0a3354e3 100644 --- a/tools/perf/util/env.h +++ b/tools/perf/util/env.h @@ -77,7 +77,6 @@ struct perf_env { struct numa_node *numa_nodes; struct memory_node *memory_nodes; unsigned long long memory_bsize; - u64 clockid_res_ns; /* * bpf_info_lock protects bpf rbtrees. This is needed because the @@ -105,6 +104,7 @@ struct perf_env { struct { u64 tod_ns; u64 clockid_ns; + u64 clockid_res_ns; int clockid; /* * enabled is valid for report mode, and is true if above diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index ffe10d8fd5fa..88151c5cf286 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -891,8 +891,8 @@ static int write_auxtrace(struct feat_fd *ff, static int write_clockid(struct feat_fd *ff, struct evlist *evlist __maybe_unused) { - return do_write(ff, &ff->ph->env.clockid_res_ns, - sizeof(ff->ph->env.clockid_res_ns)); + return do_write(ff, &ff->ph->env.clock.clockid_res_ns, + sizeof(ff->ph->env.clock.clockid_res_ns)); } static int write_clock_data(struct feat_fd *ff, @@ -1580,7 +1580,7 @@ static void print_cpu_topology(struct feat_fd *ff, FILE *fp) static void print_clockid(struct feat_fd *ff, FILE *fp) { fprintf(fp, "# clockid frequency: %"PRIu64" MHz\n", - ff->ph->env.clockid_res_ns * 1000); + ff->ph->env.clock.clockid_res_ns * 1000); } static void print_clock_data(struct feat_fd *ff, FILE *fp) @@ -2809,7 +2809,7 @@ static int process_mem_topology(struct feat_fd *ff, static int process_clockid(struct feat_fd *ff, void *data __maybe_unused) { - if (do_read_u64(ff, &ff->ph->env.clockid_res_ns)) + if (do_read_u64(ff, &ff->ph->env.clock.clockid_res_ns)) return -1; return 0; -- 2.25.4