shadowm

Untitled

Nov 9th, 2012
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #include <X11/Xlib.h>
  5. #include <NVCtrl/NVCtrlLib.h>
  6.  
  7. int main(int argc, char **argv)
  8. {
  9.     int res;
  10.     int core_temp;
  11.     Display *disp;
  12.  
  13.     disp = XOpenDisplay(":0.0");
  14.     res = XNVCTRLQueryAttribute(disp, 0, 0, NV_CTRL_GPU_CORE_TEMPERATURE, &core_temp);
  15.     XCloseDisplay(disp);
  16.  
  17.     if(!res) {
  18.         fprintf(stderr, "Could not query NV_CTRL_GPU_CORE_TEMPERATURE attribute!\n");
  19.         return 1;
  20.     }
  21.  
  22.     printf("Core temperature is %d\n", core_temp);
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment