---
name: "pmc_stop"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/pmc_start"
---

# pmc\_stop(3)

start and stop a PMC

Part of [pmc\_start(3)](/pmc_start/3.md).

## NAME

**pmc\_start**, **pmc\_stop** – start and stop a PMC

## LIBRARY

library “libpmc”

## SYNOPSIS

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

*int*\

**pmc\_start**(*pmc\_id\_t pmc*);

*int*\

**pmc\_stop**(*pmc\_id\_t pmc*);

## DESCRIPTION

These functions are used to start and stop a PMC.

Function **pmc\_start**() starts the PMC specified by argument *pmc*. If the specified PMC has process scope and has not been attached to any targets, it will be attached to the current process.

Function **pmc\_stop**() stops the PMC specified by argument *pmc*.

## RETURN VALUES

The **pmc\_start()** function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

## ERRORS

A call to these functions may fail with the following errors:

- \[EDOOFUS\]

  Function **pmc\_start**() specified a PMC that requires a log file and no log file was configured.

- \[EINVAL\]

  The specified PMC is in the process of being deleted.

- \[EINVAL\]

  Function **pmc\_stop**() specified a PMC that was never started.

- \[ENXIO\]

  The specified PMC had system scope and its associated CPU was disabled or absent.

## SEE ALSO

[pmc(3)](/pmc/3.md), [hwpmc(4)](/hwpmc/4.md)
