title: How to get cpu usage of current tab from chrome
body: <p>I am using the chrome extension api chrome.processes and chrome.tabs and have been trying to get the cpu usage of current tab only.</p>
  
  <p>I looked at the chromium example code for reference but the purpose of its code is to display all information of all the processes on chrome but i only need the current tab"s information.</p>
  
  <p>this is my code</p>
  
  <pre><code>var tid;
  var cpu;
  
  chrome.tabs.get(tabid, function(tabid) {
      tid = tabid.id;
  });
  chrome.processes.onUpdatedWithMemory.addListener(
      function(processes) {
          for (pid in processes) {
              if (processes[pid].id = tid) {
  
                  cpu = processes[pid].id.cpu;
                  return;
              }
          }
      });
  </code></pre>
  
  <p>I didn't receive any error message but when I debug it, the value of tid is always undefined and the processes array is looping fine.</p>