Skip to content
⌘ NSIS Forum Archive

High CPU usage on Vista with System plugin

7 posts

wraithdu#

High CPU usage on Vista with System plugin

Referencing this thread discussion -

I'm trying to implement a ProcessWait function (macro) in NSIS. Currently I'm using a series of psapi calls to enumerate the process pids, then open a handle to each process, get the process base name from the handle, and check that name against my target. It works fine in a ProcessExists sense (...


I found that I only see this problem on Vista, not XP. So I was wondering if the System plugin has some performance or compatibility issues in Vista, or if there was anything I could do to lower the CPU usage.
Anders#
Instead of using the system plugin, you could create a nsis plugin that does this (Does not solve your problem, but I have no idea why it would use more CPU on Vista)

...and the logiclib is mostly preprocessor stuff, should not really slow you down
Afrow UK#
Put it in a Function and you won't get high CPU use. The reason this is happening is because for every instruction it has to change the progress bar. If you put it in a Function rather than a Section, then the progress bar doesn't get touched.

Stu
wraithdu#
Hmmm, interesting. Does the progress bar update apply if I'm using the

SilentInstall silent

directive?

@Anders
I'm attempting to use only the default NSIS plugins to do this.
wraithdu#
Nope, no luck. I put my loop in a function and it uses the same amount of CPU.

Since this doesn't happen on XP, it has to be some problem with Vista. A strange UAC issue maybe?
wraithdu#
Ok, I figured it out. Under Vista, if I don't specify a value for

RequestExecutionLevel

the CPU usage is more than double, 9-12% vs 20-27% !! And it doesn't matter what value I assign, user or admin. But omitting it will cause this problem.

Any insight into why this happens? I thought that Vista recognized NSIS installers and automatically assigned the correct execution level?
Anders#
RequestExecutionLevel does two things, it tells Vista if you need to be admin or not (otherwise, Vista will detect NSIS installers and force you to elevate no matter what)

The other thing it does is telling vista to turn off registry and folder redirection and other compability hacks