Re: [Tutor] measuring the start up time of an event-driven program

2012-07-25 Thread Albert-Jan Roskam
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 
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


Re: [Tutor] measuring the start up time of an event-driven program

2012-07-24 Thread Stefan Behnel
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

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] measuring the start up time of an event-driven program

2012-07-24 Thread Michael Janßen
On 24 July 2012 11:18, Albert-Jan Roskam  wrote:

> 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.
>

So, the question is, what defines your end point for timing. I'd say, you
could either check if the program *looks* like being ready (
http://sikuli.org/ could help here) or if it doesn't use up cpu anymore.

Both ways, I'd except a fair amount of overhead and for the cpu-usage way
bogus results also. Both problems could perhaps be addressed by enough
timing runs.

cu, Michael
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] measuring the start up time of an event-driven program

2012-07-24 Thread Albert-Jan Roskam
From: Steven D'Aprano 

To: tutor@python.org 
>Sent: Tuesday, July 24, 2012 11:48 AM
>Subject: Re: [Tutor] measuring the start up time of an event-driven program
> 
>On Tue, Jul 24, 2012 at 02:18:43AM -0700, Albert-Jan Roskam wrote:
>> Hi,
>> 
>> 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.
>
>I don't think this is a Python question. I think this is a "what tools 
>does my operating system provide for fine testing of process startup 
>time?" question.
>
>I'm not an expert, but I suspect that the answer will be, "none". Which 
>OS are you using?
>===> I am using Windows 7, but I'd find it interesting to hear about Linux 
>tools too (though I couldn't use them in this particular case). Would be cool 
>if such a tool could differentiate between the various processes involved. In 
>this case stats.exe (frontend) and spssengine.exe (backend).
>
>If the SPSS app has the ability to run commands specified from a 
>script, and then automatically exit, perhaps you can approximate 
>start-up time as "start-up, run an empty script, and exit" time, 
>assuming that running the script and exiting will be negligible.
>
>===> Well, I actually do that too. But the full-fledged app has a GUI 
>programmed in (I think) C++ (old version) or Java (new version). The latter is 
>markedly slower. People work with the GUI based spss all the time. Only when 
>their code is final, people *might* use the scripting facility.
>
>Or, if the app is slow enough (I'm looking at you Chrome, fastest way to 
>browse the web my arse) perhaps you could just time it with a 
>stop-watch.
>
>===> ;-))) Yeah, good idea (I mean the stop-watch, not Chrome --I don't like 
>Google's information obesity).
>
>> I want to know how long the user on average needs to wait before he 
>> can start doing analyses in SPSS. If it takes way much longer in the 
>> new version, the user might be more inclined not to close the program 
>> after use, which may lead to a lack of concurrent licenses.
>
>If you have to measure the difference to notice the difference, the 
>average user won't notice the difference.
>
>===> Good point. But it is noticeable, and now I'd like to quantify that. 
>Something like: "ceteris paribus it takes 2.2 times longer to start up the new 
>version, as compared with the old version"
>
>==> And of course: Thanks!
>
>-- 
>Steven
>___
>Tutor maillist  -  Tutor@python.org
>To unsubscribe or change subscription options:
>http://mail.python.org/mailman/listinfo/tutor
>
>
>___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] measuring the start up time of an event-driven program

2012-07-24 Thread Steven D'Aprano
On Tue, Jul 24, 2012 at 02:18:43AM -0700, Albert-Jan Roskam wrote:
> Hi,
> 
> 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.

I don't think this is a Python question. I think this is a "what tools 
does my operating system provide for fine testing of process startup 
time?" question.

I'm not an expert, but I suspect that the answer will be, "none". Which 
OS are you using?

If the SPSS app has the ability to run commands specified from a 
script, and then automatically exit, perhaps you can approximate 
start-up time as "start-up, run an empty script, and exit" time, 
assuming that running the script and exiting will be negligible.

Or, if the app is slow enough (I'm looking at you Chrome, fastest way to 
browse the web my arse) perhaps you could just time it with a 
stop-watch.


> I want to know how long the user on average needs to wait before he 
> can start doing analyses in SPSS. If it takes way much longer in the 
> new version, the user might be more inclined not to close the program 
> after use, which may lead to a lack of concurrent licenses.

If you have to measure the difference to notice the difference, the 
average user won't notice the difference.



-- 
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor