Coverage for cuda / core / system / _utilization.pxi: 100.00%
3 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-29 01:27 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-29 01:27 +0000
1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2#
3# SPDX-License-Identifier: Apache-2.0
6cdef class Utilization:
7 """
8 Utilization rates for a device.
10 For devices with compute capability 2.0 or higher.
11 """
12 cdef object _utilization
14 def __init__(self, utilization: nvml.Utilization):
15 self._utilization = utilization 1a
17 @property
18 def gpu(self) -> int:
19 """
20 Percent of time over the past sample period during which one or more kernels was executing on the GPU.
21 """
22 return self._utilization.gpu 1a
24 @property
25 def memory(self) -> int:
26 """
27 Percent of time over the past sample period during which global (device) memory was being read or written.
28 """
29 return self._utilization.memory 1a