summaryrefslogtreecommitdiff
path: root/tools/perf/util/cputopo.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/cputopo.c')
-rw-r--r--tools/perf/util/cputopo.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/perf/util/cputopo.c b/tools/perf/util/cputopo.c
index e08797c3cdbc..ca1d833a0c26 100644
--- a/tools/perf/util/cputopo.c
+++ b/tools/perf/util/cputopo.c
@@ -238,6 +238,20 @@ static bool has_die_topology(void)
return true;
}
+const struct cpu_topology *online_topology(void)
+{
+ static const struct cpu_topology *topology;
+
+ if (!topology) {
+ topology = cpu_topology__new();
+ if (!topology) {
+ pr_err("Error creating CPU topology");
+ abort();
+ }
+ }
+ return topology;
+}
+
struct cpu_topology *cpu_topology__new(void)
{
struct cpu_topology *tp = NULL;