Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp346244pxa; Wed, 5 Aug 2020 02:42:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxri5oQG/94Cj8lMUv5D4MgLmrPryzRvS39lzHlFJQNQo9Ql57gtp4/r8mBYCPbRjhn9Fit X-Received: by 2002:aa7:c30b:: with SMTP id l11mr1925084edq.253.1596620528157; Wed, 05 Aug 2020 02:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596620528; cv=none; d=google.com; s=arc-20160816; b=Ysqk6keux2hK+dNaddgDjZrqnDqrh6kDVuKFs4DaT86cJz4a62cRdQ3E2+SC01bxXT URC4ReaXB7vuZJ0i8epUvcvcEjlwhOBQVbTfh5pBwwJRFeySa5NFCKP32o9ED1qFgD4m JkjRiOgY62wFUQ2Va2Z4BvwrlYmtjD4QU6wx+IGGyt0StUGXVsB5ccosrJIR7XqYNhL4 bQpqLSlBAu8+23Lx1NwpwEUeQJV98vdQbjRu7Af5Nd/Af8VvPagMXN6YpMxYvMQfbJsL QFbg2/Zs8z9vc0l+jW9qXN8i0E2rU6+jz18RtJnzsVf/60BOMoTPWCdM416Pcv25aeFg jdZg== 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=m3E4ySt4Y2qZ+Jpc3Sgb23OgCNL9wqvS3Svdghk34iA=; b=JHPx/zLUNBus3BdzhjLo0OfaxokQ5KM09wykmJqbVbLddZZMowpzhhBhEWDxZRtCYq ydq7IRT9NKY7TNbtTaayynvUpfYDINhMGiwVteFxwlxPIM6E0TubuqDFnqii3/50S8v3 2w6YrjLaXaNMN8FBKdlux0t+w6KMly2hyAwR9gVTzS5Itfj9desLIwseNsJVslz3YBCP PM5dt2F0N8DAKVQfgef6FZ+dq8/SMJktLjX8P+cLwD5/YodErq+Pv/g4yiVGUBlIJutX 4XM/Pjl0eMCk+4cxfWxFzClSIqi//v8LgR7m7GSsIMz+sJOqS4F7hl9M9FVm7/BmNiBj n71w== 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 x26si911943ejb.350.2020.08.05.02.41.45; Wed, 05 Aug 2020 02:42:08 -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 S1728559AbgHEJiv convert rfc822-to-8bit (ORCPT + 99 others); Wed, 5 Aug 2020 05:38:51 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:24443 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728366AbgHEJfP (ORCPT ); Wed, 5 Aug 2020 05:35:15 -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-317-wM9pjQ9HP-KG5JbeMQ70XA-1; Wed, 05 Aug 2020 05:35:08 -0400 X-MC-Unique: wM9pjQ9HP-KG5JbeMQ70XA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F169800685; Wed, 5 Aug 2020 09:35:06 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.194.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9E257193A; Wed, 5 Aug 2020 09:35:02 +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 v2 4/7] perf tools: Move clockid_res_ns under clock struct Date: Wed, 5 Aug 2020 11:34:41 +0200 Message-Id: <20200805093444.314999-5-jolsa@kernel.org> In-Reply-To: <20200805093444.314999-1-jolsa@kernel.org> References: <20200805093444.314999-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 48d721af0096..c0f845021a16 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1566,6 +1566,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) { @@ -1674,9 +1677,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 7218f7db57af..a12972652006 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 eece94cf6f86..251faa9a5789 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -892,8 +892,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, @@ -1581,7 +1581,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) @@ -2810,7 +2810,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