# Cannot get cell execution time from Jupyter API?

**URL:** <https://discourse.jupyter.org/t/cannot-get-cell-execution-time-from-jupyter-api/7922>\
**Category:** accessibility\
**Created:** [February 12, 2021, 1:14pm UTC](https://discourse.jupyter.org/t/cannot-get-cell-execution-time-from-jupyter-api/7922 "2021-02-12T13:14:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_Ravenel](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jeremy_ravenel/32/3886_2.png) [@Jeremy\_Ravenel](https://discourse.jupyter.org/u/Jeremy_Ravenel)\
**Post date:** [February 12, 2021, 1:14pm UTC](https://discourse.jupyter.org/t/cannot-get-cell-execution-time-from-jupyter-api/7922/1 "2021-02-12T13:14:17Z")

</div>

Hello everyone,

Do you know why we cannot get cell execution time from Jupyter API?  
I have looked into :

[https://jupyter-notebook.readthedocs.io/en/stable/extending/contents.html](https://jupyter-notebook.readthedocs.io/en/stable/extending/contents.html)

> **[jupyter/jupyter](https://github.com/jupyter/jupyter/wiki/Jupyter-Notebook-Server-API)**
>
> Jupyter-Notebook-Server-API

But could not find the solution.

We would like to access it to monitor time spent running at a notebook/kernel/cell level for our project.

Thanks a lot in advance.  
J.

---

<div class="post-metadata">

**Author:** ![bollwyvl](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/bollwyvl/32/904_2.png) [@bollwyvl](https://discourse.jupyter.org/u/bollwyvl)\
**Post date:** [February 13, 2021, 3:03pm UTC](https://discourse.jupyter.org/t/cannot-get-cell-execution-time-from-jupyter-api/7922/2 "2021-02-13T15:03:28Z")

</div>

The contents api is pretty much unaware of what the kernel api is doing… about the only thing it could do would be to read off whatever a client (e.g. [jupyterlab](https://github.com/jupyterlab/jupyterlab/pull/6864)) claims in notebook metadata.

Are you trying to measure:

- the time from “press run” to “get pixels on screen”?
- the time the message spent in-flight to the server?
- the time the message spent in-flight between the server and the kernel?
- the actual execution time from `execute_request` being received to `execute_response` or `idle` or whatever comes back?
- the return trip?
- whatever the client claims?

Depending on how precise need it to be, you’d likely need to investigate where your notebook/jupyter\_server is actually passing messages, or instrument the kernel itself. There are also some tools in the opencensus (e.g. [GitHub - Quansight/jupyter-jaeger: @jupyter integration for @jaegertracing](https://github.com/Quansight/jupyter-jaeger)) realm that might work.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Ravenel](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jeremy_ravenel/32/3886_2.png) [@Jeremy\_Ravenel](https://discourse.jupyter.org/u/Jeremy_Ravenel)\
**Post date:** [March 4, 2021, 6:56pm UTC](https://discourse.jupyter.org/t/cannot-get-cell-execution-time-from-jupyter-api/7922/3 "2021-03-04T18:56:08Z")

</div>

@bollwyvl Thanks a lot for the valuable feedback.

We try to measure cell execution time that the human sees so I guess : “he time from “press run” to “get pixels on screen”?” is the answer.

Will investigate more with the tools you provided. Thanks again.
