---
title: "hv_vcpu_get_exec_time(_:_:)"
framework: hypervisor
role: symbol
role_heading: Function
path: "hypervisor/hv_vcpu_get_exec_time(_:_:)"
---

# hv_vcpu_get_exec_time(_:_:)

Returns, by reference, the cumulative execution time of a vCPU, in nanoseconds.

## Declaration

```swift
func hv_vcpu_get_exec_time(_ vcpu: hv_vcpu_t, _ time: UnsafeMutablePointer<UInt64>) -> hv_return_t
```

## Parameters

- `vcpu`: The instance of the vCPU.
- `time`: The execution time on output, in nanoseconds.

## Return Value

Return Value HV_SUCCESS if the operation was successful, otherwise an error code specified in hv_return_t.

## Discussion

Discussion important: This function must be called by the owning thread.

## See Also

### Runtime

- [hv_vcpu_run(_:)](hypervisor/hv_vcpu_run(_:).md)
- [hv_vcpus_exit(_:_:)](hypervisor/hv_vcpus_exit(_:_:).md)
- [hv_vcpu_get_pending_interrupt(_:_:_:)](hypervisor/hv_vcpu_get_pending_interrupt(_:_:_:).md)
- [hv_vcpu_set_pending_interrupt(_:_:_:)](hypervisor/hv_vcpu_set_pending_interrupt(_:_:_:).md)
- [hv_interrupt_type_t](hypervisor/hv_interrupt_type_t.md)
- [Exits](hypervisor/exits.md)
