---
name: "QmcSource"
section: "3"
platform: "linux"
package: "pcp"
version: "7.2.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/QmcSource"
---

# QmcSource(3)

manages contexts created by all groups

## NAME

**QmcSource**  - manages contexts created by all groups

## C++ SYNOPSIS

**#include \<QmcSource.h\>**

**c++ ... -lpcp\_qmc -lpcp**

## DESCRIPTION

The **QmcSource** class maintains a unique list of all metric sources in use to minimize the creation of new contexts (see [**pmNewContext**(3)](/pmNewContext/3.md)) when the context could have been duplicated (see [**pmDupContext**(3)](/pmDupContext/3.md)). This also reduces the duplication of descriptions of each source.

In general, **QMC** users should only need to access **QmcSource** methods to obtain source descriptions for a [**QmcContext**(3)](/QmcContext/3.md) object.  All context creation by the user should be handled through [**QmcGroup**(3)](/QmcGroup/3.md).

## DESTRUCTOR

- **~QmcSource();**

  Destructor.

## CONSTRUCTORS

- **static QmcSource\* getSource(int type, const char\* source,**

  **bool matchHosts)**

  This method will return a **QmcSource** object that represents a context of *type* to *source*. The **QmcSource** object may be a new object if the *source* has not been previously requested. Memory management of the **QmcSource** objects is handled by **QmcSource**. If all [**QmcContext**(3)](/QmcContext/3.md)s to the **QmcSource** have been deleted, the **QmcSource** object will also be deleted.

  The *matchHosts* flag controls the algorithm that is used to match hosts to archives. If *matchHosts* is equal to **false** then no attempt will be made by this method to match a host context to an existing source context. A **QmcSource** object will always be returned in this case, although the **QmcSource::status** method may indicate that a context to *source* failed.

  If *matchHosts* is equal to **true**, host contexts will be matched to a predefined archive source collected from that *source*. If no archive sources for the *source* have been previous specified, **getSource** will return a NULL pointer.

## DIAGNOSTICS

Error messages are generated using [**pmprintf**(3)](/pmprintf/3.md) but are not flushed. It is the responsibility of the user to call [**pmflush**(3)](/pmflush/3.md) to output any messages.

Additional diagnostics may be activated by adding the option **pmc** to the global debugging specification, as described in [**pmSetDebug**(3)](/pmSetDebug/3.md).

## SEE ALSO

[**PMAPI**(3)](/PMAPI/3.md), [**QMC**(3)](/QMC/3.md), [**QmcContext**(3)](/QmcContext/3.md), [**QmcGroup**(3)](/QmcGroup/3.md), [**pmDupContext**(3)](/pmDupContext/3.md), [**pmflush**(3)](/pmflush/3.md), [**pmNewContext**(3)](/pmNewContext/3.md) and [**pmprintf**(3)](/pmprintf/3.md).
