Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.9-rc5 47 lines 884 B view raw
1// SPDX-License-Identifier: GPL-2.0 2#include <sys/types.h> 3#include <errno.h> 4#include <unistd.h> 5#include <stdio.h> 6#include <stdlib.h> 7#include <string.h> 8#include <linux/stringify.h> 9#include "header.h" 10#include "utils_header.h" 11#include "metricgroup.h" 12#include <api/fs/fs.h> 13 14int 15get_cpuid(char *buffer, size_t sz) 16{ 17 unsigned long pvr; 18 int nb; 19 20 pvr = mfspr(SPRN_PVR); 21 22 nb = scnprintf(buffer, sz, "%lu,%lu$", PVR_VER(pvr), PVR_REV(pvr)); 23 24 /* look for end marker to ensure the entire data fit */ 25 if (strchr(buffer, '$')) { 26 buffer[nb-1] = '\0'; 27 return 0; 28 } 29 return ENOBUFS; 30} 31 32char * 33get_cpuid_str(struct perf_pmu *pmu __maybe_unused) 34{ 35 char *bufp; 36 37 if (asprintf(&bufp, "%.8lx", mfspr(SPRN_PVR)) < 0) 38 bufp = NULL; 39 40 return bufp; 41} 42 43int arch_get_runtimeparam(void) 44{ 45 int count; 46 return sysfs__read_int("/devices/hv_24x7/interface/sockets", &count) < 0 ? 1 : count; 47}