Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2026.1

# MonItems - between real-time counters and storage

The MonItems class is the bridge between the counters and the storage.

The MemItems class either maps the contents of an existing memory-mapped file into MonItem objects or maps registered MonItem objects into a new or existing memory-mapped file.

If you want to write a utility that accesses the counters and reads their values, see the example that exports the counters in a manner compatible with Prometheus real-time monitoring, `p4mon-prometheus-exporter.cc`, which is located inside `the Perforce filehost location for p4source.tgz`

For more information, see p4 monitor realtime in P4 CLI Reference.

Constructor
`MonItems()`

Methods
`bool Load(const char *file, Error *e)` Loads an existing memory mapped file, registering the `MonItem` objects in the file
`void Display()` Dumps all the registered `MonItem` objects to STDOUT
`MonItem *First()` Returns the first registered `MonItem` object. Use with `Next(MonItem *counter)` to iterate over `MonItem` objects
`MonItem *Next(MonItem *counter)` Returns the next registered `MonItem` object. Use with `First()` to iterate over `MonItem` objects

Your search for returned results