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: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1401335910-16832-2-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
This commit is contained in:
@@ -800,6 +800,13 @@ void hists__inc_nr_events(struct hists *hists, u32 type)
|
||||
events_stats__inc(&hists->stats, type);
|
||||
}
|
||||
|
||||
void hists__inc_nr_samples(struct hists *hists, bool filtered)
|
||||
{
|
||||
events_stats__inc(&hists->stats, PERF_RECORD_SAMPLE);
|
||||
if (!filtered)
|
||||
hists->stats.nr_non_filtered_samples++;
|
||||
}
|
||||
|
||||
static struct hist_entry *hists__add_dummy_entry(struct hists *hists,
|
||||
struct hist_entry *pair)
|
||||
{
|
||||
|
@@ -119,6 +119,7 @@ u64 hists__total_period(struct hists *hists);
|
||||
void hists__reset_stats(struct hists *hists);
|
||||
void hists__inc_stats(struct hists *hists, struct hist_entry *h);
|
||||
void hists__inc_nr_events(struct hists *hists, u32 type);
|
||||
void hists__inc_nr_samples(struct hists *hists, bool filtered);
|
||||
void events_stats__inc(struct events_stats *stats, u32 type);
|
||||
size_t events_stats__fprintf(struct events_stats *stats, FILE *fp);
|
||||
|
||||
|
Reference in New Issue
Block a user