Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1844dbcb authored by Namhyung Kim's avatar Namhyung Kim Committed by Jiri Olsa
Browse files

perf tools: Introduce hists__inc_nr_samples()



There're some duplicate code for counting number of samples.  Add
hists__inc_nr_samples() and reuse it.

Suggested-by: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1401335910-16832-2-git-send-email-namhyung@kernel.org


Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
parent e450f90e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
		return -ENOMEM;

	ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
	hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE);
	hists__inc_nr_samples(&evsel->hists, true);
	return ret;
}

+1 −3
Original line number Diff line number Diff line
@@ -92,9 +92,7 @@ static void report__inc_stats(struct report *rep, struct hist_entry *he)
	 * counted in perf_session_deliver_event().  The dump_trace
	 * requires this info is ready before going to the output tree.
	 */
	hists__inc_nr_events(he->hists, PERF_RECORD_SAMPLE);
	if (!he->filtered)
		he->hists->stats.nr_non_filtered_samples++;
	hists__inc_nr_samples(he->hists, he->filtered);
}

static int report__add_mem_hist_entry(struct report *rep, struct addr_location *al,
+1 −1
Original line number Diff line number Diff line
@@ -1428,7 +1428,7 @@ static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_
	int err = 0;

	evsel->hists.stats.total_period += sample->period;
	hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE);
	hists__inc_nr_samples(&evsel->hists, true);

	if (evsel->handler != NULL) {
		tracepoint_handler f = evsel->handler;
+1 −4
Original line number Diff line number Diff line
@@ -252,10 +252,7 @@ static struct hist_entry *perf_evsel__add_hist_entry(struct perf_evsel *evsel,
	if (he == NULL)
		return NULL;

	hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE);
	if (!he->filtered)
		evsel->hists.stats.nr_non_filtered_samples++;

	hists__inc_nr_samples(&evsel->hists, he->filtered);
	return he;
}

+1 −3
Original line number Diff line number Diff line
@@ -85,9 +85,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
			fake_samples[i].map = al.map;
			fake_samples[i].sym = al.sym;

			hists__inc_nr_events(he->hists, PERF_RECORD_SAMPLE);
			if (!he->filtered)
				he->hists->stats.nr_non_filtered_samples++;
			hists__inc_nr_samples(he->hists, he->filtered);
		}
	}

Loading