()
| 49 | |
| 50 | |
| 51 | def cpu(): |
| 52 | arg = sys.argv[2] if len(sys.argv) == 3 else sys.argv[3] |
| 53 | cpu_num = cpu_count() |
| 54 | cores = int(arg) |
| 55 | if not isinstance(cores, int): |
| 56 | print("bad args not int") |
| 57 | return |
| 58 | |
| 59 | if cores > cpu_num: |
| 60 | print("Invalid CPU Num(cpu_count=" + str(cpu_num) + ")") |
| 61 | return |
| 62 | |
| 63 | if cores is None or cores < 1: |
| 64 | cores = 1 |
| 65 | |
| 66 | for i in range(cores): |
| 67 | Process(target=deadloop).start() |
| 68 | |
| 69 | |
| 70 | def mem_cpu(): |