Skip to content

Commit

Permalink
Improve load tester
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 8, 2015
1 parent 41af2ba commit 1d6dacc
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main/resources/util.dscript
Expand Up @@ -15,12 +15,10 @@ BUILTIN_Load_Tester:
# double check the permission
- if !<player.has_permission[denizen.testload]||<player.is_op||<context.server>>> queue clear

- if <context.args.size> >= 1 {
- define n <context.args.get[1]||null>
}
- define n <context.args.get[1].as_int||null>

# if no number specified, stress test with 100 queues
- if %n% == null {
- if <def[n]> == null {
- narrate 'Invalid integer, assuming 100.'
- define n 100
}
Expand All @@ -34,15 +32,14 @@ BUILTIN_Load_Tester:

# repeat the run command
# each run will create a new queue, and increase the counter
- repeat %n% {
- run locally test
- repeat <def[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 <def[end_time].sub_int[<def[start_time]>].div[1000]> seconds.'
- narrate 'Completed <server.flag[stress_test_counter].as_int> of %n% total queues in <def[end_time].sub_int[<def[start_time]>].div[1000]> seconds.'

# cleanup
- flag server stress_test_counter:!
Expand Down

0 comments on commit 1d6dacc

Please sign in to comment.