some useful functions

1. get CPU cores.