---
title: timing
description: Timer and result helpers from IPython/core/magics/execution.py.
---
## TimeitResult

```python
def TimeitResult(
    loops, repeat, best, worst, all_runs, compile_time, precision
):
```

*Object returned by the timeit magic with info about the run.*

Contains the following attributes:

loops: int
number of loops done per measurement

repeat: int
number of times the measurement was repeated

best: float
best execution time / number

all\_runs : list\[float\]
execution time of each run (in s)

compile\_time: float
time of statement compilation (s)

### TimeitResult.average

```python
def average():
```

### TimeitResult.stdev

```python
def stdev():
```

## TimeitTemplateFiller

```python
def TimeitTemplateFiller(
    ast_setup, ast_stmt
):
```

*Insert the setup and timed statements into the %timeit template.*

### TimeitTemplateFiller.visit\_FunctionDef

```python
def visit_FunctionDef(
    node
):
```

*Fill in the setup statement*

### TimeitTemplateFiller.visit\_For

```python
def visit_For(
    node
):
```

*Fill in the statement to be timed*

## clock2

```python
def clock2():
```

## clock

```python
def clock():
```
