1#!/usr/bin/python3

2

3 import subprocess

4

5 classes_list = ["cpu", "cpu-cache", "memory", "os", "pipe", "scheduler", "vm"]

6

7 stressors_list = []

8

9 for stress_ng_class in classes_list:

10 cmd_get_stressors = ["stress-ng", "--class", "{}?".format(stress_ng_class)]

11 try:

12 output = subprocess.run(

13 cmd_get_stressors,

14 capture_output=True,

15 universal_newlines=True,

16 check=True,

17 ).stdout

18 except Exception as err:

19 raise SystemExit(err)

20

21 class_stressor_list = output.split(": ")[1].split()

22

23 for class_stressor in class_stressor_list:

24 if class_stressor in stressors_list:

25 continue

26 stressors_list.append(class_stressor)

27

28 stressors_list.sort()

29 for stressor in stressors_list:

30 print("stressor: {}".format(stressor))

31 print()