Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: CPU usage for Stata loops (Windows)


From   Sergiy Radyakin <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: CPU usage for Stata loops (Windows)
Date   Fri, 6 Nov 2009 12:20:37 -0500

Dear Nick,

I don't have any explanation to the behavior you describe (I could
replicate it though), but if somebody is looking into it in StataCorp,
there was one (related?) annoying thing in Stata 10. If you type
-shell- in the command prompt - the CPU goes 100% (on a single core
PC) or on the multicore PC one core goes to 100%.
Hence all commands that one runs via -shell- start in an environment
where the CPU is already 100% consumed by Stata (the problem is not
that serious on the modern multicore machines).
I have reported that on occasion to StataCorp, and I noticed in Stata
11 this does not happen anymore, but if Stata 10 is still supported,
it would be nice to have this fixed as well.

(last seen in Stata 10.1.558, born October 1, 2009)

Thank you, Sergiy Radyakin

On Fri, Nov 6, 2009 at 11:18 AM, Nick Winter <nwinter@virginia.edu> wrote:
> Hi,
>
> On my Windows XP [fully up to date, legal IC Stata 11 :-) ], the following
> consumes 30-50% of my system CPU time, according to the Windows Task
> Manager:
>
> while 1 {
>  sleep 500
> }
>
> Whereas this consumes essentially 0 CPU time:
>
> while 1 {
>  sleep 501
> }
>
>
> (On one computer the first loop consumes 50%, i.e. the total that Stata can
> use on my Dual Core processor; on a different computer it takes "only"
> 30-ish percent.  But on both systems there's a sharp drop to essentially
> nothing in the second loop.
>
> Any ideas why?
>
>
> An aside on why I care:
>
> I'm writing a program in which Stata calls an external program and waits for
> it to finish before continuing.  I'd like to handle this with -winexec-
> followed by watching for the creation of a file by the external program to
> signal that it's done, rather than using 'shell' to make Stata wait, because
> I want Stata to spawn several of these processes and then wait for them
> *all* to finish.
>
> So my strategy is to do something like this:
>
>        winexec "c:\usrdata\autoit\sttest.exe"
>        sleep 500
>        capture confirm file "c:\temp\xxx.txt"
>        while _rc {
>                sleep 500
>                capture confirm file "c:\temp\xxx.txt"
>        }
>        di "done!!!"
>
>
> - Nick Winter
>
>
> --
> --------------------------------------------------------------
> Nicholas Winter                                 434.924.6994 t
> Assistant Professor                             434.924.3359 f
> Department of Politics                  nwinter@virginia.edu e
> University of Virginia          faculty.virginia.edu/nwinter w
> PO Box 400787, 100 Cabell Hall
> Charlottesville, VA 22904
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index