PMSORTINSTANCES(3)

πŸ“¦
version 7.2.2 Β· 4 versions
, in arch rolling, centos-stream 10, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

πŸ’– PMSORTINSTANCES πŸ’–

okay bestie, so this one lives in the Library Functions Manual (that's the 3 in pmSortInstances(3), iykyk) and it's genuinely the glow-up your metric results have been waiting for ✨


🌸 NAME 🌸

pmSortInstances β€” sort performance metric values on instance identifier

like... it puts the instances in order. that's the whole vibe. πŸŽ€


✨ C SYNOPSIS ✨

#include <pcp/pmapi.h>

void pmSortInstances(pmResult *result);

cc ... -lpcp

πŸ¦‹ DESCRIPTION πŸ¦‹

so the routine pmSortInstances is the one you call when you need to guarantee that, for each performance metric in the result that came back from pmFetch(3), the instances are chillin' in ascending instance identifier sequence. no chaos, no random ordering, just a nice tidy lineup πŸ’…

and why do we care? because this is lowkey essential when you're computing rates from two consecutive samples. the way that mismatched instance ordering will absolutely ruin your rate math... not on our watch. 🫢


πŸ‘‘ COMPATIBILITY πŸ‘‘

okay this part is the lore, and you need the lore bestie πŸ“œ

  • back prior to PCP 7.0, the timestamp field in the pmResult struct was a struct timeval. that's the old way.
  • to support the PMAPI transition, you can still use the old interface and its semantics if you recompile your apps with -DPMAPI_VERSION=2. yes, a compile flag, she's retro like that πŸ’Ύ
  • also, for a time in PCP 6.x, there was a routine with the same semantics as the current pmSortInstances, and it was called pmSortHighResInstances. and there was a struct with the same definition as the current pmResult struct, called pmResultHighRes.
⚠️ real talk: both of those are now deprecated, and compile-time support for pmSortHighResInstances and pmResultHighRes will be removed in a future release. so don't build anything new on them, okay? that's the tea πŸ’€

🌈 SEE ALSO 🌈

go read those, they're iconic, I promise πŸ“šβœ¨


Performance Co-Pilot Β· PCP Β· PMSORTINSTANCES(3) β€” mwah, that's the whole page, thanks for coming to my TED talk, stay sorted and stay slay πŸ’–πŸ§šπŸŒΈ

πŸ“¦ where this page comes from