diff --git a/Autoload/Autoload.gd b/Autoload/Autoload.gd index 9cb800d..d18b76d 100644 --- a/Autoload/Autoload.gd +++ b/Autoload/Autoload.gd @@ -2,15 +2,15 @@ extends Node const screen_size = Vector2(1024, 600) -const RANGE: int = 10 +var start_time : int +var last_time : int -const PRINT_TIME_EVERY_SECONDS : int = 5 -var time_to_print_next_time : int = PRINT_TIME_EVERY_SECONDS -var current_run_time : float = 0.0 +const PRINT_TIME_EVERY_MILISECONDS : int = 5000 +var time_to_print_next_time : int = PRINT_TIME_EVERY_MILISECONDS -var time_to_show: float = 30 # How long test works +var time_to_show: int = 30 * 1000 # How long test works in miliseconds -var time_for_each_step : float = -1.0 +var time_for_each_step : int = -1 # Each scene runs alone const alone_steps : Array = [ @@ -32,24 +32,27 @@ const all_in_one : Array = [ ] func _init(): + start_time = OS.get_system_time_msecs() + # In case when user doesn't provide time time_for_each_step = time_to_show / (alone_steps.size() + 1) for argument in OS.get_cmdline_args(): var rr: String = argument - if rr.find("tscn") != -1: # Ignore all tscn scenes/names + if rr.ends_with("tscn"): # Ignore all tscn scenes/names continue - time_to_show = argument.to_float() + time_to_show = int(argument.to_float() * 1000) time_for_each_step = time_to_show / (alone_steps.size() + 1) - print("Time set to: " + str(time_to_show) + " seconds with "+ str(alone_steps.size() + 1) + " steps, each step will take " + str(time_for_each_step) + " seconds.") - break + print("Time set to: " + str(time_to_show / 1000.0) + " seconds with "+ str(alone_steps.size() + 1) + " steps, each step will take " + str(time_for_each_step / 1000.0) + " seconds.") func _process(delta: float) -> void: - current_run_time += delta + var current_run_time : int = OS.get_system_time_msecs() - start_time + if current_run_time > time_to_print_next_time: - print("Test is running now " + str(time_to_print_next_time) + " seconds") - time_to_print_next_time += PRINT_TIME_EVERY_SECONDS + print("Test is running now " + str(int(time_to_print_next_time / 1000)) + " seconds") + time_to_print_next_time += PRINT_TIME_EVERY_MILISECONDS if current_run_time > time_to_show: + print("Ending test") get_tree().quit() diff --git a/MainScenes/Control.gd b/MainScenes/Control.gd index 26896ea..8498e08 100644 --- a/MainScenes/Control.gd +++ b/MainScenes/Control.gd @@ -1,8 +1,7 @@ extends GridContainer - -func _ready(): - for _i in range(Autoload.RANGE): +func _ready() -> void: + for _i in range(10): add_child(Control.new()) add_child(Popup.new()) add_child(WindowDialog.new()) diff --git a/MainScenes/Node2D.gd b/MainScenes/Node2D.gd index e1d0aa7..89c47e1 100644 --- a/MainScenes/Node2D.gd +++ b/MainScenes/Node2D.gd @@ -1,8 +1,7 @@ extends Node2D - -func _ready(): - for _i in range(Autoload.RANGE): +func _ready() -> void: + for _i in range(10): add_child(Node2D.new()) add_child(AnimatedSprite.new()) add_child(Area2D.new()) @@ -15,7 +14,7 @@ func _ready(): add_child(CPUParticles2D.new()) add_child(Camera2D.new()) add_child(CanvasModulate.new()) -# add_child(CollisionPolygon2D.new()) # Errors + add_child(CollisionPolygon2D.new()) # Errors add_child(CollisionShape2D.new()) add_child(DampedSpringJoint2D.new()) add_child(GrooveJoint2D.new()) diff --git a/MainScenes/Other.gd b/MainScenes/Other.gd index 3a57bf8..068e1dc 100644 --- a/MainScenes/Other.gd +++ b/MainScenes/Other.gd @@ -2,7 +2,7 @@ extends Node func _ready() -> void: - for _i in range(Autoload.RANGE): + for _i in range(10): add_child(AnimationPlayer.new()) add_child(AnimationTree.new()) add_child(AnimationTreePlayer.new()) diff --git a/MainScenes/Spatial.gd b/MainScenes/Spatial.gd index a4d925c..68407e5 100644 --- a/MainScenes/Spatial.gd +++ b/MainScenes/Spatial.gd @@ -1,8 +1,8 @@ extends Spatial -func _ready(): - for i in range(Autoload.RANGE): +func _ready() -> void: + for _i in range(10): add_child(Spatial.new()) add_child(ARVRAnchor.new()) add_child(Camera.new()) diff --git a/Start.gd b/Start.gd index 34b25ad..de2be62 100644 --- a/Start.gd +++ b/Start.gd @@ -1,7 +1,7 @@ extends Control var current_scene : int = -1 -var time_to_switch : float +var time_to_switch : int const NUMBER_OF_INSTANCES : int = 1 # Use more than 1 to stress test, 1 should be optimal for casual CI func _ready(): @@ -14,10 +14,9 @@ func _ready(): print(" - " + path) -func _process(delta): - time_to_switch -= delta - if time_to_switch <= 0: - time_to_switch = Autoload.time_for_each_step +func _process(_delta): + if time_to_switch - OS.get_system_time_msecs() <= 0: + time_to_switch = Autoload.time_for_each_step + OS.get_system_time_msecs() if current_scene < Autoload.alone_steps.size() - 1: current_scene += 1