2019-07-21 18:24:21 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <perf/evsel.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <internal/evsel.h>
|
2019-07-21 18:24:33 +07:00
|
|
|
#include <linux/zalloc.h>
|
2019-07-21 18:24:36 +07:00
|
|
|
#include <stdlib.h>
|
2019-07-21 18:24:24 +07:00
|
|
|
|
2019-07-21 18:24:29 +07:00
|
|
|
void perf_evsel__init(struct perf_evsel *evsel, struct perf_event_attr *attr)
|
2019-07-21 18:24:24 +07:00
|
|
|
{
|
|
|
|
INIT_LIST_HEAD(&evsel->node);
|
2019-07-21 18:24:29 +07:00
|
|
|
evsel->attr = *attr;
|
2019-07-21 18:24:24 +07:00
|
|
|
}
|
2019-07-21 18:24:33 +07:00
|
|
|
|
|
|
|
struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr)
|
|
|
|
{
|
|
|
|
struct perf_evsel *evsel = zalloc(sizeof(*evsel));
|
|
|
|
|
|
|
|
if (evsel != NULL)
|
|
|
|
perf_evsel__init(evsel, attr);
|
|
|
|
|
|
|
|
return evsel;
|
|
|
|
}
|
2019-07-21 18:24:36 +07:00
|
|
|
|
|
|
|
void perf_evsel__delete(struct perf_evsel *evsel)
|
|
|
|
{
|
|
|
|
free(evsel);
|
|
|
|
}
|