Locked Reg search at specific processor usage

  • Friday, March 09, 2012 9:28 AM
     
     

    Hey,

    I was wondering is it possible to search the registry for a string containing "shutdown" but as a proccess wich takes about 20% processor power instead of the 50% i cant quite afford. Its a nasty joke going around school atm to stick a shutdown command on computer startup, was gonna see if i could do something about it.


    Fred

All Replies

  • Friday, March 09, 2012 11:15 AM
     
     
    I'm not sure what's exactly your intention. I understand that you want to search the registry, but I don't know what "but as a proccess wich takes about 20% processor power instead of the 50% i cant quite afford." means.

    Armin

  • Friday, March 09, 2012 3:30 PM
     
     

    Youre wording is a bit convoluted in my opinion, but by the title of this thread, I'm assuming that once your CPU usage hits a certain percent out of 100%, you want to do something at that point?

    You're going to want to look into WMI objects then :) There's a bunch of Processor return values in there and I think from what I can remember there is a PercentUsed value or something for CPU usage. I can't remember the name of the one though.


    If a post helps you in any way or solves your particular issue, please remember to use the Propose As Answer option or Vote As Helpful
    ~ "The universe is an intelligence test." - Timothy Leary ~

  • Monday, March 12, 2012 2:45 PM
     
     
    Im guessing the search goes faster the more cpu it takes to run and basically i want it to run but with the slowness of the computers at school i need a solution that will still allow me to work. What im looking for is a way to limit the processor usage to a certain percent.

    Fred

  • Monday, March 12, 2012 3:30 PM
     
     Answered Has Code

    Set the Thread priority to an appropriate value, e.g. 

    Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.BelowNormal

    or to ThreadPriority.Lowest

    The OS will take care of the rest.


    Armin

    • Marked As Answer by Fred4153 Tuesday, March 13, 2012 8:50 AM
    •