Modeling power consumption in multicore CPUs with multithreading and frequency scaling