Skip to content

Commit

Permalink
#2366 [Windows]: log debug message when using slower process APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Feb 26, 2024
1 parent 4cf56e0 commit 3dc2fbd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
5.9.9 (IN DEVELOPMENT)
======================

**Enhancements**

- 2366_, [Windows]: log debug message when using slower process APIs.

**Bug fixes**

- 2360_, [macOS]: can't compile on macOS < 10.13. (patch by Ryan Schmidt)
Expand Down
5 changes: 5 additions & 0 deletions psutil/_pswindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ def _get_raw_meminfo(self):
if is_permission_err(err):
# TODO: the C ext can probably be refactored in order
# to get this from cext.proc_info()
debug("attempting memory_info() fallback (slower)")
info = self._proc_info()
return (
info[pinfo_map['num_page_faults']],
Expand Down Expand Up @@ -991,6 +992,7 @@ def create_time(self):
return created
except OSError as err:
if is_permission_err(err):
debug("attempting create_time() fallback (slower)")
return self._proc_info()[pinfo_map['create_time']]
raise

Expand All @@ -1014,6 +1016,7 @@ def cpu_times(self):
except OSError as err:
if not is_permission_err(err):
raise
debug("attempting cpu_times() fallback (slower)")
info = self._proc_info()
user = info[pinfo_map['user_time']]
system = info[pinfo_map['kernel_time']]
Expand Down Expand Up @@ -1100,6 +1103,7 @@ def io_counters(self):
except OSError as err:
if not is_permission_err(err):
raise
debug("attempting io_counters() fallback (slower)")
info = self._proc_info()
ret = (
info[pinfo_map['io_rcount']],
Expand Down Expand Up @@ -1159,6 +1163,7 @@ def num_handles(self):
return cext.proc_num_handles(self.pid)
except OSError as err:
if is_permission_err(err):
debug("attempting num_handles() fallback (slower)")
return self._proc_info()[pinfo_map['num_handles']]
raise

Expand Down

0 comments on commit 3dc2fbd

Please sign in to comment.