PMSTORE(3)

πŸ“¦
version 6.3.8 Β· 2 versions
, in centos-stream 9, debian trixie, opensuse-leap 16.0, ubuntu noble, ubuntu questing

πŸ’– PMSTORE(3) β€” the pmStore and pmStoreHighRes bestie handbook ✨

Library Functions Manual πŸŽ€ Performance Co-Pilot

okay so bestie, imagine you could just… reach into a running metric and change it?? yeah. that's this. it's giving modify values of performance metrics πŸ’…


✨ NAME ✨

pmStore, pmStoreHighRes β€” modify values of performance metrics πŸ¦‹


🌸 C SYNOPSIS 🌸

#include <pcp/pmapi.h>

int pmStore(const pmResult *result);
int pmStoreHighRes(const pmHighResResult *result);

cc ... -lpcp

copy it exactly, don't get cute with the includes, i'm watching πŸ‘€


πŸ’œ DESCRIPTION πŸ’œ

so like. in some special cases it may be helpful to modify the current values of performance metrics β€” for example to reset a counter to zero, or to modify a ``metric'' that's a control variable for some agent that's collecting performance metrics. no cap, that's the whole vibe. πŸ”₯

The routines pmStore and pmStoreHighRes are lightweight inverses of pmFetch(3) and pmFetchHighRes(3) respectively. inverse girlies ✨

The caller must build the result data structure (of course, this could have been returned from an earlier pmFetch(3) or pmFetchHighRes(3) call). so yes, you're on your own for construction β€” but hey, maybe you already have one lying around from a fetch. recycling! 🌈

🚨 okay important one: it is an error to pass a result to pmStore or pmStoreHighRes in which the numval field within any of the pmValueSet structures has a value less than one. less than one. that's the rule. don't test it. πŸ’€

The current Performance Metrics Application Programming Interface (PMAPI) context must be one with a host as the source of metrics, and the current value of the nominated metrics will be changed β€” i.e. pmStore and pmStoreHighRes cannot be used to make retrospective changes to information in either the archives, or in the recent past for real-time sources of metrics. no time travel bestie, sorry 😭

The return code from pmStore and pmStoreHighRes is zero for success. zero = slay. anything else = read on. πŸ‘‘


🩺 DIAGNOSTICS 🩺

  • PM_ERR_GENERIC β€” at least one of the modifications was rejected. no other status is available from below the PMAPI (this is the lightweight part of the functionality!). in cases where the outcome of storing into individual metrics is important, the caller should make one call to either pmStore or pmStoreHighRes for each metric. on the other hand, a bulk modification can be performed in a single call for situations in which the outcome is not critical. pick your fighter: per-metric accountability or one big chaotic group chat. πŸ™ˆ
  • PM_ERR_NOTHOST β€” the current PMAPI context is an archive rather than a host, or it is a host that is not set to the current time, i.e. has been ``rewound'' to the recent past using pmSetMode(3) or pmSetModeHighRes(3). the past is the past, we don't edit it. βͺ
  • PM_ERR_TOOSMALL β€” the number of metrics specified in result is less than one. like. zero metrics. what are we even doing here. πŸ’€
  • PM_ERR_VALUE β€” one or more of the pmValueSets in result has a numval field with a value less than one. (told you it was a rule πŸ’…)

🫢 SEE ALSO 🫢

PMAPI(3), pmFetch(3), pmFetchHighRes(3), pmSetModeHighRes(3) and pmSetMode(3). go read the girlies, they're all connected iykyk 🌸


sign-off time πŸŽ€

this whole thing came from Performance Co-Pilot (PCP), and yeah, the page is literally titled PMSTORE(3) β€” it's giving main character energy and honestly? deserved. πŸ‘‘πŸ’–

now go store something. responsibly. βœ¨πŸ¦‹πŸ’…

πŸ“¦ where this page comes from