---
title: elapsed_vcpu_ms
summary: Get the amount of vCPU time that has passed since this instance was started, in milliseconds.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/compute_runtime/fn.elapsed_vcpu_ms/
---

**Kind:** Function  
**Module:** [compute_runtime](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/compute_runtime/)  
**Package:** fastly 0.13.1  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/compute_runtime.rs#22

```rust
fn elapsed_vcpu_ms() -> Result<u64, FastlyStatus>
```

Get the amount of vCPU time that has passed since this instance was started,
in milliseconds.

This function returns only time spent running on a vCPU, and does not include
time spent performing any I/O operations. However, it is based on clock time
passing, and so will include time spent executing hostcalls, is heavily
affected by what core of what CPU is running the code, and can even be
influenced by the state of the CPU.

As a result, this function *should not be used in benchmarking across runs*.
It can be used, with caution, to compare the runtime of different operations
within the same session.

**Returns**

`Result<u64, fastly_shared::FastlyStatus>`
