LinuxMonitor 1.4.4__tar.gz → 1.4.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LinuxMonitor
3
- Version: 1.4.4
3
+ Version: 1.4.6
4
4
  Summary: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
5
5
  Home-page: https://github.com/QuentinCG/Linux-Monitor-Python-Library
6
6
  Author: Quentin Comte-Gaz
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LinuxMonitor
3
- Version: 1.4.4
3
+ Version: 1.4.6
4
4
  Summary: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
5
5
  Home-page: https://github.com/QuentinCG/Linux-Monitor-Python-Library
6
6
  Author: Quentin Comte-Gaz
@@ -33,7 +33,7 @@ __email__ = "quentin@comte-gaz.com"
33
33
  __license__ = "MIT License"
34
34
  __copyright__ = "Copyright Quentin Comte-Gaz (2024)"
35
35
  __python_version__ = "3.+"
36
- __version__ = "1.4.4 (2024/10/07)"
36
+ __version__ = "1.4.6 (2024/10/07)"
37
37
  __status__ = "Usable for any Linux project"
38
38
 
39
39
  import json
@@ -1691,7 +1691,12 @@ class LinuxMonitor:
1691
1691
  dummy_process.cpu_percent(interval=None)
1692
1692
  except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
1693
1693
  continue
1694
- await asyncio.sleep(delay=1)
1694
+
1695
+ if order_by_ram:
1696
+ await asyncio.sleep(delay=1)
1697
+ else:
1698
+ # Let's get more accurate CPU percent values if we are ordering by CPU usage
1699
+ await asyncio.sleep(delay=5)
1695
1700
 
1696
1701
  # Then we can get the processes
1697
1702
  for process in psutil.process_iter(['pid', 'name', 'username', 'cpu_percent', 'memory_info', 'create_time', 'cmdline']):
@@ -1717,7 +1722,9 @@ class LinuxMonitor:
1717
1722
  pass
1718
1723
 
1719
1724
  # Sort processes by memory usage, then by CPU usage, both in descending order
1720
- processes.sort(key=lambda proc: (order_by_ram ? proc['memory']: proc['cpu_percent'], order_by_ram ? proc['cpu_percent']: proc['memory'], proc['create_time']), reverse=True) # type: ignore
1725
+ processes.sort(key=lambda proc: (proc['memory'] if order_by_ram else proc['cpu_percent'], # type: ignore
1726
+ proc['cpu_percent'] if order_by_ram else proc['memory'],
1727
+ proc['create_time']), reverse=True)
1721
1728
 
1722
1729
  full_res: str = ""
1723
1730
  for proc in processes: # type: ignore
@@ -6,7 +6,7 @@ with io.open(file='README.md', mode='r', encoding='utf-8') as readme_file:
6
6
 
7
7
  setup(
8
8
  name="LinuxMonitor",
9
- version="1.4.4",
9
+ version="1.4.6",
10
10
  description="Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)",
11
11
  long_description=readme,
12
12
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes