This source file includes following definitions.
- get_cpuid_str
1
2
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <api/fs/fs.h>
7 #include "header.h"
8
9 #define STR_LEN 1024
10
11 char *get_cpuid_str(struct perf_pmu *pmu)
12 {
13
14 char *buf = NULL;
15 struct cpu_map *cpus;
16 const char *sysfs = sysfs__mountpoint();
17
18 if (!sysfs || !pmu || !pmu->cpus)
19 return NULL;
20
21 buf = malloc(STR_LEN);
22 if (!buf)
23 return NULL;
24
25 cpus = cpu_map__get(pmu->cpus);
26 sprintf(buf, "0x%x", cpus->nr - 1);
27 cpu_map__put(cpus);
28 return buf;
29 }