Skip to content

Commands

Vortron-rd edited this page Jul 6, 2025 · 5 revisions

Commands

Below is a quick list of some commands in LibHPD to get you started. It is highly recommended that you understand /proc/stat to a minimum degree before attempting to use these. You should also read the source files to get a better understanding of the commands.


cpust

int cpust(int stat, int core)


Returns the total clock ticks that a core has spent on a specific type of task. Set core=-1 to pull data from all cores. The first argument corresponds to a column on /proc/stat. Below is a quick reference:

stats:

  1. user
  2. nice
  3. system
  4. idle
  5. iowait
  6. irq
  7. softirq
  8. steal
  9. guest
  10. guest_nice

Example:

int main() {
    int core7idletime = cpust(4,7);
    fprintf("This is the amount of clock cycles core 7 has spent idling: %s\n",core7idletime);
}

Clone this wiki locally