4

When i write miner.start() on my testnet geth node, it shows Starting mining operation (CPU=4 TOT=6). What is the meaning of "CPU = 4 , TOT =6" and what does the changing value of these parameter signify?

2

The first part of the message, CPU=4, states that you are mining with 4 CPU threads.

When you execute the miner.start() command, geth will start mining with the maximum number of CPU threads you have installed on your computer.

You can also specify miner.start({n}), where geth will only start {n} threads, e.g., miner.start(1).

The second part of the message, TOT=6, is the number of worker agents that geth starts.

Here is the code that emits the message from go-ethereum/miner/miner.go, lines 102 to 124:

func (self *Miner) Start(coinbase common.Address, threads int) {
    atomic.StoreInt32(&self.shouldStart, 1)
    self.threads = threads
    self.worker.coinbase = coinbase
    self.coinbase = coinbase

    if atomic.LoadInt32(&self.canStart) == 0 {
        glog.V(logger.Info).Infoln("Can not start mining operation due to network sync (starts when finished)")
        return
    }

    atomic.StoreInt32(&self.mining, 1)

    for i := 0; i < threads; i++ {
        self.worker.register(NewCpuAgent(i, self.pow))
    }

    glog.V(logger.Info).Infof("Starting mining operation (CPU=%d TOT=%d)\n", threads, len(self.worker.agents))

    self.worker.start()

    self.worker.commitNewWork()
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.