title: Android: Find out which core the thread is running on
body: <p>I'm trying to write code for Android which would give me some kind of information (id?) of the processor and the core on which a thread is running on. </p>
  
  <p>I've google'd and grep'ed the sources for some inspiration but with no luck. All I know is, that most likely I will need some C/C++ calls.</p>
  
  <p>What I have working is the following:</p>
  
  <pre><code>#include &lt;jni.h&gt;
  
  int getCpuId() {
      // missing code
      return 0;
  }
  
  int getCoreId() {
      // missing code    
      return 0;
  } 
  
  JNIEXPORT int JNICALL Java_com_spendoptima_Utils_getCpuId(JNIEnv * env,
          jobject obj) {
      return getCpuId();
  }
  
  JNIEXPORT int JNICALL Java_com_spendoptima_Utils_getCoreId(JNIEnv * env,
          jobject obj) {
      return getCoreId();
  }
  </code></pre>
  
  <p>The whole project compiles and runs just fine. I'm able to call the functions from within Java and I get the proper responses.</p>
  
  <p>Is here anybody who could fill in the blanks?</p>