Kapura/pixelart — pull request #1 by bartmeuris (2014-06-26 12:01:05+00:00)
Title: Added multi-cpu runtime support

Added a commandline option to specify the amount of CPU's that's used and re-configure the Go runtime accordingly.
The -cpu flag is simple, if you use '0', it will use the Go default. Use a negative number and all CPU's available will be used. Otherwise it will use the amount of cpu's specified (given they're smaller than the amount of cpu's available)

The CPU scheduling does affect the image, but on my 4-core 2.3Ghz i5-2410M powered laptop (in windows), it produces the following difference:

```
$ time ./pixelart.exe -seed-x 2048 -seed-y 2048 -cpu 0 -name single.png ; time ./pixelart.exe -seed-x 2048 -seed-y 2048 -cpu -1
Using 1 CPU's
count: 0 | Painting 0, 0, 0
count: 2097152 | Painting 40, 77, 44
count: 4194304 | Painting 45, 152, 94
count: 6291456 | Painting 88, 169, 174
count: 8388608 | Painting 90, 231, 152
count: 10485760 | Painting 158, 90, 34
count: 12582912 | Painting 194, 167, 211
count: 14680064 | Painting 198, 239, 101
this last one takes the longest :(
Drawing...

real 10m47.563s
user 0m0.015s
sys 0m0.000s
```
Produced this:
![single cpu image](http://i.imgur.com/XzGSfCz.png)

```
Using 4 CPU's
count: 0 | Painting 0, 0, 0
count: 2097152 | Painting 71, 87, 164
count: 4194304 | Painting 64, 57, 36
count: 6291456 | Painting 112, 108, 120
count: 8388608 | Painting 14, 252, 85
count: 10485760 | Painting 178, 196, 177
count: 12582912 | Painting 103, 235, 19
count: 14680064 | Painting 181, 237, 50
this last one takes the longest :(
Drawing...

real 7m6.219s
user 0m0.000s
sys 0m0.016s
```
Produced this:
![multi cpu image](http://i.imgur.com/k035Uvd.png)