Skip to content

Commit

Permalink
update the testload sample script a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Sep 20, 2019
1 parent 5968fad commit 174be71
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions plugin/src/main/resources/util.dsc
Expand Up @@ -13,15 +13,15 @@ BUILTIN_Load_Tester:
script:

# double check the permission
- if !<player.has_permission[denizen.testload]||<player.is_op||<context.server>>> queue clear
- if !<player.has_permission[denizen.testload]||<player.is_op||<context.server>>>:
- stop

- define n <context.args.get[1].as_int||null>
- define n <context.args.get[1].round||null>

# if no number specified, stress test with 100 queues
- if <[n]> == null {
- narrate 'Invalid integer, assuming 100.'
- define n 100
}
# if no number specified, stress test with 1000 queues
- if <[n]> == null:
- narrate 'Invalid integer, assuming 1000.'
- define n 1000

# initialize the progress flag
# this will count up each time a queue was completed
Expand All @@ -32,18 +32,16 @@ BUILTIN_Load_Tester:

# repeat the run command
# each run will create a new queue, and increase the counter
- repeat <[n]> {
- repeat <[n]>:
- run locally test instantly
}

# ...and end time, to compare against the start time
- define end_time <server.current_time_millis>

- narrate 'Completed <server.flag[stress_test_counter].as_int> of <[n]> total queues in <[end_time].sub_int[<[start_time]>].div[1000]> seconds.'
- narrate 'Completed <server.flag[stress_test_counter].round> of <[n]> total queues in <[end_time].sub_int[<[start_time]>].div[1000]> seconds.'

# cleanup
- flag server stress_test_counter:!


test:
- flag server stress_test_counter:++

0 comments on commit 174be71

Please sign in to comment.