env.c (9c3a985f88fa4de82bf4bda906095ce6444e9039) | env.c (1eaf496ed386934f1c2439a120fe84a05194f91a) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include "cpumap.h" 3#include "debug.h" 4#include "env.h" 5#include "util/header.h" 6#include <linux/ctype.h> 7#include <linux/zalloc.h> 8#include "cgroup.h" 9#include <errno.h> 10#include <sys/utsname.h> 11#include <stdlib.h> 12#include <string.h> | 1// SPDX-License-Identifier: GPL-2.0 2#include "cpumap.h" 3#include "debug.h" 4#include "env.h" 5#include "util/header.h" 6#include <linux/ctype.h> 7#include <linux/zalloc.h> 8#include "cgroup.h" 9#include <errno.h> 10#include <sys/utsname.h> 11#include <stdlib.h> 12#include <string.h> |
13#include "pmus.h" |
|
13#include "strbuf.h" 14 15struct perf_env perf_env; 16 17#ifdef HAVE_LIBBPF_SUPPORT 18#include "bpf-event.h" 19#include "bpf-utils.h" 20#include <bpf/libbpf.h> --- 297 unchanged lines hidden (view full) --- 318} 319 320int perf_env__read_pmu_mappings(struct perf_env *env) 321{ 322 struct perf_pmu *pmu = NULL; 323 u32 pmu_num = 0; 324 struct strbuf sb; 325 | 14#include "strbuf.h" 15 16struct perf_env perf_env; 17 18#ifdef HAVE_LIBBPF_SUPPORT 19#include "bpf-event.h" 20#include "bpf-utils.h" 21#include <bpf/libbpf.h> --- 297 unchanged lines hidden (view full) --- 319} 320 321int perf_env__read_pmu_mappings(struct perf_env *env) 322{ 323 struct perf_pmu *pmu = NULL; 324 u32 pmu_num = 0; 325 struct strbuf sb; 326 |
326 while ((pmu = perf_pmu__scan(pmu))) { | 327 while ((pmu = perf_pmus__scan(pmu))) { |
327 if (!pmu->name) 328 continue; 329 pmu_num++; 330 } 331 if (!pmu_num) { 332 pr_debug("pmu mappings not available\n"); 333 return -ENOENT; 334 } 335 env->nr_pmu_mappings = pmu_num; 336 337 if (strbuf_init(&sb, 128 * pmu_num) < 0) 338 return -ENOMEM; 339 | 328 if (!pmu->name) 329 continue; 330 pmu_num++; 331 } 332 if (!pmu_num) { 333 pr_debug("pmu mappings not available\n"); 334 return -ENOENT; 335 } 336 env->nr_pmu_mappings = pmu_num; 337 338 if (strbuf_init(&sb, 128 * pmu_num) < 0) 339 return -ENOMEM; 340 |
340 while ((pmu = perf_pmu__scan(pmu))) { | 341 while ((pmu = perf_pmus__scan(pmu))) { |
341 if (!pmu->name) 342 continue; 343 if (strbuf_addf(&sb, "%u:%s", pmu->type, pmu->name) < 0) 344 goto error; 345 /* include a NULL character at the end */ 346 if (strbuf_add(&sb, "", 1) < 0) 347 goto error; 348 } --- 235 unchanged lines hidden --- | 342 if (!pmu->name) 343 continue; 344 if (strbuf_addf(&sb, "%u:%s", pmu->type, pmu->name) < 0) 345 goto error; 346 /* include a NULL character at the end */ 347 if (strbuf_add(&sb, "", 1) < 0) 348 goto error; 349 } --- 235 unchanged lines hidden --- |