Skip to content

Commit

Permalink
Add ability to adjust idle time. Make stress duration more specific (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortbloke committed Aug 24, 2019
1 parent 9f86700 commit 57e26c6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
18 changes: 14 additions & 4 deletions stressberry/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@ def _get_parser_run():
"-d",
"--duration",
type=int,
default=600,
help="test duration in seconds (default: 600)",
default=300,
help="stress test duration in seconds (default: 300)",
)
parser.add_argument(
"-i",
"--idle",
type=int,
default=150,
help="idle time in seconds at start and end of stress test (default: 150)",
)
parser.add_argument(
"-c",
Expand All @@ -69,11 +76,14 @@ def run(argv=None):
args = parser.parse_args(argv)

# Cool down first
print("Cooldown...")
print("Awaiting stable baseline temperature...")
cooldown(filename=args.temperature_file)

# Start the stress test in another thread
t = threading.Thread(target=lambda: test(args.duration, args.cores), args=())
t = threading.Thread(
target=lambda: test(args.duration, args.idle, args.cores),
args=()
)
t.start()

times = []
Expand Down
5 changes: 1 addition & 4 deletions stressberry/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,9 @@ def cpu_core_count():
return count


def test(duration, cores):
def test(stress_duration, idle_duration, cores):
"""Run stress test with 25% of test duration for idle before and after the stres
"""
stress_duration = 0.5 * duration
idle_duration = 0.25 * duration

if cores is None:
cores = cpu_core_count()

Expand Down

0 comments on commit 57e26c6

Please sign in to comment.