PMC_CONFIGURE_LOGFILE(3)
๐ PMC_CONFIGURE_LOGFILE(3) โ log file management, but make it make sense
okay bestie so this is PMC_CONFIGURE_LOGFILE(3) from the Library Functions Manual and it's genuinely so useful โ it's all about wrangling log files for hwpmc(4) events ๐
โจ NAME โจ
pmc_configure_logfile, pmc_flush_logfile, pmc_writelog, pmc_close_logfile โ log file management
๐ LIBRARY ๐
Performance Counters Library (libpmc, -lpmc) โ yes you gotta link it, no cap ๐ฅ
๐ซถ SYNOPSIS ๐ซถ
#include <pmc.h>
int
pmc_configure_logfile(int fd);
int
pmc_flush_logfile(void);
int
pmc_writelog(uint32_t userdata);
int
pmc_close_logfile(void);
๐ธ DESCRIPTION ๐ธ
so these four functions are the whole friend group that manages logging of hwpmc(4) events ๐ like that's their entire job and they ate.
Let me break down who does what, one icon at a time:
pmc_configure_logfile(fd)turns logging on and off โ main character energy, honestly. The way it works: if the argumentfdis a valid file handle returned by a prior call toopen(2)orsocket(2), then performance events get logged to the file corresponding to that handle โจ but if the value offdis-1? Then logging gets stopped after any pending data is flushed. bye bestie ๐pmc_flush_logfile()forces ALL log data queued inside thehwpmc(4)driver to be written out. like it literally will not leave that data sitting in there, obsessed ๐ญpmc_writelog(userdata)appends a log entry containing the value ofuserdatato the log file. cute little custom note, love that for you ๐ฆpmc_close_logfile()flushes all pending log data and closeshwpmc(4)'s side of the stream. graceful exit, periodt ๐
โญ RETURN VALUES โญ
Upon successful completion, the value 0 is returned ๐ otherwise the value -1 is returned and the global variable errno is set to indicate the error ๐จ like it's telling you exactly what went wrong, iykyk.
๐ ERRORS ๐
a call to pmc_configure_logfile() may fail with these, mmkay
[EAGAIN]โ thehwpmc(4)driver was not able to create a helper process due to system limits being reached ๐ฎโ๐จ (system said "no more helpers", rude)[EBUSY]โ functionpmc_configure_logfile()was called with a log file already configured ๐ one at a time please!![EINVAL]โ functionpmc_configure_logfile()was called with an argument of-1without a log file being previously configured ๐ you can't stop what was never started, bestie[ENOMEM]โ the system encountered a memory shortage when servicing this request ๐ memory said "not today"
a call to pmc_flush_logfile() may fail with this one
[EINVAL]โ functionpmc_flush_logfile()was called without a log file being previously configured ๐ญ pls configure first
a call to pmc_writelog() may fail with these two
[EINVAL]โ functionpmc_writelog()was called without a log file being previously configured ๐ same vibe, no log file, no entry[ENOMEM]โ the system encountered a memory shortage when servicing this request ๐ again with the memory shortage
ngl fam, the recurring theme here is: configure your log file first. the setup is the whole plot. โจ
๐ SEE ALSO ๐
the crossover episode you didn't know you needed ๐ง
that's the whole page bestie, go forth and log responsibly ๐
Debian โ November 24, 2007 โ pmc_configure_logfile(3), signing off ๐
๐ฆ 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