How to record the amount of time it takes in order for a cell to complete execution (from an extension)?

I need to write an extension that records how long it takes for a cell to complete execution. I’m not sure where to start. I attached a slot function to app.commands.commandExecuted.connect in order to determine if this information is exposed in messages, however I didn’t see anything that would indicate when executions start and stop.

Does anyone have any hint for where to look for something like this, or how I should approach this problem?

see GitHub - deshaw/jupyterlab-execute-time: Execute Time Plugin for Jupyter Lab (Grout).


It appears that there is a straight-forward way of doing this. The NotebookActions namespace gets merged with the NotebookActions class at some point which exposes a executed Signal:

const extension: JupyterFrontEndPlugin<object> = {
  id: "etc-jupyterlab-telemetry:plugin",
  autoStart: true,
  requires: [INotebookTracker],
  activate: (app: JupyterFrontEnd, tracker: INotebookTracker) => {

    NotebookActions.executed.connect((_, action) => {

return {};