Skip to content

Commit ab441b7

Browse files
committed
align with main branch
1 parent 835753f commit ab441b7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ipykernel/kernelbase.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -988,11 +988,12 @@ async def usage_request(self, stream, ident, parent):
988988
for process in self.processes.values()
989989
]
990990
)
991-
host_cpu_percent = psutil.cpu_percent()
991+
cpu_percent = psutil.cpu_percent()
992992
# https://psutil.readthedocs.io/en/latest/index.html?highlight=cpu#psutil.cpu_percent
993993
# The first time cpu_percent is called it will return a meaningless 0.0 value which you are supposed to ignore.
994-
if host_cpu_percent is not None and host_cpu_percent != 0.0:
995-
reply_content["host_cpu_percent"] = host_cpu_percent
994+
if cpu_percent is not None and cpu_percent != 0.0:
995+
reply_content["host_cpu_percent"] = cpu_percent
996+
reply_content["cpu_count"] = psutil.cpu_count(logical=True)
996997
reply_content["host_virtual_memory"] = dict(psutil.virtual_memory()._asdict())
997998
reply_msg = self.session.send(stream, "usage_reply", reply_content, parent, ident)
998999
self.log.debug("%s", reply_msg)

0 commit comments

Comments
 (0)