Albert-Jan Roskam, 24.07.2012 11:18: >> I would like to test how long it takes for two versions of the same >> program to start up and be ready to receive commands. The program is >> SPSS version-very-old vs. SPSS version-latest. >> >> Normally I'd just fire the program up in a subprocess and measure the >> time before and after finishing. But this kind of program is never >> finished. It's looping until infinity and waiting for events/commands. I >> tried wrapping it in a "while True" loop, and break out of the loop and >> terminate the program (using ctypes) if the retcode of the process is >> equal to zero. But that doesn't work. > >Is it really looping or is it just sitting and waiting for input? You might >be able to provide some input that makes it terminate. > >Stefan > >===> Good idea. And thanks everybody for replying. I solved it by using >SendKeys-ctypes-0.2. >I couldn't use pywin32 -- no rights to install this :-(( >Here's a fragment (it won't work on an english locale, I think. Replace 'u' >with 'r' (for "Run..."). > start = time.clock() > if windows_version == "Windows 2000" and spss_version == 14: > SendKeys.SendKeys("""{LWIN} > {PAUSE 0.25} > u > %s{ENTER} > {PAUSE %2.1f} > %%{TAB 2} > %%{F4}""" % (spss_path, PAUSE), with_spaces=True) > elif windows_version == "Windows 7": > SendKeys.SendKeys("""{LWIN} > {PAUSE 0.25} > %s{ENTER} > {PAUSE %2.1f} > %%{TAB} > %%{F4}""" % (spss_path, PAUSE), with_spaces=True) > end = time.clock() > duration = (end - start)
________________________________ From: Stefan Behnel <stefan...@behnel.de> To: tutor@python.org Sent: Tuesday, July 24, 2012 2:29 PM Subject: Re: [Tutor] measuring the start up time of an event-driven program
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor