/
util.dscript
51 lines (38 loc) · 1.35 KB
/
util.dscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Load Tester
Load Tester:
type: command
name: testload
debug: false
description: Tests server load.
usage: /testload <<>power<>>
allowed help:
- determine <player.has_permission[denizen.testload]||<player.is_op>>
script:
# ops only!
- if !<player.has_permission[denizen.testload]||<player.is_op>> queue clear
- if <c.args.size> == 1
define n <c.args.get[1]>
# if no number specified, stress test with 100 queues
- if %n% == null {
- narrate 'Invalid integer, assuming 100.'
- define n 100
}
# initialize the progress flag
# this will count up each time a queue was completed
- flag server stress_test_counter:0
# keep track of the start time
- define start_time <server.current_time_millis>
# repeat the run command
# each run will create a new queue, and increase the counter
- repeat %n% {
- run locally test
}
# ...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 <m:(%end_time% - %start_time%) / 1000> seconds.'
# cleanup
- flag server stress_test_counter:!
- determine fulfilled
test:
- flag server stress_test_counter:++