api.h Source File

api.h Source File#

mbltml: api.h Source File
mbltml Test Preview
mbltml — EN
api.h
Go to the documentation of this file.
1// Copyright ⓒ 2019- Mobilint Inc. All rights reserved.
5
6#ifndef MOBILINT_MBLTML_API_H_
7#define MOBILINT_MBLTML_API_H_
8
9#include <string>
10#include <unordered_set>
11#include <vector>
12
13#include "mbltml/export.h"
14#include "mbltml/type.h"
15
16namespace mobilint {
21
22// Initialization / CleanUp APIs
23
35
45MBLTML_EXPORT mbltmlStatusCode_t
46mbltmlInitDevices(const std::unordered_set<mbltmlDeviceType_t>& device_types);
47
58
59// System-Wide Monitor APIs
60
71
82MBLTML_EXPORT std::string mbltmlGetDriverVersion(mbltmlDeviceType_t dt,
84
97
98// Device-Wise Monitor APIs
99
112MBLTML_EXPORT std::string mbltmlGetNodeName(int dev_no, mbltmlStatusCode_t& sc);
113
128
144
158MBLTML_EXPORT std::string mbltmlGetFirmwareVersion(int dev_no, mbltmlStatusCode_t& sc);
159
172MBLTML_EXPORT int mbltmlGetFirmwareRevision(int dev_no, mbltmlStatusCode_t& sc);
173
186MBLTML_EXPORT int mbltmlGetFirmwareCRC(int dev_no, mbltmlStatusCode_t& sc);
187
200MBLTML_EXPORT int mbltmlGetTemperature(int dev_no, mbltmlStatusCode_t& sc);
201
214MBLTML_EXPORT int mbltmlGetSignalType(int dev_no, mbltmlStatusCode_t& sc);
215
228MBLTML_EXPORT int mbltmlGetNPUClock(int dev_no, mbltmlStatusCode_t& sc);
229
242MBLTML_EXPORT int mbltmlGetBusClock(int dev_no, mbltmlStatusCode_t& sc);
243
256MBLTML_EXPORT int mbltmlGetFanDuty(int dev_no, mbltmlStatusCode_t& sc);
257
270MBLTML_EXPORT int mbltmlGetVendorId(int dev_no, mbltmlStatusCode_t& sc);
271
284MBLTML_EXPORT int mbltmlGetDeviceId(int dev_no, mbltmlStatusCode_t& sc);
285
298MBLTML_EXPORT int mbltmlGetSubVendorId(int dev_no, mbltmlStatusCode_t& sc);
299
312MBLTML_EXPORT int mbltmlGetSubDeviceId(int dev_no, mbltmlStatusCode_t& sc);
313
326MBLTML_EXPORT int mbltmlGetPcieGen(int dev_no, mbltmlStatusCode_t& sc);
327
340MBLTML_EXPORT int mbltmlGetPcieLanes(int dev_no, mbltmlStatusCode_t& sc);
341
354MBLTML_EXPORT int mbltmlGetPcieRev(int dev_no, mbltmlStatusCode_t& sc);
355
368MBLTML_EXPORT int mbltmlGetPcieClassCode(int dev_no, mbltmlStatusCode_t& sc);
369
382MBLTML_EXPORT double mbltmlGetTotalPower(int dev_no, mbltmlStatusCode_t& sc);
383
396MBLTML_EXPORT double mbltmlGetTotalCurrent(int dev_no, mbltmlStatusCode_t& sc);
397
410MBLTML_EXPORT double mbltmlGetTotalVoltage(int dev_no, mbltmlStatusCode_t& sc);
411
432MBLTML_EXPORT double mbltmlGetExtraPmicPower(int dev_no, mbltmlStatusCode_t& sc);
433
451MBLTML_EXPORT double mbltmlGetExtraPmicCurrent(int dev_no, mbltmlStatusCode_t& sc);
452
470MBLTML_EXPORT double mbltmlGetExtraPmicVoltage(int dev_no, mbltmlStatusCode_t& sc);
471
487
501MBLTML_EXPORT double mbltmlGetTotalUtilization(int dev_no, mbltmlStatusCode_t& sc);
502
515MBLTML_EXPORT int64_t mbltmlGetMemoryUsage(int dev_no, mbltmlStatusCode_t& sc);
516
529MBLTML_EXPORT int64_t mbltmlGetMemoryTotal(int dev_no, mbltmlStatusCode_t& sc);
530
544MBLTML_EXPORT std::vector<mbltmlProcessInfo_t> mbltmlGetProcessInfos(
545 int dev_no, mbltmlStatusCode_t& sc);
546
559MBLTML_EXPORT std::vector<mbltmlCoreInfo_t> mbltmlGetCoreInfos(int dev_no,
561
562// Device-Wise Control APIs
563
583 mbltmlExtraPmicId_t pmic_id);
584
586
587} // namespace mobilint
588
589#endif // MOBILINT_MBLTML_API_H_
MBLTML_EXPORT int mbltmlGetSubDeviceId(int dev_no, mbltmlStatusCode_t &sc)
Get the PCIe subsystem device ID of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlInit()
Initialize the mbltml library for all supported device types.
MBLTML_EXPORT std::vector< mbltmlProcessInfo_t > mbltmlGetProcessInfos(int dev_no, mbltmlStatusCode_t &sc)
Get per-process usage information for a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlSetExtraPmicID(int dev_no, mbltmlExtraPmicId_t pmic_id)
Select which extra PMIC rail subsequent mbltmlGetExtraPmic*() queries refer to.
MBLTML_EXPORT int mbltmlGetFanDuty(int dev_no, mbltmlStatusCode_t &sc)
Get the current cooling-fan duty cycle of a device.
MBLTML_EXPORT int mbltmlGetFirmwareCRC(int dev_no, mbltmlStatusCode_t &sc)
Get the CRC of the currently-loaded firmware image.
MBLTML_EXPORT double mbltmlGetTotalUtilization(int dev_no, mbltmlStatusCode_t &sc)
Get the overall NPU utilization of a device.
MBLTML_EXPORT mbltmlExtraPmicId_t mbltmlGetExtraPmicId(int dev_no, mbltmlStatusCode_t &sc)
Get the extra PMIC rail currently selected for the device.
MBLTML_EXPORT double mbltmlGetTotalCurrent(int dev_no, mbltmlStatusCode_t &sc)
Get the total instantaneous current draw of a device (A).
MBLTML_EXPORT mbltmlStatusCode_t mbltmlShutdown()
Release all resources held by the mbltml library.
MBLTML_EXPORT int mbltmlGetBusClock(int dev_no, mbltmlStatusCode_t &sc)
Get the current bus clock frequency of a device.
MBLTML_EXPORT double mbltmlGetExtraPmicVoltage(int dev_no, mbltmlStatusCode_t &sc)
Get the voltage of the extra PMIC rail currently selected for the device (V).
MBLTML_EXPORT int mbltmlGetPcieGen(int dev_no, mbltmlStatusCode_t &sc)
Get the negotiated PCIe link generation of a device.
MBLTML_EXPORT int mbltmlGetPcieClassCode(int dev_no, mbltmlStatusCode_t &sc)
Get the PCIe configuration-space class code of a device.
MBLTML_EXPORT std::string mbltmlGetNodeName(int dev_no, mbltmlStatusCode_t &sc)
Get the node name of a device.
mbltmlDeviceType_t
Identifier of a Mobilint NPU device family.
Definition type.h:25
MBLTML_EXPORT int mbltmlGetPcieLanes(int dev_no, mbltmlStatusCode_t &sc)
Get the negotiated PCIe link width (in lanes) of a device.
MBLTML_EXPORT int mbltmlGetDeviceCount(mbltmlStatusCode_t &sc)
Get the total number of devices detected by the library.
MBLTML_EXPORT std::vector< mbltmlCoreInfo_t > mbltmlGetCoreInfos(int dev_no, mbltmlStatusCode_t &sc)
Get per-core usage information for a device.
MBLTML_EXPORT int mbltmlGetSignalType(int dev_no, mbltmlStatusCode_t &sc)
Get the current signal-type indicator reported by the device.
mbltmlStatusCode_t
Status code returned by mbltml APIs.
Definition type.h:46
mbltmlHardwareVersion_t
Specific hardware revision of a Mobilint NPU.
Definition type.h:35
MBLTML_EXPORT int mbltmlGetSubVendorId(int dev_no, mbltmlStatusCode_t &sc)
Get the PCIe subsystem vendor ID of a device.
MBLTML_EXPORT int mbltmlGetDeviceId(int dev_no, mbltmlStatusCode_t &sc)
Get the PCIe device ID of a device.
MBLTML_EXPORT double mbltmlGetTotalPower(int dev_no, mbltmlStatusCode_t &sc)
Get the total instantaneous power consumption of a device (W).
mbltmlExtraPmicId_t
Identifier of an extra PMIC rail.
Definition type.h:62
MBLTML_EXPORT int64_t mbltmlGetMemoryTotal(int dev_no, mbltmlStatusCode_t &sc)
Get the total amount of device memory available.
MBLTML_EXPORT int mbltmlGetFirmwareRevision(int dev_no, mbltmlStatusCode_t &sc)
Get the firmware revision number of a device.
MBLTML_EXPORT double mbltmlGetExtraPmicCurrent(int dev_no, mbltmlStatusCode_t &sc)
Get the current of the extra PMIC rail currently selected for the device (A).
MBLTML_EXPORT std::string mbltmlGetDriverVersion(mbltmlDeviceType_t dt, mbltmlStatusCode_t &sc)
Get the driver version string for a specific device family.
MBLTML_EXPORT int mbltmlGetTemperature(int dev_no, mbltmlStatusCode_t &sc)
Get the current die temperature of a device.
MBLTML_EXPORT uint32_t mbltmlGetDriverRevision(mbltmlDeviceType_t dt, mbltmlStatusCode_t &sc)
Get the driver revision number for a specific device family.
MBLTML_EXPORT mbltmlHardwareVersion_t mbltmlGetHardwareVersion(int dev_no, mbltmlStatusCode_t &sc)
Get the hardware version of a device.
MBLTML_EXPORT int mbltmlGetVendorId(int dev_no, mbltmlStatusCode_t &sc)
Get the PCIe vendor ID of a device.
MBLTML_EXPORT int mbltmlGetPcieRev(int dev_no, mbltmlStatusCode_t &sc)
Get the PCIe configuration-space revision ID of a device.
MBLTML_EXPORT std::string mbltmlGetFirmwareVersion(int dev_no, mbltmlStatusCode_t &sc)
Get the firmware version string of a device.
MBLTML_EXPORT mbltmlDeviceType_t mbltmlGetDeviceType(int dev_no, mbltmlStatusCode_t &sc)
Get the device family type of a device.
MBLTML_EXPORT double mbltmlGetExtraPmicPower(int dev_no, mbltmlStatusCode_t &sc)
Get the power consumption of the extra PMIC rail currently selected for the device (W).
MBLTML_EXPORT int64_t mbltmlGetMemoryUsage(int dev_no, mbltmlStatusCode_t &sc)
Get the amount of device memory currently in use.
MBLTML_EXPORT int mbltmlGetNPUClock(int dev_no, mbltmlStatusCode_t &sc)
Get the current NPU clock frequency of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlInitDevices(const std::unordered_set< mbltmlDeviceType_t > &device_types)
Initialize the mbltml library for a selected set of device types.
MBLTML_EXPORT double mbltmlGetTotalVoltage(int dev_no, mbltmlStatusCode_t &sc)
Get the total instantaneous supply voltage of a device (V).