9from pathlib
import Path
10from typing
import List
17MBLTML_DRIVER_VERSION_BUFFER_SIZE = 80
19MBLTML_ON_DEVICE_DRIVER_VERSION_BUFFER_SIZE = 80
21MBLTML_FIRMWARE_VERSION_BUFFER_SIZE = 80
23MBLTML_NODE_NAME_BUFFER_SIZE = 80
29mbltmlDriverType_t = c_uint
30MBLTML_DRIVER_ERROR = 0x0
31MBLTML_DRIVER_ARIES = 0x1
32MBLTML_DRIVER_REGULUS = 0x2
33MBLTML_DRIVER_REGULUS_USB = 0x4
36mbltmlTargetDeviceType_t = c_uint
37MBLTML_TARGET_DEVICE_ARIES_RA = 0x00000001
38MBLTML_TARGET_DEVICE_REGULUS_RA = 0x00000002
39MBLTML_TARGET_DEVICE_ARIES_RB = 0x00000003
40MBLTML_TARGET_DEVICE_REGULUS_RB = 0x00000004
41MBLTML_TARGET_DEVICE_REGULUS_RA_USB = 0x00000005
42MBLTML_TARGET_DEVICE_REGULUS_RB_USB = 0x00000006
43MBLTML_TARGET_DEVICE_ERROR = 0x7FFFFFFF
48mbltmlStatusCode_t = c_uint
50MBLTML_DRIVER_NOT_FOUND = 2
51MBLTML_INVALID_ARGUMENT = 3
52MBLTML_UNINITIALIZED = 1
53MBLTML_NOT_SUPPORTED = 4
54MBLTML_INSUFFICIENT_LENGTH = 5
55MBLTML_DEVICE_NOT_FOUND = 6
61mbltmlExtraPmicId_t = c_uint
62MBLTML_EXTRA_PMIC_ID_NPU = 0
63MBLTML_EXTRA_PMIC_ID_DDR = 1
64MBLTML_EXTRA_PMIC_ID_PMIC = 2
65MBLTML_EXTRA_PMIC_ID_GOLDFINGER = 3
68mbltmlCluster_t = c_uint
69MBLTML_CLUSTER_0 = 0x00010000
70MBLTML_CLUSTER_1 = 0x00020000
71MBLTML_CLUSTER_ERROR = 0x7FFF0000
79MBLTML_CORE_GLOBAL = 0x0000FFFE
80MBLTML_CORE_ERROR = 0x0000FFFF
85 """@brief Composite identifier of an NPU core (cluster + core).
87 @var cluster Cluster to which the core belongs (mbltmlCluster_t).
88 @var core Core within the cluster (mbltmlCore_t).
91 cluster: mbltmlCluster_t
94 (
"cluster", mbltmlCluster_t),
95 (
"core", mbltmlCore_t),
99 d = {
"cluster": self.cluster,
"core": self.core}
100 return "{}({})".format(
101 self.__class__.__name__,
102 ", ".join(
"{}={}".format(k, v)
for k, v
in d.items()),
107 """@brief Per-core usage record returned by mbltmlGetCoreInfos().
109 Utilization for the core can be computed as @c npu_time / @c interval
110 when @c interval is non-zero.
112 @var core_id Identifier of the core (mbltmlCoreId_t).
113 @var npu_time Accumulated NPU active time on the core, in microseconds.
114 @var interval Sampling interval covered by @c npu_time, in microseconds.
117 core_id: mbltmlCoreId_t
121 (
"core_id", mbltmlCoreId_t),
122 (
"npu_time", c_int64),
123 (
"interval", c_int64),
128 "core_id": self.core_id,
129 "npu_time": self.npu_time,
130 "interval": self.interval,
132 return "{}({})".format(
133 self.__class__.__name__,
134 ", ".join(
"{}={}".format(k, v)
for k, v
in d.items()),
139 """@brief Per-process usage record returned by mbltmlGetProcessInfos().
141 Utilization for the process can be computed as
142 @c total_npu_time_us / @c total_interval_us when @c total_interval_us
146 @var counts Number of NPU samples attributed to the process.
147 @var npu_memory_usage Device memory currently used by the process, in bytes.
148 @var total_interval_us Total sampling interval, in microseconds.
149 @var total_npu_time_us Total NPU active time used by the process, in microseconds.
154 npu_memory_usage: c_int64
155 total_interval_us: c_int64
156 total_npu_time_us: c_int64
160 (
"npu_memory_usage", c_int64),
161 (
"total_interval_us", c_int64),
162 (
"total_npu_time_us", c_int64),
168 "counts": self.counts,
169 "npu_memory_usage": self.npu_memory_usage,
170 "total_interval_us": self.total_interval_us,
171 "total_npu_time_us": self.total_npu_time_us,
173 return "{}({})".format(
174 self.__class__.__name__,
175 ", ".join(
"{}={}".format(k, v)
for k, v
in d.items()),
182def _loadLibrary() -> None:
186 lib_fname =
"mbltml.dll" if platform.system() ==
"Windows" else f
"libmbltml.so*"
187 pattern = os.path.join(Path(__file__).resolve().parent, lib_fname)
188 candidates = glob.glob(pattern)
190 raise FileNotFoundError(f
"No library matching {pattern}")
191 candidates.sort(key=len, reverse=
True)
192 _clib = CDLL(str(candidates[0]))
194 _clib.mbltmlInit.argtypes = []
195 _clib.mbltmlInit.restype = mbltmlStatusCode_t
196 _clib.mbltmlShutdown.argtypes = []
197 _clib.mbltmlShutdown.restype = mbltmlStatusCode_t
198 _clib.mbltmlGetDeviceCount.argtypes = [POINTER(c_uint)]
199 _clib.mbltmlGetDeviceCount.restype = mbltmlStatusCode_t
200 _clib.mbltmlGetTargetDeviceCount.argtypes = [
201 mbltmlTargetDeviceType_t,
204 _clib.mbltmlGetTargetDeviceCount.restype = mbltmlStatusCode_t
205 _clib.mbltmlGetDriverVersion.argtypes = [mbltmlDriverType_t, POINTER(c_char), c_int]
206 _clib.mbltmlGetDriverVersion.restype = mbltmlStatusCode_t
207 _clib.mbltmlGetDriverRevision.argtypes = [mbltmlDriverType_t, POINTER(c_uint)]
208 _clib.mbltmlGetDriverRevision.restype = mbltmlStatusCode_t
209 _clib.mbltmlGetNodeName.argtypes = [
210 mbltmlTargetDeviceType_t,
215 _clib.mbltmlGetNodeName.restype = mbltmlStatusCode_t
216 _clib.mbltmlGetDriverType.argtypes = [
217 mbltmlTargetDeviceType_t,
219 POINTER(mbltmlDriverType_t),
221 _clib.mbltmlGetDriverType.restype = mbltmlStatusCode_t
222 _clib.mbltmlGetOnDeviceDriverVersion.argtypes = [
223 mbltmlTargetDeviceType_t,
228 _clib.mbltmlGetOnDeviceDriverVersion.restype = mbltmlStatusCode_t
229 _clib.mbltmlGetOnDeviceDriverRevision.argtypes = [
230 mbltmlTargetDeviceType_t,
234 _clib.mbltmlGetOnDeviceDriverRevision.restype = mbltmlStatusCode_t
235 _clib.mbltmlGetFirmwareVersion.argtypes = [
236 mbltmlTargetDeviceType_t,
241 _clib.mbltmlGetFirmwareVersion.restype = mbltmlStatusCode_t
242 _clib.mbltmlGetFirmwareRevision.argtypes = [
243 mbltmlTargetDeviceType_t,
247 _clib.mbltmlGetFirmwareRevision.restype = mbltmlStatusCode_t
248 _clib.mbltmlGetFirmwareCRC.argtypes = [
249 mbltmlTargetDeviceType_t,
253 _clib.mbltmlGetFirmwareCRC.restype = mbltmlStatusCode_t
254 _clib.mbltmlGetTemperature.argtypes = [
255 mbltmlTargetDeviceType_t,
259 _clib.mbltmlGetTemperature.restype = mbltmlStatusCode_t
260 _clib.mbltmlGetSignalType.argtypes = [
261 mbltmlTargetDeviceType_t,
265 _clib.mbltmlGetSignalType.restype = mbltmlStatusCode_t
266 _clib.mbltmlGetNPUClock.argtypes = [
267 mbltmlTargetDeviceType_t,
271 _clib.mbltmlGetNPUClock.restype = mbltmlStatusCode_t
272 _clib.mbltmlGetBusClock.argtypes = [
273 mbltmlTargetDeviceType_t,
277 _clib.mbltmlGetBusClock.restype = mbltmlStatusCode_t
278 _clib.mbltmlGetFanDuty.argtypes = [mbltmlTargetDeviceType_t, c_int, POINTER(c_int)]
279 _clib.mbltmlGetFanDuty.restype = mbltmlStatusCode_t
280 _clib.mbltmlGetVendorId.argtypes = [
281 mbltmlTargetDeviceType_t,
285 _clib.mbltmlGetVendorId.restype = mbltmlStatusCode_t
286 _clib.mbltmlGetDeviceId.argtypes = [
287 mbltmlTargetDeviceType_t,
291 _clib.mbltmlGetDeviceId.restype = mbltmlStatusCode_t
292 _clib.mbltmlGetSubVendorId.argtypes = [
293 mbltmlTargetDeviceType_t,
297 _clib.mbltmlGetSubVendorId.restype = mbltmlStatusCode_t
298 _clib.mbltmlGetSubDeviceId.argtypes = [
299 mbltmlTargetDeviceType_t,
303 _clib.mbltmlGetSubDeviceId.restype = mbltmlStatusCode_t
304 _clib.mbltmlGetPcieGen.argtypes = [mbltmlTargetDeviceType_t, c_int, POINTER(c_uint)]
305 _clib.mbltmlGetPcieGen.restype = mbltmlStatusCode_t
306 _clib.mbltmlGetPcieLanes.argtypes = [
307 mbltmlTargetDeviceType_t,
311 _clib.mbltmlGetPcieLanes.restype = mbltmlStatusCode_t
312 _clib.mbltmlGetPcieRev.argtypes = [mbltmlTargetDeviceType_t, c_int, POINTER(c_uint)]
313 _clib.mbltmlGetPcieRev.restype = mbltmlStatusCode_t
314 _clib.mbltmlGetPcieClassCode.argtypes = [
315 mbltmlTargetDeviceType_t,
319 _clib.mbltmlGetPcieClassCode.restype = mbltmlStatusCode_t
320 _clib.mbltmlGetTotalPower.argtypes = [
321 mbltmlTargetDeviceType_t,
325 _clib.mbltmlGetTotalPower.restype = mbltmlStatusCode_t
326 _clib.mbltmlGetTotalCurrent.argtypes = [
327 mbltmlTargetDeviceType_t,
331 _clib.mbltmlGetTotalCurrent.restype = mbltmlStatusCode_t
332 _clib.mbltmlGetTotalVoltage.argtypes = [
333 mbltmlTargetDeviceType_t,
337 _clib.mbltmlGetTotalVoltage.restype = mbltmlStatusCode_t
338 _clib.mbltmlGetExtraPmicPower.argtypes = [
339 mbltmlTargetDeviceType_t,
343 _clib.mbltmlGetExtraPmicPower.restype = mbltmlStatusCode_t
344 _clib.mbltmlGetExtraPmicCurrent.argtypes = [
345 mbltmlTargetDeviceType_t,
349 _clib.mbltmlGetExtraPmicCurrent.restype = mbltmlStatusCode_t
350 _clib.mbltmlGetExtraPmicVoltage.argtypes = [
351 mbltmlTargetDeviceType_t,
355 _clib.mbltmlGetExtraPmicVoltage.restype = mbltmlStatusCode_t
356 _clib.mbltmlGetExtraPmicId.argtypes = [
357 mbltmlTargetDeviceType_t,
359 POINTER(mbltmlExtraPmicId_t),
361 _clib.mbltmlGetExtraPmicId.restype = mbltmlStatusCode_t
362 _clib.mbltmlGetTotalUtilization.argtypes = [
363 mbltmlTargetDeviceType_t,
367 _clib.mbltmlGetTotalUtilization.restype = mbltmlStatusCode_t
368 _clib.mbltmlGetMemoryUsage.argtypes = [
369 mbltmlTargetDeviceType_t,
373 _clib.mbltmlGetMemoryUsage.restype = mbltmlStatusCode_t
374 _clib.mbltmlGetMemoryTotal.argtypes = [
375 mbltmlTargetDeviceType_t,
379 _clib.mbltmlGetMemoryTotal.restype = mbltmlStatusCode_t
380 _clib.mbltmlGetProcessInfos.argtypes = [
381 mbltmlTargetDeviceType_t,
383 POINTER(mbltmlProcessInfo_t),
386 _clib.mbltmlGetProcessInfos.restype = mbltmlStatusCode_t
387 _clib.mbltmlGetCoreInfos.argtypes = [
388 mbltmlTargetDeviceType_t,
390 POINTER(mbltmlCoreInfo_t),
393 _clib.mbltmlGetCoreInfos.restype = mbltmlStatusCode_t
394 _clib.mbltmlSetExtraPmicID.argtypes = [
395 mbltmlTargetDeviceType_t,
399 _clib.mbltmlSetExtraPmicID.restype = mbltmlStatusCode_t
402class MBLTMLError(Exception):
403 """@brief Base exception raised by the mbltml Python binding.
405 Wraps a non-success mbltmlStatusCode_t returned by the underlying C
406 library. Instantiating MBLTMLError with a known status code yields the
407 matching subclass (e.g., MBLTMLInvalidArgumentError).
409 @var code The mbltmlStatusCode_t value associated with this exception.
413 _errcode_to_string = {
414 MBLTML_DRIVER_NOT_FOUND:
"Driver is not found",
415 MBLTML_INVALID_ARGUMENT:
"Invalid Argument",
416 MBLTML_UNINITIALIZED:
"Uninitilized mbltml.",
417 MBLTML_NOT_SUPPORTED:
"Unspported Function for Target Device",
418 MBLTML_INSUFFICIENT_LENGTH:
"Insufficient Length",
419 MBLTML_DEVICE_NOT_FOUND:
"Device is not found",
422 def __new__(cls, code: mbltmlStatusCode_t):
423 if cls
is MBLTMLError
and code
in MBLTMLError._code_to_class:
424 cls = MBLTMLError._code_to_class[code]
425 obj = Exception.__new__(cls)
430 return MBLTMLError._errcode_to_string[self.code]
432 def __eq__(self, other):
433 return self.code == other.code
437 """@brief Raised when the required driver cannot be located.
439 Wraps MBLTML_DRIVER_NOT_FOUND.
445class MBLTMLInvalidArgumentError(MBLTMLError):
446 """@brief Raised when one or more arguments are invalid.
448 Wraps MBLTML_INVALID_ARGUMENT. Typical causes include a NULL pointer or
449 a @c dev_no that is out of range of the target device type's device count.
456 """@brief Raised when an API is called before initialization.
458 Wraps MBLTML_UNINITIALIZED. Call mbltmlInit() first.
465 """@brief Raised when the feature is not supported on the target device.
467 Wraps MBLTML_NOT_SUPPORTED.
474 """@brief Raised when the output buffer is too small to hold the result.
476 Wraps MBLTML_INSUFFICIENT_LENGTH.
483 """@brief Raised when the requested device cannot be located.
485 Wraps MBLTML_DEVICE_NOT_FOUND.
491MBLTMLError._code_to_class = {
492 MBLTML_DRIVER_NOT_FOUND: MBLTMLDriverNotFoundError,
493 MBLTML_INVALID_ARGUMENT: MBLTMLInvalidArgumentError,
494 MBLTML_UNINITIALIZED: MBLTMLUninitializedError,
495 MBLTML_NOT_SUPPORTED: MBLTMLNotSupportedError,
496 MBLTML_INSUFFICIENT_LENGTH: MBLTMLInsufficientLengthError,
497 MBLTML_DEVICE_NOT_FOUND: MBLTMLDeviceNotFoundError,
501def _mbltmlThrowError(ret: mbltmlStatusCode_t) ->
None:
502 if ret != MBLTML_SUCCESS:
503 raise MBLTMLError(ret)
508 """@brief Initialize the mbltml library.
510 @throws MBLTMLError on failure.
513 ret = _clib.mbltmlInit()
514 _mbltmlThrowError(ret)
518 """@brief Release all resources held by the mbltml library.
520 After this call, any further API usage requires re-initialization via
523 @throws MBLTMLError on failure.
526 ret = _clib.mbltmlShutdown()
527 _mbltmlThrowError(ret)
531 """@brief Get the total number of devices detected by the library.
533 @note Supported on all driver types.
535 This returns the number of all detected devices regardless of their target
536 device type, including devices whose target device type could not be
539 @attention Do not confuse this with mbltmlGetTargetDeviceCount(). Since
540 unidentified devices are not addressable by any (target_device_type,
541 dev_no) pair, this count may exceed the sum over every
542 mbltmlTargetDeviceType_t.
544 @return The number of devices detected.
545 @throws MBLTMLError on failure.
549 ret = _clib.mbltmlGetDeviceCount(byref(value))
550 _mbltmlThrowError(ret)
555 """@brief Get the number of detected devices of a specific target device type.
557 @note Supported on all driver types.
559 @param target_device_type Target device type whose device count is queried.
560 @return The number of devices of @p target_device_type detected, or 0 if
562 @throws MBLTMLError on failure.
566 ret = _clib.mbltmlGetTargetDeviceCount(target_device_type, byref(value))
567 _mbltmlThrowError(ret)
572 """@brief Get the driver version string for a specific driver.
574 @note Supported on all driver types.
576 @param driver_type Driver type whose driver version is queried.
577 @return The driver version string.
578 @throws MBLTMLError on failure.
581 buf = create_string_buffer(MBLTML_DRIVER_VERSION_BUFFER_SIZE)
582 ret = _clib.mbltmlGetDriverVersion(
583 driver_type, buf, MBLTML_DRIVER_VERSION_BUFFER_SIZE
585 _mbltmlThrowError(ret)
586 return buf.value.decode()
590 """@brief Get the driver revision number for a specific driver.
592 @note Supported on all driver types.
594 @param driver_type Driver type whose driver revision is queried.
595 @return The driver revision number.
596 @throws MBLTMLError on failure.
600 ret = _clib.mbltmlGetDriverRevision(driver_type, byref(value))
601 _mbltmlThrowError(ret)
605def mbltmlGetNodeName(target_device_type: mbltmlTargetDeviceType_t, dev_no: int) -> str:
606 """@brief Get the node name of a device.
608 @note Supported on all driver types.
610 @param target_device_type Target device type of the device.
611 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
612 @return The node name string.
613 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
614 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
615 @throws MBLTMLError on other failures.
618 buf = create_string_buffer(MBLTML_NODE_NAME_BUFFER_SIZE)
619 ret = _clib.mbltmlGetNodeName(
620 target_device_type, dev_no, buf, MBLTML_NODE_NAME_BUFFER_SIZE
622 _mbltmlThrowError(ret)
623 return buf.value.decode()
627 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
628) -> mbltmlDriverType_t:
629 """@brief Get the driver type of a device.
631 @note Supported on all driver types.
633 @param target_device_type Target device type of the device.
634 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
635 @return The mbltmlDriverType_t of the device.
636 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
637 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
638 @throws MBLTMLError on other failures.
642 ret = _clib.mbltmlGetDriverType(target_device_type, dev_no, byref(value))
643 _mbltmlThrowError(ret)
648 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
650 """@brief Get the on-device driver version string of a device.
652 @note Supported on MBLTML_DRIVER_REGULUS_USB only.
654 @param target_device_type Target device type of the device.
655 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
656 @return The on-device driver version string.
657 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
658 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
659 @throws MBLTMLError on other failures.
662 buf = create_string_buffer(MBLTML_ON_DEVICE_DRIVER_VERSION_BUFFER_SIZE)
663 ret = _clib.mbltmlGetOnDeviceDriverVersion(
664 target_device_type, dev_no, buf, MBLTML_ON_DEVICE_DRIVER_VERSION_BUFFER_SIZE
666 _mbltmlThrowError(ret)
667 return buf.value.decode()
671 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
673 """@brief Get the on-device driver revision number of a device.
675 @note Supported on MBLTML_DRIVER_REGULUS_USB only.
677 @param target_device_type Target device type of the device.
678 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
679 @return The on-device driver revision.
680 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
681 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
682 @throws MBLTMLError on other failures.
686 ret = _clib.mbltmlGetOnDeviceDriverRevision(
687 target_device_type, dev_no, byref(value)
689 _mbltmlThrowError(ret)
694 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
696 """@brief Get the firmware version string of a device.
698 @note Supported on MBLTML_DRIVER_ARIES only.
700 @param target_device_type Target device type of the device.
701 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
702 @return The firmware version string.
703 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
704 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
705 @throws MBLTMLError on other failures.
708 buf = create_string_buffer(MBLTML_FIRMWARE_VERSION_BUFFER_SIZE)
709 ret = _clib.mbltmlGetFirmwareVersion(
710 target_device_type, dev_no, buf, MBLTML_FIRMWARE_VERSION_BUFFER_SIZE
712 _mbltmlThrowError(ret)
713 return buf.value.decode()
717 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
719 """@brief Get the firmware revision number of a device.
721 @note Supported on MBLTML_DRIVER_ARIES only.
723 @param target_device_type Target device type of the device.
724 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
725 @return The firmware revision.
726 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
727 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
728 @throws MBLTMLError on other failures.
732 ret = _clib.mbltmlGetFirmwareRevision(target_device_type, dev_no, byref(value))
733 _mbltmlThrowError(ret)
738 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
740 """@brief Get the CRC of the currently-loaded firmware image.
742 @note Supported on MBLTML_DRIVER_ARIES only.
744 @param target_device_type Target device type of the device.
745 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
746 @return The firmware CRC.
747 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
748 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
749 @throws MBLTMLError on other failures.
753 ret = _clib.mbltmlGetFirmwareCRC(target_device_type, dev_no, byref(value))
754 _mbltmlThrowError(ret)
759 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
761 """@brief Get the current die temperature of a device.
763 @note Supported on all driver types.
765 @param target_device_type Target device type of the device.
766 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
767 @return The temperature reading.
768 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
769 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
770 @throws MBLTMLError on other failures.
774 ret = _clib.mbltmlGetTemperature(target_device_type, dev_no, byref(value))
775 _mbltmlThrowError(ret)
780 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
782 """@brief Get the current signal-type indicator reported by the device.
784 @note Supported on all driver types.
786 @param target_device_type Target device type of the device.
787 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
788 @return The signal-type value.
789 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
790 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
791 @throws MBLTMLError on other failures.
795 ret = _clib.mbltmlGetSignalType(target_device_type, dev_no, byref(value))
796 _mbltmlThrowError(ret)
800def mbltmlGetNPUClock(target_device_type: mbltmlTargetDeviceType_t, dev_no: int) -> int:
801 """@brief Get the current NPU clock frequency of a device.
803 @note Supported on all driver types.
805 @param target_device_type Target device type of the device.
806 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
807 @return The NPU clock value.
808 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
809 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
810 @throws MBLTMLError on other failures.
814 ret = _clib.mbltmlGetNPUClock(target_device_type, dev_no, byref(value))
815 _mbltmlThrowError(ret)
819def mbltmlGetBusClock(target_device_type: mbltmlTargetDeviceType_t, dev_no: int) -> int:
820 """@brief Get the current bus clock frequency of a device.
822 @note Supported on MBLTML_DRIVER_ARIES only.
824 @param target_device_type Target device type of the device.
825 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
826 @return The bus clock value.
827 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
828 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
829 @throws MBLTMLError on other failures.
833 ret = _clib.mbltmlGetBusClock(target_device_type, dev_no, byref(value))
834 _mbltmlThrowError(ret)
838def mbltmlGetFanDuty(target_device_type: mbltmlTargetDeviceType_t, dev_no: int) -> int:
839 """@brief Get the current cooling-fan duty cycle of a device.
841 @note Supported on MBLTML_DRIVER_ARIES only.
843 @param target_device_type Target device type of the device.
844 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
845 @return The fan duty value.
846 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
847 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
848 @throws MBLTMLError on other failures.
852 ret = _clib.mbltmlGetFanDuty(target_device_type, dev_no, byref(value))
853 _mbltmlThrowError(ret)
857def mbltmlGetVendorId(target_device_type: mbltmlTargetDeviceType_t, dev_no: int) -> int:
858 """@brief Get the PCIe vendor ID of a device.
860 @note Supported on MBLTML_DRIVER_ARIES only.
862 @param target_device_type Target device type of the device.
863 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
864 @return The vendor ID.
865 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
866 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
867 @throws MBLTMLError on other failures.
871 ret = _clib.mbltmlGetVendorId(target_device_type, dev_no, byref(value))
872 _mbltmlThrowError(ret)
876def mbltmlGetDeviceId(target_device_type: mbltmlTargetDeviceType_t, dev_no: int) -> int:
877 """@brief Get the PCIe device ID of a device.
879 @note Supported on MBLTML_DRIVER_ARIES only.
881 @param target_device_type Target device type of the device.
882 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
883 @return The device ID.
884 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
885 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
886 @throws MBLTMLError on other failures.
890 ret = _clib.mbltmlGetDeviceId(target_device_type, dev_no, byref(value))
891 _mbltmlThrowError(ret)
896 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
898 """@brief Get the PCIe subsystem vendor ID of a device.
900 @note Supported on MBLTML_DRIVER_ARIES only.
902 @param target_device_type Target device type of the device.
903 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
904 @return The subsystem vendor ID.
905 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
906 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
907 @throws MBLTMLError on other failures.
911 ret = _clib.mbltmlGetSubVendorId(target_device_type, dev_no, byref(value))
912 _mbltmlThrowError(ret)
917 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
919 """@brief Get the PCIe subsystem device ID of a device.
921 @note Supported on MBLTML_DRIVER_ARIES only.
923 @param target_device_type Target device type of the device.
924 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
925 @return The subsystem device ID.
926 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
927 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
928 @throws MBLTMLError on other failures.
932 ret = _clib.mbltmlGetSubDeviceId(target_device_type, dev_no, byref(value))
933 _mbltmlThrowError(ret)
937def mbltmlGetPcieGen(target_device_type: mbltmlTargetDeviceType_t, dev_no: int) -> int:
938 """@brief Get the negotiated PCIe link generation of a device.
940 @note Supported on MBLTML_DRIVER_ARIES only.
942 @param target_device_type Target device type of the device.
943 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
944 @return The PCIe generation.
945 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
946 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
947 @throws MBLTMLError on other failures.
951 ret = _clib.mbltmlGetPcieGen(target_device_type, dev_no, byref(value))
952 _mbltmlThrowError(ret)
957 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
959 """@brief Get the negotiated PCIe link width (in lanes) of a device.
961 @note Supported on MBLTML_DRIVER_ARIES only.
963 @param target_device_type Target device type of the device.
964 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
965 @return The lane count.
966 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
967 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
968 @throws MBLTMLError on other failures.
972 ret = _clib.mbltmlGetPcieLanes(target_device_type, dev_no, byref(value))
973 _mbltmlThrowError(ret)
977def mbltmlGetPcieRev(target_device_type: mbltmlTargetDeviceType_t, dev_no: int) -> int:
978 """@brief Get the PCIe configuration-space revision ID of a device.
980 @note Supported on MBLTML_DRIVER_ARIES only.
982 @param target_device_type Target device type of the device.
983 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
984 @return The revision value.
985 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
986 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
987 @throws MBLTMLError on other failures.
991 ret = _clib.mbltmlGetPcieRev(target_device_type, dev_no, byref(value))
992 _mbltmlThrowError(ret)
997 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
999 """@brief Get the PCIe configuration-space class code of a device.
1001 @note Supported on MBLTML_DRIVER_ARIES only.
1003 @param target_device_type Target device type of the device.
1004 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1005 @return The class code.
1006 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1007 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1008 @throws MBLTMLError on other failures.
1012 ret = _clib.mbltmlGetPcieClassCode(target_device_type, dev_no, byref(value))
1013 _mbltmlThrowError(ret)
1018 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1020 """@brief Get the total instantaneous power consumption of a device (W).
1022 @note Supported on MBLTML_DRIVER_ARIES only.
1024 @param target_device_type Target device type of the device.
1025 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1026 @return The power reading.
1027 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1028 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1029 @throws MBLTMLError on other failures.
1033 ret = _clib.mbltmlGetTotalPower(target_device_type, dev_no, byref(value))
1034 _mbltmlThrowError(ret)
1039 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1041 """@brief Get the total instantaneous current draw of a device (A).
1043 @note Supported on MBLTML_DRIVER_ARIES only.
1045 @param target_device_type Target device type of the device.
1046 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1047 @return The current reading.
1048 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1049 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1050 @throws MBLTMLError on other failures.
1054 ret = _clib.mbltmlGetTotalCurrent(target_device_type, dev_no, byref(value))
1055 _mbltmlThrowError(ret)
1060 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1062 """@brief Get the total instantaneous supply voltage of a device (V).
1064 @note Supported on MBLTML_DRIVER_ARIES only.
1066 @param target_device_type Target device type of the device.
1067 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1068 @return The voltage reading.
1069 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1070 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1071 @throws MBLTMLError on other failures.
1075 ret = _clib.mbltmlGetTotalVoltage(target_device_type, dev_no, byref(value))
1076 _mbltmlThrowError(ret)
1081 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1083 """@brief Get the power consumption of the extra PMIC rail currently
1084 selected for the device (W).
1086 @note Supported on MBLTML_DRIVER_ARIES only.
1088 The selected rail is controlled by mbltmlSetExtraPmicID() and can be
1089 queried via mbltmlGetExtraPmicId().
1091 The firmware refreshes this reading once per second. After changing the
1092 selected rail with mbltmlSetExtraPmicID(), allow up to 1 second for the
1093 new rail's value to be reported.
1095 @param target_device_type Target device type of the device.
1096 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1097 @return The power reading.
1098 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1099 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1100 @throws MBLTMLError on other failures.
1104 ret = _clib.mbltmlGetExtraPmicPower(target_device_type, dev_no, byref(value))
1105 _mbltmlThrowError(ret)
1110 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1112 """@brief Get the current of the extra PMIC rail currently selected
1115 @note Supported on MBLTML_DRIVER_ARIES only.
1117 The firmware refreshes this reading once per second. After changing the
1118 selected rail with mbltmlSetExtraPmicID(), allow up to 1 second for the
1119 new rail's value to be reported.
1121 @param target_device_type Target device type of the device.
1122 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1123 @return The current reading.
1124 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1125 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1126 @throws MBLTMLError on other failures.
1130 ret = _clib.mbltmlGetExtraPmicCurrent(target_device_type, dev_no, byref(value))
1131 _mbltmlThrowError(ret)
1136 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1138 """@brief Get the voltage of the extra PMIC rail currently selected
1141 @note Supported on MBLTML_DRIVER_ARIES only.
1143 The firmware refreshes this reading once per second. After changing the
1144 selected rail with mbltmlSetExtraPmicID(), allow up to 1 second for the
1145 new rail's value to be reported.
1147 @param target_device_type Target device type of the device.
1148 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1149 @return The voltage reading.
1150 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1151 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1152 @throws MBLTMLError on other failures.
1156 ret = _clib.mbltmlGetExtraPmicVoltage(target_device_type, dev_no, byref(value))
1157 _mbltmlThrowError(ret)
1162 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1163) -> mbltmlExtraPmicId_t:
1164 """@brief Get the extra PMIC rail currently selected for the device.
1166 @note Supported on MBLTML_DRIVER_ARIES only.
1168 @param target_device_type Target device type of the device.
1169 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1170 @return The selected mbltmlExtraPmicId_t value.
1171 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1172 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1173 @throws MBLTMLError on other failures.
1177 ret = _clib.mbltmlGetExtraPmicId(target_device_type, dev_no, byref(value))
1178 _mbltmlThrowError(ret)
1183 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1185 """@brief Get the overall NPU utilization of a device.
1187 @note Supported on all driver types.
1189 @param target_device_type Target device type of the device.
1190 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1191 @return The utilization value (typically a ratio in [0.0, 1.0] or a percentage).
1192 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1193 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1194 @throws MBLTMLError on other failures.
1198 ret = _clib.mbltmlGetTotalUtilization(target_device_type, dev_no, byref(value))
1199 _mbltmlThrowError(ret)
1204 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1206 """@brief Get the amount of device memory currently in use.
1208 @note Supported on all driver types.
1210 @param target_device_type Target device type of the device.
1211 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1212 @return The in-use memory in bytes.
1213 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1214 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1215 @throws MBLTMLError on other failures.
1219 ret = _clib.mbltmlGetMemoryUsage(target_device_type, dev_no, byref(value))
1220 _mbltmlThrowError(ret)
1225 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1227 """@brief Get the total amount of device memory available.
1229 @note Supported on all driver types.
1231 @param target_device_type Target device type of the device.
1232 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1233 @return The total memory in bytes.
1234 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1235 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1236 @throws MBLTMLError on other failures.
1240 ret = _clib.mbltmlGetMemoryTotal(target_device_type, dev_no, byref(value))
1241 _mbltmlThrowError(ret)
1246 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1247) -> List[mbltmlProcessInfo_t]:
1248 """@brief Get per-process usage information for a device.
1250 @note Supported on all driver types.
1252 @param target_device_type Target device type of the device.
1253 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1254 @return List of mbltmlProcessInfo_t records; empty if no process is running.
1255 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1256 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1257 @throws MBLTMLError on other failures.
1261 ret = _clib.mbltmlGetProcessInfos(target_device_type, dev_no,
None, byref(c_count))
1262 _mbltmlThrowError(ret)
1263 if c_count.value == 0:
1265 c_count.value = c_count.value * 2
1266 info_array = mbltmlProcessInfo_t * c_count.value
1267 infos = info_array()
1268 ret = _clib.mbltmlGetProcessInfos(target_device_type, dev_no, infos, byref(c_count))
1269 _mbltmlThrowError(ret)
1270 return [infos[i]
for i
in range(c_count.value)]
1274 target_device_type: mbltmlTargetDeviceType_t, dev_no: int
1275) -> List[mbltmlCoreInfo_t]:
1276 """@brief Get per-core usage information for a device.
1278 @note Supported on all driver types.
1280 @param target_device_type Target device type of the device.
1281 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1282 @return List of mbltmlCoreInfo_t records.
1283 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1284 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1285 @throws MBLTMLError on other failures.
1289 ret = _clib.mbltmlGetCoreInfos(target_device_type, dev_no,
None, byref(c_count))
1290 _mbltmlThrowError(ret)
1291 if c_count.value == 0:
1293 c_count.value = c_count.value
1294 info_array = mbltmlCoreInfo_t * c_count.value
1295 infos = info_array()
1296 ret = _clib.mbltmlGetCoreInfos(target_device_type, dev_no, infos, byref(c_count))
1297 _mbltmlThrowError(ret)
1298 return [infos[i]
for i
in range(c_count.value)]
1302 target_device_type: mbltmlTargetDeviceType_t,
1304 pmic_id: mbltmlExtraPmicId_t,
1306 """@brief Select which extra PMIC rail subsequent mbltmlGetExtraPmic*() queries refer to.
1308 @note Supported on aries-rb device (MBLTML_TARGET_DEVICE_ARIES_RB) only.
1310 The underlying readings are refreshed by firmware once per second; allow
1311 up to 1 second after this call before mbltmlGetExtraPmicPower(),
1312 mbltmlGetExtraPmicCurrent() and mbltmlGetExtraPmicVoltage() reflect the
1313 newly selected rail.
1315 @param target_device_type Target device type of the device.
1316 @param dev_no Device index within @p target_device_type. Device count is obtained via mbltmlGetTargetDeviceCount().
1317 @param pmic_id Identifier of the extra PMIC rail to select.
1318 @throws MBLTMLInvalidArgumentError if @p dev_no is out of range of the @p target_device_type device count.
1319 @throws MBLTMLDeviceNotFoundError if no device of @p target_device_type is detected.
1320 @throws MBLTMLError on other failures.
1323 ret = _clib.mbltmlSetExtraPmicID(target_device_type, dev_no, pmic_id)
1324 _mbltmlThrowError(ret)
Raised when the requested device cannot be located.
Raised when the required driver cannot be located.
Raised when the output buffer is too small to hold the result.
Raised when the feature is not supported on the target device.
Raised when an API is called before initialization.
None mbltmlShutdown()
Release all resources held by the mbltml library.
int mbltmlGetVendorId(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the PCIe vendor ID of a device.
int mbltmlGetFirmwareCRC(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the CRC of the currently-loaded firmware image.
List[mbltmlProcessInfo_t] mbltmlGetProcessInfos(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get per-process usage information for a device.
int mbltmlGetTemperature(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the current die temperature of a device.
List[mbltmlCoreInfo_t] mbltmlGetCoreInfos(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get per-core usage information for a device.
int mbltmlGetPcieGen(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the negotiated PCIe link generation of a device.
int mbltmlGetNPUClock(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the current NPU clock frequency of a device.
int mbltmlGetTargetDeviceCount(mbltmlTargetDeviceType_t target_device_type)
Get the number of detected devices of a specific target device type.
float mbltmlGetExtraPmicCurrent(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the current of the extra PMIC rail currently selected for the device (A).
int mbltmlGetFanDuty(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the current cooling-fan duty cycle of a device.
float mbltmlGetTotalUtilization(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the overall NPU utilization of a device.
int mbltmlGetSubDeviceId(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the PCIe subsystem device ID of a device.
int mbltmlGetMemoryUsage(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the amount of device memory currently in use.
int mbltmlGetFirmwareRevision(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the firmware revision number of a device.
int mbltmlGetBusClock(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the current bus clock frequency of a device.
float mbltmlGetExtraPmicVoltage(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the voltage of the extra PMIC rail currently selected for the device (V).
float mbltmlGetTotalCurrent(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the total instantaneous current draw of a device (A).
float mbltmlGetTotalPower(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the total instantaneous power consumption of a device (W).
mbltmlDriverType_t mbltmlGetDriverType(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the driver type of a device.
int mbltmlGetOnDeviceDriverRevision(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the on-device driver revision number of a device.
int mbltmlGetSignalType(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the current signal-type indicator reported by the device.
float mbltmlGetTotalVoltage(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the total instantaneous supply voltage of a device (V).
str mbltmlGetDriverVersion(mbltmlDriverType_t driver_type)
Get the driver version string for a specific driver.
str mbltmlGetNodeName(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the node name of a device.
str mbltmlGetFirmwareVersion(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the firmware version string of a device.
str mbltmlGetOnDeviceDriverVersion(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the on-device driver version string of a device.
int mbltmlGetPcieRev(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the PCIe configuration-space revision ID of a device.
int mbltmlGetSubVendorId(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the PCIe subsystem vendor ID of a device.
None mbltmlSetExtraPmicID(mbltmlTargetDeviceType_t target_device_type, int dev_no, mbltmlExtraPmicId_t pmic_id)
Select which extra PMIC rail subsequent mbltmlGetExtraPmic*() queries refer to.
int mbltmlGetMemoryTotal(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the total amount of device memory available.
mbltmlExtraPmicId_t mbltmlGetExtraPmicId(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the extra PMIC rail currently selected for the device.
int mbltmlGetDeviceId(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the PCIe device ID of a device.
int mbltmlGetPcieLanes(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the negotiated PCIe link width (in lanes) of a device.
int mbltmlGetDriverRevision(mbltmlDriverType_t driver_type)
Get the driver revision number for a specific driver.
int mbltmlGetDeviceCount()
Get the total number of devices detected by the library.
None mbltmlInit()
Initialize the mbltml library.
int mbltmlGetPcieClassCode(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the PCIe configuration-space class code of a device.
float mbltmlGetExtraPmicPower(mbltmlTargetDeviceType_t target_device_type, int dev_no)
Get the power consumption of the extra PMIC rail currently selected for the device (W).
Composite identifier of an NPU core (cluster + core).
Per-core usage record returned by mbltmlGetCoreInfos().
Per-process usage record returned by mbltmlGetProcessInfos().