#include <stdlib.h>
#include <linux/refcount.h>
#include <internal/cpumap.h>
+
+struct perf_cpu_map *perf_cpu_map__dummy_new(void)
+{
+ struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int));
+
+ if (cpus != NULL) {
+ cpus->nr = 1;
+ cpus->map[0] = -1;
+ refcount_set(&cpus->refcnt, 1);
+ }
+
+ return cpus;
+}
#ifndef __LIBPERF_CPUMAP_H
#define __LIBPERF_CPUMAP_H
+#include <perf/core.h>
+
struct perf_cpu_map;
+LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void);
+
#endif /* __LIBPERF_CPUMAP_H */
LIBPERF_0.0.1 {
global:
libperf_set_print;
+ perf_cpu_map__dummy_new;
local:
*;
};
}
evlist__add(evlist, evsel);
- cpus = cpu_map__dummy_new();
+ cpus = perf_cpu_map__dummy_new();
threads = thread_map__new_by_tid(getpid());
if (!cpus || !threads) {
err = -ENOMEM;
* perf_evlist__prepare_workload we'll fill in the only thread
* we're monitoring, the one forked there.
*/
- cpus = cpu_map__dummy_new();
+ cpus = perf_cpu_map__dummy_new();
threads = thread_map__new_by_tid(-1);
if (!cpus || !threads) {
err = -ENOMEM;
else if (*cpu_list != '\0')
cpus = cpu_map__default_new();
else
- cpus = cpu_map__dummy_new();
+ cpus = perf_cpu_map__dummy_new();
invalid:
free(tmp_cpus);
out:
#undef BUFSIZE
}
-struct perf_cpu_map *cpu_map__dummy_new(void)
-{
- struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int));
-
- if (cpus != NULL) {
- cpus->nr = 1;
- cpus->map[0] = -1;
- refcount_set(&cpus->refcnt, 1);
- }
-
- return cpus;
-}
-
struct perf_cpu_map *cpu_map__empty_new(int nr)
{
struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int) * nr);
#include <stdbool.h>
#include <linux/refcount.h>
#include <internal/cpumap.h>
+#include <perf/cpumap.h>
#include "perf.h"
#include "util/debug.h"
struct perf_cpu_map *cpu_map__new(const char *cpu_list);
struct perf_cpu_map *cpu_map__empty_new(int nr);
-struct perf_cpu_map *cpu_map__dummy_new(void);
struct perf_cpu_map *cpu_map__new_data(struct cpu_map_data *data);
struct perf_cpu_map *cpu_map__read(FILE *file);
size_t cpu_map__snprint(struct perf_cpu_map *map, char *buf, size_t size);
return -1;
if (target__uses_dummy_map(target))
- cpus = cpu_map__dummy_new();
+ cpus = perf_cpu_map__dummy_new();
else
cpus = cpu_map__new(target->cpu_list);
static struct perf_cpu_map *empty_cpu_map;
if (empty_cpu_map == NULL) {
- empty_cpu_map = cpu_map__dummy_new();
+ empty_cpu_map = perf_cpu_map__dummy_new();
if (empty_cpu_map == NULL)
return -ENOMEM;
}