Skip to content

Commit 9d88a1a

Browse files
olsajiriacmel
authored andcommitted
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 <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: David Ahern <[email protected]> Cc: Geneviève Bastien <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jeremie Galarneau <[email protected]> Cc: Michael Petlan <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent d1e325c commit 9d88a1a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

tools/perf/builtin-record.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,9 @@ static int record__init_clock(struct record *rec)
15661566
if (!rec->opts.use_clockid)
15671567
return 0;
15681568

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+
15691572
session->header.env.clock.clockid = rec->opts.clockid;
15701573

15711574
if (gettimeofday(&ref_tod, NULL) != 0) {
@@ -1675,9 +1678,6 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
16751678

16761679
record__init_features(rec);
16771680

1678-
if (rec->opts.use_clockid && rec->opts.clockid_res_ns)
1679-
session->header.env.clockid_res_ns = rec->opts.clockid_res_ns;
1680-
16811681
if (forks) {
16821682
err = perf_evlist__prepare_workload(rec->evlist, &opts->target,
16831683
argv, data->is_pipe,

tools/perf/util/env.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ struct perf_env {
7777
struct numa_node *numa_nodes;
7878
struct memory_node *memory_nodes;
7979
unsigned long long memory_bsize;
80-
u64 clockid_res_ns;
8180

8281
/*
8382
* bpf_info_lock protects bpf rbtrees. This is needed because the
@@ -105,6 +104,7 @@ struct perf_env {
105104
struct {
106105
u64 tod_ns;
107106
u64 clockid_ns;
107+
u64 clockid_res_ns;
108108
int clockid;
109109
/*
110110
* enabled is valid for report mode, and is true if above

tools/perf/util/header.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,8 @@ static int write_auxtrace(struct feat_fd *ff,
892892
static int write_clockid(struct feat_fd *ff,
893893
struct evlist *evlist __maybe_unused)
894894
{
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));
897897
}
898898

899899
static int write_clock_data(struct feat_fd *ff,
@@ -1581,7 +1581,7 @@ static void print_cpu_topology(struct feat_fd *ff, FILE *fp)
15811581
static void print_clockid(struct feat_fd *ff, FILE *fp)
15821582
{
15831583
fprintf(fp, "# clockid frequency: %"PRIu64" MHz\n",
1584-
ff->ph->env.clockid_res_ns * 1000);
1584+
ff->ph->env.clock.clockid_res_ns * 1000);
15851585
}
15861586

15871587
static void print_clock_data(struct feat_fd *ff, FILE *fp)
@@ -2810,7 +2810,7 @@ static int process_mem_topology(struct feat_fd *ff,
28102810
static int process_clockid(struct feat_fd *ff,
28112811
void *data __maybe_unused)
28122812
{
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))
28142814
return -1;
28152815

28162816
return 0;

0 commit comments

Comments
 (0)