Skip to content

Commit f39056f

Browse files
namhyungacmel
authored andcommitted
perf hists: Convert hist entry functions to use struct he_stat
The hist_entry__add_cpumode_period() and hist_entry__decay() functions are dealing with hist_entry's stat fields only. Make them he_stat methods then. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Arun Sharma <asharma@fb.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Rodrigo Campos <rodrigo@sdfg.com.ar> Link: http://lkml.kernel.org/r/1389677157-30513-5-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 2dc9fb1 commit f39056f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tools/perf/util/hist.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,21 @@ void hists__output_recalc_col_len(struct hists *hists, int max_rows)
181181
}
182182
}
183183

184-
static void hist_entry__add_cpumode_period(struct hist_entry *he,
185-
unsigned int cpumode, u64 period)
184+
static void he_stat__add_cpumode_period(struct he_stat *he_stat,
185+
unsigned int cpumode, u64 period)
186186
{
187187
switch (cpumode) {
188188
case PERF_RECORD_MISC_KERNEL:
189-
he->stat.period_sys += period;
189+
he_stat->period_sys += period;
190190
break;
191191
case PERF_RECORD_MISC_USER:
192-
he->stat.period_us += period;
192+
he_stat->period_us += period;
193193
break;
194194
case PERF_RECORD_MISC_GUEST_KERNEL:
195-
he->stat.period_guest_sys += period;
195+
he_stat->period_guest_sys += period;
196196
break;
197197
case PERF_RECORD_MISC_GUEST_USER:
198-
he->stat.period_guest_us += period;
198+
he_stat->period_guest_us += period;
199199
break;
200200
default:
201201
break;
@@ -222,10 +222,10 @@ static void he_stat__add_stat(struct he_stat *dest, struct he_stat *src)
222222
dest->weight += src->weight;
223223
}
224224

225-
static void hist_entry__decay(struct hist_entry *he)
225+
static void he_stat__decay(struct he_stat *he_stat)
226226
{
227-
he->stat.period = (he->stat.period * 7) / 8;
228-
he->stat.nr_events = (he->stat.nr_events * 7) / 8;
227+
he_stat->period = (he_stat->period * 7) / 8;
228+
he_stat->nr_events = (he_stat->nr_events * 7) / 8;
229229
/* XXX need decay for weight too? */
230230
}
231231

@@ -236,7 +236,7 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
236236
if (prev_period == 0)
237237
return true;
238238

239-
hist_entry__decay(he);
239+
he_stat__decay(&he->stat);
240240

241241
if (!he->filtered)
242242
hists->stats.total_period -= prev_period - he->stat.period;
@@ -402,7 +402,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
402402
rb_link_node(&he->rb_node_in, parent, p);
403403
rb_insert_color(&he->rb_node_in, hists->entries_in);
404404
out:
405-
hist_entry__add_cpumode_period(he, al->cpumode, period);
405+
he_stat__add_cpumode_period(&he->stat, al->cpumode, period);
406406
return he;
407407
}
408408

0 commit comments

Comments
 (0)