This project has been archived by its maintainers, and is no longer receiving any updates.
A simple Windows status retrieval module with no additional dependencies. Wraps common system status queries from Windows’ ugly C-API:
Memory stats
Performance stats
Disk info, types, and stats
Performance Data Counters (aka PerfMon)
Supports Python 2.6 and above; WindowsXP and above.
Note: Relicensed as LGPL v3 (or later).
Install
D:\> pip install winstats
Use
Setup:
import winstats
# optional
import locale
locale.setlocale(locale.LC_ALL, '')
fmt = lambda n: locale.format('%d', n, True)
Memory Stats:
meminfo = winstats.get_mem_info() print ' Total: %s b' % fmt(meminfo.TotalPhys) print ' usage: %s%%' % fmt(meminfo.MemoryLoad) print
Performance Stats:
pinfo = winstats.get_perf_info() print ' Cache: %s p' % fmt(pinfo.SystemCache) print ' Cache: %s b' % fmt(pinfo.SystemCacheBytes) print
Disk Stats:
drives = winstats.get_drives() drive = drives[0] fsinfo = winstats.get_fs_usage(drive) vinfo = winstats.get_vol_info(drive) print ' Disks:', ', '.join(drives) print ' %s:\\' % drive print ' Name:', vinfo.name print ' Type:', vinfo.fstype print ' Total:', fmt(fsinfo.total) print ' Used: ', fmt(fsinfo.used) print ' Free: ', fmt(fsinfo.free) print
Perfmon - Performance Counters:
# take a second snapshot 100ms after the first:
usage = winstats.get_perf_data(r'\Processor(_Total)\% Processor Time',
fmt='double', delay=100)
print ' CPU Usage: %.02f %%' % usage
# query multiple at once:
counters = [ r'\Paging File(_Total)\% Usage', r'\Memory\Available MBytes']
results = winstats.get_perf_data(counters, fmts='double large'.split())
print ' Pagefile Usage: %.2f %%, Mem Avail: %s MB' % results
Results
The examples above are built into the module, and double as a minimal test suite:
D:\> python.exe -m winstats
Memory Stats:
Total: 536,330,240 b
usage: 31%
Performance Stats:
Cache: 35,921 p
Cache: 147,132,416 b
Disk Stats:
Disks: C, D, O
C:\
Name: System
Type: NTFS
Total: 10,725,732,352
Used: 3,160,956,928
Free: 7,564,775,424
PerfMon queries:
CPU Usage: 10.00 %
Pagefile Usage: 0.55 %, Mem Avail: 347 MB
And more …
Metadata
Release files for winstats 0.80
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| winstats-0.80.tar.gz | 6.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| winstats-0.80-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 12.6 kB
Release files / winstats-0.80.tar.gz
| Download URL | winstats-0.80.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6076805d9a118b6dceff75f1ff49d04683da70884fb7392fa0a7583c42b3e6a4
|
|
BLAKE2b-256 checksum How to use checksums |
021c05a6b869347285ac1fa5f2985b0fb44e45d4c801b2e2e5436cfd1f236268
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.8
|
Release files / winstats-0.80-py2.py3-none-any.whl
| Download URL | winstats-0.80-py2.py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
75af791f5c2be22da52f20754ad1dbbdae6dc5469484ce0518997c6971f768ac
|
|
BLAKE2b-256 checksum How to use checksums |
4e2942cae658d30bd0254ec95bc2205b9d5dec51af5c80545499a4b67a00dc80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.8
|
Security for winstats 0.80
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.