Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Move clockid_res_ns under clock struct

Move the clockid_res_ns struct member to the clock struct, so we have
the clock related stuff in one place.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Geneviève Bastien <gbastien@versatic.net>
Cc: Ian Rogers <irogers@google.com>
Cc: Jeremie Galarneau <jgalar@efficios.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lore.kernel.org/lkml/20200805093444.314999-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
9d88a1a1 d1e325cf

+8 -8
+3 -3
tools/perf/builtin-record.c
··· 1566 1566 if (!rec->opts.use_clockid) 1567 1567 return 0; 1568 1568 1569 + if (rec->opts.use_clockid && rec->opts.clockid_res_ns) 1570 + session->header.env.clock.clockid_res_ns = rec->opts.clockid_res_ns; 1571 + 1569 1572 session->header.env.clock.clockid = rec->opts.clockid; 1570 1573 1571 1574 if (gettimeofday(&ref_tod, NULL) != 0) { ··· 1677 1674 return -1; 1678 1675 1679 1676 record__init_features(rec); 1680 - 1681 - if (rec->opts.use_clockid && rec->opts.clockid_res_ns) 1682 - session->header.env.clockid_res_ns = rec->opts.clockid_res_ns; 1683 1677 1684 1678 if (forks) { 1685 1679 err = perf_evlist__prepare_workload(rec->evlist, &opts->target,
+1 -1
tools/perf/util/env.h
··· 77 77 struct numa_node *numa_nodes; 78 78 struct memory_node *memory_nodes; 79 79 unsigned long long memory_bsize; 80 - u64 clockid_res_ns; 81 80 82 81 /* 83 82 * bpf_info_lock protects bpf rbtrees. This is needed because the ··· 104 105 struct { 105 106 u64 tod_ns; 106 107 u64 clockid_ns; 108 + u64 clockid_res_ns; 107 109 int clockid; 108 110 /* 109 111 * enabled is valid for report mode, and is true if above
+4 -4
tools/perf/util/header.c
··· 892 892 static int write_clockid(struct feat_fd *ff, 893 893 struct evlist *evlist __maybe_unused) 894 894 { 895 - return do_write(ff, &ff->ph->env.clockid_res_ns, 896 - sizeof(ff->ph->env.clockid_res_ns)); 895 + return do_write(ff, &ff->ph->env.clock.clockid_res_ns, 896 + sizeof(ff->ph->env.clock.clockid_res_ns)); 897 897 } 898 898 899 899 static int write_clock_data(struct feat_fd *ff, ··· 1581 1581 static void print_clockid(struct feat_fd *ff, FILE *fp) 1582 1582 { 1583 1583 fprintf(fp, "# clockid frequency: %"PRIu64" MHz\n", 1584 - ff->ph->env.clockid_res_ns * 1000); 1584 + ff->ph->env.clock.clockid_res_ns * 1000); 1585 1585 } 1586 1586 1587 1587 static void print_clock_data(struct feat_fd *ff, FILE *fp) ··· 2810 2810 static int process_clockid(struct feat_fd *ff, 2811 2811 void *data __maybe_unused) 2812 2812 { 2813 - if (do_read_u64(ff, &ff->ph->env.clockid_res_ns)) 2813 + if (do_read_u64(ff, &ff->ph->env.clock.clockid_res_ns)) 2814 2814 return -1; 2815 2815 2816 2816 return 0;