@@ -348,7 +348,13 @@ def run_latency_calls(self, test):
348348 start_time = get_time ()
349349 try :
350350 if test .from_dom0 :
351- subprocess .run (code , shell = True , check = True , capture_output = True , timeout = timeout )
351+ subprocess .run (
352+ code ,
353+ shell = True ,
354+ check = True ,
355+ capture_output = True ,
356+ timeout = timeout ,
357+ )
352358 else :
353359 self .vm1 .run (code , timeout = timeout )
354360 except subprocess .CalledProcessError as e :
@@ -370,13 +376,18 @@ def call_api(self, test, service, qube):
370376 start_time = get_time ()
371377 app = qubesadmin .Qubes ()
372378 domains = app .domains
373- appvm = domains [qube ]
374- domain_time = get_time ()
375379 if test .non_dispvm :
376- target_qube = self .vm1
380+ # Even though we already have the qube object passed from the
381+ # class, assume we don't so we can calculate gathering.
382+ target_qube = domains [self .vm1 .name ]
383+ domain_time = get_time ()
377384 else :
385+ appvm = domains [qube ]
386+ domain_time = get_time ()
378387 target_qube = qubesadmin .vm .DispVM .from_appvm (app , appvm )
379388 name = target_qube .name
389+ # A very small number, if it appears, it will show a bottleneck at
390+ # DispVM.from_appvm.
380391 target_time = get_time ()
381392 try :
382393 target_qube .run_service_for_stdio (service , timeout = 60 )
@@ -560,6 +571,15 @@ def run_test(self, test: TestConfig):
560571 logger .info ("Setting local max feature: '%s'" , preload_max )
561572 self .dvm .features ["preload-dispvm-max" ] = str (preload_max )
562573 asyncio .run (self .wait_preload (preload_max ))
574+ for qube in [self .vm1 , self .vm2 ]:
575+ if not qube :
576+ # Might be an empty string.
577+ continue
578+ logger .info (
579+ "Waiting for VM '%s' to finish startup" ,
580+ qube .name ,
581+ )
582+ qube .run_service_for_stdio ("qubes.WaitForSession" , timeout = 60 )
563583 logger .info ("Load before test: '%s'" , get_load ())
564584 if test .admin_api :
565585 result = self .run_latency_api_calls (test )
0 commit comments