Jump to content
Sign in to follow this  
exolon

AutoIt3Wrapper pagefaulting a lot?

Recommended Posts

exolon

When I run a program from SciTE, AutoIt3Wrapper seems to wait for it to finish, pagefaulting 262 times every second or so. This seems like a slightly excessive overhead, and I'm not sure what it's for. It's nothing major but if there's a way to avoid it, that'd be better.

Does anyone know why this is? If I'm going to run a program for a while, I usually just kill AutoIt3Wrapper in the task manager, with no ill effects. Sounds like it's polling something repeatedly.

Share this post


Link to post
Share on other sites
PsaltyDS

When I run a program from SciTE, AutoIt3Wrapper seems to wait for it to finish, pagefaulting 262 times every second or so. This seems like a slightly excessive overhead, and I'm not sure what it's for. It's nothing major but if there's a way to avoid it, that'd be better.

Does anyone know why this is? If I'm going to run a program for a while, I usually just kill AutoIt3Wrapper in the task manager, with no ill effects. Sounds like it's polling something repeatedly.

It's running your un-compiled script. If you don't want that overhead, compile the script and run the .exe.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
exolon

It's running your un-compiled script. If you don't want that overhead, compile the script and run the .exe.

:)

No, I don't think so; if this was the case, my program would terminate or hang when I kill AutoIt3Wrapper. But like I said, I can kill it with no ill effects.

I think the wrapper is kind of like a build manager, invoking the desired programs during the build/run process (like the obfuscator, UPX etc), and blocks until the user program has terminated.

As you say, compiling the script and running the .exe also avoids the overhead, just like killing AutoIt3Wrapper after the program has started.

:)

Share this post


Link to post
Share on other sites
trancexx

No, I don't think so; if this was the case, my program would terminate or hang when I kill AutoIt3Wrapper.

Why?

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Jos

When you hit F5(Run) then AutoIt3Wrapper script is started 2 times:

1. This is the original one that shells AutoIt3 with your script as input and Monitors STDOUT of this shelled session which is displayed in the SciTE Outputpane.

2. This is a Second instance which sole purpose is to monitor if either the Autoit3 program ended (or got killed) or the AutoIt3Wrapper has ended. This is done this way to allow people to used the Tools/Stop Executing (Ctrl+Break) from SciTE to kill the execution of the Script.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
exolon

When you hit F5(Run) then AutoIt3Wrapper script is started 2 times:

1. This is the original one that shells AutoIt3 with your script as input and Monitors STDOUT of this shelled session which is displayed in the SciTE Outputpane.

2. This is a Second instance which sole purpose is to monitor if either the Autoit3 program ended (or got killed) or the AutoIt3Wrapper has ended. This is done this way to allow people to used the Tools/Stop Executing (Ctrl+Break) from SciTE to kill the execution of the Script.

Thanks for this explanation. I modified my program to print to stdout every 500ms and had a look at the two instances of AutoIt3Wrapper in the task manager.

If I kill the one causing lots of pagefaults, there's no visible effect, except hitting ctrl-break will then fail to terminate the program (contrary to the "forcing abrupt termination" message):

>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Ulysses\My Documents\code!\autoit\blinkenwords.au3"    
SleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleepSleep
>Process failed to respond; forcing abrupt termination...
>Exit code: 1    Time: 17.255

If I kill the other one, the running program terminates immediately along with the other wrapper.

So I guess that the wrapper instance that determines whether "the Autoit3 program ended (or got killed) or the AutoIt3Wrapper has ended" is the one that causes the pagefaults. Alright :)

Share this post


Link to post
Share on other sites
Jos

So I guess that the wrapper instance that determines whether "the Autoit3 program ended (or got killed) or the AutoIt3Wrapper has ended" is the one that causes the pagefaults. Alright :)

Conclusion sounds correct (Not tested it myself).

The first instance shell itself again with this line in the Run section:

; Run second version as Watcher to kill The running AutoItscript when AutoIt3Wrapper is killed.
    Global $CW = Run(@ScriptFullPath & " /Watcher " & @AutoItPID & " " & $Pid)

This is the code executing in the second "watcher" version:

Case $T_Var = "/Watcher"
            ; when AutoIt3Wrapper is lanched as watcher to see if the original AutoIt3Wrapper is canceled.
            $H_Cmp = $CMDLINE[$x + 1]
            $H_au3 = $CMDLINE[$x + 2]
            While ProcessExists($H_Cmp) And ProcessExists($H_au3)
                Sleep(500)
            WEnd
            Sleep(500)
            If ProcessExists($H_au3) Then
                ProcessClose($H_au3)
                _RefreshSystemTray()
            EndIf
            Exit

That's really all that is happening.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
exolon

This is the code executing in the second "watcher" version:

Case $T_Var = "/Watcher"
            ; when AutoIt3Wrapper is lanched as watcher to see if the original AutoIt3Wrapper is canceled.
            $H_Cmp = $CMDLINE[$x + 1]
            $H_au3 = $CMDLINE[$x + 2]
            While ProcessExists($H_Cmp) And ProcessExists($H_au3)
                Sleep(500)
            WEnd
            Sleep(500)
            If ProcessExists($H_au3) Then
                ProcessClose($H_au3)
                _RefreshSystemTray()
            EndIf
            Exit

That's really all that is happening.

Yes, this makes sense now. I did a quick check with the following snippet:

For $x = 1 To 30
    ProcessExists("scite.exe")
;   ProcessGetStats("scite.exe")
    ConsoleWrite("x")
    Sleep(500)
Next

...and each of those calls costs 108 pagefaults on my machine. Maybe this is unavoidable in the Windows API that gets called - I don't remember using such calls in Windows programming before. Not a big deal really, I was just interested to find out what it was :)

Share this post


Link to post
Share on other sites
Jos

Yes, this makes sense now. I did a quick check with the following snippet:

For $x = 1 To 30
    ProcessExists("scite.exe")
;   ProcessGetStats("scite.exe")
    ConsoleWrite("x")
    Sleep(500)
Next

...and each of those calls costs 108 pagefaults on my machine. Maybe this is unavoidable in the Windows API that gets called - I don't remember using such calls in Windows programming before. Not a big deal really, I was just interested to find out what it was :)

Same here, always interested when things like this happen or things can be improved.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.