@@ -34,12 +34,12 @@ jupyter nbextension enable --py nbresuse --sys-prefix
3434### Memory Limit
3535
3636` nbresuse ` can display a memory limit (but not enforce it). You can set this
37- in serveral ways:
37+ in several ways:
3838
39- 1 . ` MEM_LIMIT ` environment variable. This is set by [ JupyterHub] ( http ://github.com/jupyterhub/jupyterhub/)
39+ 1 . ` MEM_LIMIT ` environment variable. This is set by [ JupyterHub] ( https ://github.com/jupyterhub/jupyterhub/)
4040 if using a spawner that supports it.
41412 . In the commandline when starting ` jupyter notebook ` , as ` --ResourceUseDisplay.mem_limit ` .
42- 3 . In your jupyter notebook [ traitlets] ( https://traitlets.readthedocs.io/en/stable/ ) config file
42+ 3 . In your Jupyter notebook [ traitlets] ( https://traitlets.readthedocs.io/en/stable/ ) config file
4343
4444The limit needs to be set as an integer in Bytes.
4545
@@ -53,7 +53,36 @@ The threshold for this warning can be configured as a fraction of the memory lim
5353If you want to flash the warning to the user when they are within 10% of the memory limit, you
5454can set the parameter ` --ResourceUseDisplay.mem_warning_threshold=0.1 ` .
5555
56+
57+ ### CPU Usage
58+
59+ ` nbresuse ` can also track CPU usage and report a ` cpu_percent ` value as part of the ` /metrics ` response.
60+
61+ You can set the ` cpu_limit ` in several ways:
62+
63+ 1 . ` CPU_LIMIT ` environment variable. This is set by [ JupyterHub] ( https://github.com/jupyterhub/jupyterhub/ )
64+ if using a spawner that supports it.
65+ 2 . In the command line when starting ` jupyter notebook ` , as ` --ResourceUseDisplay.cpu_limit ` .
66+ 3 . In your Jupyter notebook [ traitlets] ( https://traitlets.readthedocs.io/en/stable/ ) config file
67+
68+ The limit corresponds to the number of cpus the user has access to, but does not enforce it.
69+
70+ Additionally, you can set the ` track_cpu_percent ` trait to enable CPU usage tracking (disabled by default):
71+
72+ ``` python
73+ c = get_config()
74+ c.NotebookApp.ResourceUseDisplay.track_cpu_percent = True
75+ ```
76+
77+ As a command line argument:
78+
79+ ``` bash
80+ jupyter notebook --ResourceUseDisplay.track_cpu_percent=True
81+ ```
82+
5683## Resources displayed
5784
5885Currently it only displays Memory usage (just RSS). Other metrics will be
59- added in the future as needed.
86+ added in the future as needed.
87+
88+ The notebook extension currently doesn't show CPU usage.
0 commit comments