QMCCONTEXT(3)

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

πŸ’– QMCCONTEXT(3) πŸ’–

okay bestie, welcome to the QMCCONTEXT page β€” it lives in the Library Functions Manual and it's literally all about being the container for a PMAPI(3) context and all its lil metrics. 🫢


✨ NAME ✨

QmcContext β€” a container for a PMAPI(3) context and its metrics. periodt. πŸ’…


🌸 C++ SYNOPSIS 🌸

#include <QmcContext.h>

c++ ... -lpcp_qmc -lpcp

no cap, that's the whole vibe. 🌈


πŸ¦‹ DESCRIPTION πŸ¦‹

so a QmcContext object is a container for one single PMAPI(3) context. one. singular. main character energy, but only one of them. ✨

and it keeps a whole list of stuff that's using that context, so we don't end up making the same things over and over like some kind of chaos gremlin:

  • all the metric descriptors, aka QmcDesc
  • instance domains, aka QmcIndom
  • metrics, aka QmcMetric

the whole point is to minimize the duplication of these objects. it's giving organized. it's giving efficient. we love that for us. πŸŽ€


πŸ‘‘ CONSTRUCTORS πŸ‘‘

bestie listen β€” a QmcContext object should be constructed through the QmcGroup::use interface. that's the way. don't do it some other way. πŸ™ˆ

πŸ”₯ DESCRIPTOR LOOKUP πŸ”₯

okay so here's the tea: the metric and instance domain descriptors get cached by the QmcContext object. why? because we're not about to create duplicate QmcDesc(3) and QmcIndom(3) objects, and we're definitely not about to make extra PMAPI(3) calls just to build them again. 😀

also the mapping from metric names to pmIDs is maintained too, so we can dodge pmLookupName(3) calls entirely. iykyk. πŸ’…

  • int lookupDesc(const char *name, pmID& id); β€” searches for the metric name in the name list, then sets id to the pmID it already knows about. if it's not found, it hits up pmLookupName(3) to get that mapping. and if that call fails, it returns the PMAPI(3) error code. slay. ✨
  • int lookupDesc(const char *name, uint_t& desc, uint_t& indom); β€” finds the index desc and indom pointing at the QmcDesc object and the QmcIndom object for the metric name. then you can use those indexes with QmcContext::desc and QmcContext::indom to grab references to the actual objects. and if the metric descriptor or instance domain couldn't be obtained, it hands you back a PMAPI(3) error code. πŸ’œ
  • int lookupDesc(pmID pmid, uint_t& desc, uint_t& indom); β€” same deal but starting from the metric pmid instead of a name. finds the index desc and indom to the QmcDesc object and the QmcIndom object for that pmid, and those indexes work with QmcContext::desc and QmcContext::indom to get references to the real objects. returns a PMAPI(3) error code if the metric descriptor or instance domain couldn't be obtained. iconic. 🌟

😭 DIAGNOSTICS 😭

error messages get generated using pmprintf(3)... but ngl, they are not flushed. it is the responsibility of the user to call pmflush(3) to actually output any of those messages. so if you're sitting there like "where are my errors bestie" β€” that's on you. 🫠

you can also activate additional diagnostics by adding the options pmc and/or optfetch to the global debugging specification, as described in pmSetDebug(3). go off. πŸ”


🌈 SEE ALSO 🌈

PMAPI(3), QMC(3), QmcDesc(3), QmcGroup(3), QmcIndom(3), QmcMetric(3), pmflush(3), pmLookupName(3) and pmprintf(3).


and that's the whole page, bestie!! πŸ’–βœ¨ this came from the Performance Co-Pilot era over at SGI, and yeah it's literally titled QMCCONTEXT(3) β€” go forth and cache responsibly. πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from