Skip to main content

stresstify is a Python package designed for retrieving system information and performing stress tests on CPU, RAM, and disk. It provides detailed CPU information, including name, core count, frequency, and usage, as well as memory and disk usage statistics. The package includes stress tests such as CPU-intensive calculations across multiple cores, continuous RAM allocation until failure, and disk write speed measurement. The author is not responsible for any hardware damage caused by excessive load.

Project description

Stresstify

Stresstify is a Python module created specifically for stress testing of CPU, RAM, and disk. It also provides tools to monitor the state of these components.

The module includes the main StressTest class with several methods, as well as additional standalone functions.

The command to install the module is pip install stresstify


RAM Test

The ram_test() method performs a simple stress test on the system's RAM by loading files of approximately 8 MB into memory. When using debug=True, it records the elapsed time and memory usage percentage for each iteration.

root = StressTest(debug=True)
result = root.ram_test()
print(result)

Output:

{'elapsed_time': 32, 'ram_used': {0.03: '59.80%', 0.05: '60.00%', 0.07: '60.10%', 0.09: '60.30%', 0.10: '100%'}}

Memory Test

The memory_test() method checks the disk write speed by creating a temporary 1 GB binary file, which is immediately deleted. With debug=True, it displays the average write speed and average write time; if debug=False, it outputs only the values from the last iteration.

root = StressTest(debug=True)
result = root.memory_test()
print(result)

Output:

{'average_speed': 1189.33, 'average_time': 0.86}

CPU Test

The cpu_test() method utilizes all available processor cores for intensive computations. It accepts an optional parameter size (default is 10^7). When debug=True, it returns a dictionary containing:

  • average_cpu_load: Average CPU load.
  • average_cpu_freq: Average CPU frequency.
  • cpu_load_dict: A dictionary with the key "start" representing the initial CPU load, followed by the load for each iteration.
  • cpu_freq_dict: A dictionary with the key "start" representing the initial CPU frequency, followed by the frequency for each iteration.
  • time_dict: The elapsed time for each iteration. (Note: The time values might not strictly increase, as different cores may complete tasks at varying speeds.)
if __name__ == '__main__':
    root = StressTest(debug=True)
    result = root.cpu_test()
    print(result)

Output:

{'average_cpu_load': 23.37, 'average_cpu_freq': 2409.09, 'average_time': 25.74, 'cpu_load_dict': {'start': 3.1, 1: 23.8, 2: 23.3, 3: 34.6, 4: 33.1, 5: 22.4, 6: 22.5, 7: 27.8, 8: 21.9, 9: 22.2, 10: 22.4}, 'cpu_freq_dict': {'start': 2500.0, 1: 2500.0, 2: 2500.0, 3: 2500.0, 4: 2500.0, 5: 2500.0, 6: 1500.0, 7: 2500.0, 8: 2500.0, 9: 2500.0, 10: 2500.0}, 'time_dict': {1: 25.84, 2: 25.91, 3: 25.44, 4: 25.41, 5: 26.0, 6: 25.82, 7: 25.43, 8: 25.95, 9: 25.88, 10: 25.69}}

CPU Info

The standalone function cpu_info() provides detailed information about the processor:

  • cpu_name: The name of the processor.
  • physical_cores: Number of physical cores.
  • logical_cores: Number of logical cores.
  • max_frequency: Maximum CPU frequency.
  • min_frequency: Minimum CPU frequency.
  • current_frequency: Current CPU frequency.
  • cpu_percent: A list showing the load percentage for each core.
root = cpu_info()
print(root)

Output:

{'cpu_name': '12th Gen Intel(R) Core(TM) i5-12450H', 'physical_cores': 8, 'logical_cores': 12, 'max_frequency': 2500.0, 'min_frequency': 0.0, 'current_frequency': 1500.0, 'cpu_percent': [9.1, 47.8, 22.2, 13.8, 23.8, 13.6, 25.4, 13.6, 15.2, 15.6, 16.7, 16.4]}

RAM Info

The memory_info() function retrieves details about the system's RAM:

  • Total_GB: Total RAM in gigabytes.
  • Used_GB: Amount of RAM currently used (in gigabytes).
  • Free_GB: Amount of free RAM (in gigabytes).
  • Percent: Percentage of RAM utilization.
root = memory_info()
print(root)

Output:

{'Total_GB': 15.710990905761719, 'Used_GB': 10.429752349853516, 'Free_GB': 5.280986785888672, 'Percent': 66.4}

Disk Info

The disk_info() function displays information about each disk partition. For each partition, it provides:

  • mountpoint: The path where the partition is mounted (e.g., "C:", "/mnt/data").
  • total_size_GB: Total size of the partition in gigabytes.
  • used_size_GB: Used space on the partition in gigabytes.
  • free_size_GB: Free space on the partition in gigabytes.
  • usage_percent: Percentage of the partition's used space.
root = disk_info()
print(root)

Output:

{'C:\\': {'mountpoint': 'C:\\', 'total_size_GB': 181.64, 'used_size_GB': 157.15, 'free_size_GB': 24.49, 'usage_percent': 86.5}, 'D:\\': {'mountpoint': 'D:\\', 'total_size_GB': 214.45, 'used_size_GB': 168.92, 'free_size_GB': 45.53, 'usage_percent': 78.8}, 'E:\\': {'mountpoint': 'E:\\', 'total_size_GB': 80.0, 'used_size_GB': 16.71, 'free_size_GB': 63.29, 'usage_percent': 20.9}}

Project Source Code

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stresstify-0.0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stresstify-0.0.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file stresstify-0.0.2.tar.gz.

File metadata

  • Download URL: stresstify-0.0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for stresstify-0.0.2.tar.gz
Algorithm Hash digest
SHA256 901db49ec6005bf7e95d78f9f2db97201ad331c2cddcd9d084936e3ab8dbfb8c
MD5 d95d11ea44b36b01a03f328b73184a17
BLAKE2b-256 d67a3d64dd40b303ddc43e6281d18aac76ef69dda54ad836bb0298879cdcc7c3

See more details on using hashes here.

File details

Details for the file stresstify-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: stresstify-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for stresstify-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7c974670920eeb60318d46e9d9151c89d4c8962cfc9f73b546dd6bbd8b4a4191
MD5 89c630a7760a21ad991d3f8ea4b10768
BLAKE2b-256 b1def073cb5865e952e8bd00efadd925dc2e86b6a1bf7e550be8df16bd31a3dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page