How do I determine the CPU speed needed to run a program?

Discussion in 'Programmer's Corner' started by integral, Feb 25, 2011.

  1. integral

    Thread Starter New Member

    Aug 19, 2010
    22
    0
    I wrote program in C++ using visual studio express which continuously takes a frame from a camera, detects an area in the frame and then performs some calculations.

    I have tested the program on two computers. The program runs well on computer A but is very slow on computer B. The program outputs to the computer screen a live video of what the camera is seeing and it appears as if a number of frames are been lost. For example, I will see an object entering on the left side of the field of view of the camera, the live video will freeze and then a few moments later the object will be on the right side of the field of view of the camera. The computer completely missed the frames showing the object moving across the field of view.

    Computer A Specs:
    OS: Windows 7
    Memory: 3 GB RAM
    CPU: Processor AMD Athlon(tm) II X2 215 Processor, 2700 Mhz, 2 Core(s), 2 Logical Processor(s)

    Computer B Specs:
    OS: Windows XP
    Memory: 1GB RAM
    CPU: x86 Family 6 Model 10 Stepping 9 CentaurHauls ~999 Mhz

    Computer B
    On computer B, when only the start up programs and processes are running the CPU usage fluctuates around 13%. When my program is running, under task manager I can see that the CPU usage fluctuates between 95% and 99%.

    Computer A
    On computer A, with my program running the total CPU usage is around 30%. With only the start up processing running CPU usage is about 3%.

    The Question:
    How do I determine what the necessary CPU speed is to run my program. I know that the processor for computer A will do the job but how do I determine what the minimize CPU speed needed is for it not to be slow and sluggish?
     
  2. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    Video stuff in any computer a mostly related to video hardware (Graphic card), yes a bit depends on CPU and RAM also.I think in computer B you dont have proper graphic card (it may be onboard VGA) as a result your program consumes most of the CPU for video processing and you see CPU usage as 95% to 99% in all total.Graphic cards have separate processor known as GPU (Graphic Processing Unit) to process video stuffs.

    Good luck
     
  3. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    You need to know more about video hardwares,it will address your graphic needs.
     
  4. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
    I could be wrong, but I don't think this is about driving video graphics cards.

    It would sound to me that you have a resource conflict somewhere that is slowing you down. Can you not write in a monitor that captures a time stamp at various sections of your prog to see where it's bogging?
     
  5. DumboFixer

    Active Member

    Feb 10, 2009
    219
    34
    For computer B I'd look at adding more memory - in my experience 1GB isn't enough for XP,especially with a 1GHz processor. I upgraded mine to 4GB and the difference was really noticable.
     
  6. integral

    Thread Starter New Member

    Aug 19, 2010
    22
    0
    I am not sure if I understand what you mean but this is what I did.
    I wrote a program that just captures a frame from the camera and saves it to disk as a jpg file with a time stamp (min:sec:millisecond). When I do that here are the results I get

    Computer A
    14 to 15 frames per second

    Computer B
    9 to 10 frames per second


    Btw, I am working with OpenCV.
     
  7. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
    That is good, you do know what I mean. So, you have some indication on activity of the I/O channel. I assume you are requesting the data. What would be the duration between requests. Comparing those two would indicate where the larger discrepency lies, in the aquisition, or in the 'processing' of the data. Although your aquisition comparison shows an obvious difference, is it really a problem considering the larger concern?

    Of course once you discover the general area that is causing the larger grief, you will have to deep deeper and deeper until you realize your restraints, or options.

    I'm just throughing out some general ideas as how you might troubleshoot your problem. I don't have any Windows programming knowledge, so at some point I'm done.

    However, I have played plenty with the digital camera thing, and after a quick review of OpenCV, I think I'll look a bit deeper.
     
  8. integral

    Thread Starter New Member

    Aug 19, 2010
    22
    0
    I just wanted to add more information about the computer graphics card with the hope that it could shed some light on my situation.

    I got this information from "dxdiag" at the "run" prompt:

    Computer A:
    Card name: NVIDIA GeForce 6150SE nForce 430
    DAC type: Integrated RAMDAC
    Display Memory: 1401 MB

    Computer B:
    Card name: VIA/S3G UniChrome Pro II IGP
    DAC type: Internal
    Display Memory: 64.0 MB
     
Loading...