Results 1 to 12 of 12

Thread: need to max out my cpu via code

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    need to max out my cpu via code

    i need to run my cpu at 100% to test the cooling of the system. i know how to write code to max out the ram but what can i do to max out the cpu?


    (i know this is random but any help is welcomed)

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: need to max out my cpu via code

    Just use an endless loop that does some relatively complex calculation inside.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: need to max out my cpu via code

    A simple Do Loop without anything inside of it should do the trick...
    VB Code:
    1. Do
    2. Loop

  4. #4
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: need to max out my cpu via code

    how about an endless loop which creates more threads, o there is no way its usage can be restricted

    VB Code:
    1. Do
    2.  Dim t As New Threading.Thread(AddressOf LoopMe)
    3.  t.Start
    4. Loop
    5.  
    6. Sub LoopMe
    7.  Do
    8.  Loop
    9. End Sub

    good luck stopping the program once you run it though.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: need to max out my cpu via code

    If you have a multi-core processor then you'll need to use additional threads. That's why just a loop wouldn't work for me. Obviously making the loop more complex wouldn't have worked either, but I never said i was smart.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6
    Fanatic Member alexandros's Avatar
    Join Date
    Oct 2002
    Location
    Milky Way Galaxy
    Posts
    694

    Re: need to max out my cpu via code

    call threading.thread.currentthread.sleep

  7. #7
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: need to max out my cpu via code

    Quote Originally Posted by alexandros
    call threading.thread.currentthread.sleep
    they want to max out the cpu not freeze the current application

  8. #8
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: need to max out my cpu via code

    Quote Originally Posted by jmcilhinney
    If you have a multi-core processor then you'll need to use additional threads. That's why just a loop wouldn't work for me.
    You trying to brag?? *sniff sniff* I only have one core...

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    Re: need to max out my cpu via code

    i will give it a shot, my laptop is acting a little weird and i wanted to do some testing before i take it back for warranty work.

    thanks for the ideas!

  10. #10
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: need to max out my cpu via code

    why do you need to do this

    are you checking for accuracy under load becuase you might want to add a test or something on there

  11. #11
    Addicted Member Phreak's Avatar
    Join Date
    Oct 2005
    Location
    Netherlands
    Posts
    132

    Re: need to max out my cpu via code

    Quote Originally Posted by Crash893
    why do you need to do this

    are you checking for accuracy under load becuase you might want to add a test or something on there

    i need to run my cpu at 100% to test the cooling of the system. i know how to write code to max out the ram but what can i do to max out the cpu?
    Thats why he needs to do it... =)
    If i gave you good code/help, then dont forget to RATE
    Dont forget to mark your thread [Resolved] with the tools from the menu above...

  12. #12
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: need to max out my cpu via code

    how can you test if its cooling properly if its not testing the math of the cpu?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width