PMC_GET_MSR(3)
π NAME π
Okay bestie, this is PMC_GET_MSR(3) from the Library Functions Manual β itβs all about x86 architecture-specific PMC operations, and the function girlies are pmc_get_msr. Slay. β¨
π LIBRARY π
Performance Counters Library (libpmc, -lpmc) β thatβs the vibe, thatβs the link line. π
π¦ SYNOPSIS π¦
#include <pmc.h>
int
pmc_get_msr(pmc_id_t pmc, uint32_t *msr);
πΈ DESCRIPTION πΈ
So the function pmc_get_msr() returns the processor model specific register number thatβs associated with a PMC, for subsequent use with RDPMC instructions. Like, itβs giving βhereβs the magical number, go use it directly.β β¨
Argument pmc specifies a process scope counting PMC. The function will write the model specific register number associated with the PMC to the location pointed to by argument msr. No cap, it literally writes it right into *msr. π«Ά
After successful completion of this function, applications can directly read the contents of PMC hardware using RDPMC instructions. So yeah, after it succeeds, the app can go straight to the hardware with RDPMC. Iconic. π₯
β RETURN VALUES β
The pmc_get_msr() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. Bestie, always check errno when you get that -1. π
π ERRORS π
A call to pmc_get_msr() may fail with the following errors:
[EINVAL]β The PMC handle specified was invalid.[EINVAL]β The PMC specified did not have process scope or counting mode.[EINVAL]β The PMC specified was allocated with thePMC_F_DESCENDANTSflag.[EINVAL]β The specified PMC is already attached to target processes other than the owner.[ENOSYS]β The underlying hardware does not support anRDPMCinstruction.
π SEE ALSO π
Mwah π β this little cutie is from source/version Debian, dated November 25, 2007, and its page is PMC_GET_MSR(3). Periodt. ππ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2007 Joseph Koshy. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms