Question

I running a simple console based C++ application in XCODE 5.

I have a 2.8GHZ Intel Core i7 processor. If I look at the CPU utilization, following are the stats:

My_Program: 100%
Other Processes: 168%
Free: 537%

Is it possible to utilize the free 537% towards My_Program ? Is it possible to increase the CPU utilization > 100% in XCODE or in Eclipse ?

Thanks, Any suggestions are appreciated.

Was it helpful?

Solution

The only way is to parallelize Your_Program. That is enable to your program to use more at least than one thread (more than one processor if necessary) that is by definition capped at 1 single virtual core of full use (thus 100% of "CPU" that you see on 'top' on linux or equivalent in other system)

Check out OpenMP and OpenMPI.

If you want to use a single machine I strongly suggest OpenMP to start take acquaintance with parallel programming. The internet is full of tutorials and 'hello world's in different languages.

Parallelizing simple loops with OpenMP is a trivial task on C++, but to master the trick and concepts of parallelization is a life-lasting endeavor.

OTHER TIPS

If I had to guess (I know nothing about OSX) I'd say that each 100% represents one core of the CPU. This means that you can increase it above 100% by parallelizing your code, which is not trivial (or even possible, depending on what your code does). I might be completely wrong though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top