Open zx2c4 opened 4 years ago
It'd be nice if intel-undervolt measure showed the results from the i915 driver, which is in the same uj output as the current rapl source. Here's some code I just wrote to do it:
intel-undervolt measure
#include <stdio.h> #include <stdint.h> #include <inttypes.h> #include <unistd.h> int main(int argc, char *argv[]) { FILE *f; uint64_t this_microjoules, last_microjoules = ~UINT64_C(0); setbuf(stdout, NULL); f = fopen("/sys/kernel/debug/dri/0/i915_energy_uJ", "r"); if (!f) { perror("fopen(/sys/kernel/debug/dri/0/i915_energy_uJ)"); return 1; } printf("Measuring..."); for (;;) { if (fscanf(f, "%" PRIu64, &this_microjoules) != 1) { perror("fscanf"); return 1; } rewind(f); if (last_microjoules != ~UINT64_C(0)) printf("\x1b[0G\x1b[0K%.2f W", (double)(this_microjoules - last_microjoules) / 1000000.0); last_microjoules = this_microjoules; sleep(1); } return 0; }
It'd be nice if
intel-undervolt measure
showed the results from the i915 driver, which is in the same uj output as the current rapl source. Here's some code I just wrote to do it: