Py3status: sysdata - all cpu cores utilization

Created on 13 Apr 2018  路  9Comments  路  Source: ultrabug/py3status

Hi,

is there a way to get all cores cpu utilization in sysdata module?

Thanks :)

Most helpful comment

@fam4r If you want a solution today, you can use pinkybar. Look under extra/py3status for a module to use. You will want to specify --coresload in your ~/.pinky config. That should be just it.

All 9 comments

Skip parsing the first cpu row

cpu  1363194 10160 209260 3269639 38912 0 2847 0 0 0
cpu0 447009 3346 72632 1096772 13624 0 49 0 0 0
cpu1 460223 3324 67454 1089434 12746 0 78 0 0 0
cpu2 455961 3489 69173 1083432 12540 0 2719 0 0 0
#define IDLE_NUM 3
#define LOOP_ITERZ 10

// z is the number that "cpuNUM" matches
for (x = 0; x < z; x++) {
  for (y = 0; y < LOOP_ITERZ; y++) {
    total[x] += core_active[x][y];
  }

  diff_total[x]     = total[x] - previous_total[x];
  diff_idle[x]      = core_active[x][IDLE_NUM] - previous_idle[x];

  // static variables
  previous_total[x] = total[x];
  previous_idle[x]  = core_active[x][IDLE_NUM];

  percent[x]        = 0;
  if (0 != diff_total[x]) {
    percent[x]      = (100 * (diff_total[x] - diff_idle[x])) / diff_total[x];
  }

  printf("%d%% ", percent[x]);
}

@fam4r If you want a solution today, you can use pinkybar. Look under extra/py3status for a module to use. You will want to specify --coresload in your ~/.pinky config. That should be just it.

@lasers Thank you.

Currently using indicated module, works fine, even though I prefer to not install other programs.

@lasers thank you! Works great :smile:

Is there any difference in measuring temperature with that module or with lm_sensors module?

sysdata parses the command sensor for only the first cpu temperature. lm_sensors parses the raw command sensors -u for literally everything. There shouldn't be any differences in measuring because we're getting the numbers from output... and not measuring the sensors ourselves.

Ok, awesome.
The module is working good. Thank you.

@lasers if you want, the issue can be closed.

@ultrabug Do you want to close this? (ie forgo a feature)

since @fam4r says so, yes closing thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IgnisDa picture IgnisDa  路  5Comments

ertwro picture ertwro  路  4Comments

root360-AndreasUlm picture root360-AndreasUlm  路  5Comments

CuriousFu picture CuriousFu  路  4Comments

PetrusZ picture PetrusZ  路  4Comments