set max threshold for nvidia
authorJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 18 Oct 2014 11:19:08 +0000 (13:19 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 18 Oct 2014 11:19:08 +0000 (13:19 +0200)
src/lib/nvidia.c

index d3bbb58..65cc9a7 100644 (file)
@@ -272,6 +272,7 @@ static struct psensor *create_nvidia_sensor(int id, int subtype, int value_len)
        int type;
        size_t n;
        struct psensor *s;
+       double v;
 
        type = SENSOR_TYPE_NVCTRL | subtype;
 
@@ -293,6 +294,13 @@ static struct psensor *create_nvidia_sensor(int id, int subtype, int value_len)
        s->provider_data = malloc(sizeof(int));
        set_nvidia_id(s, id);
 
+       if ((type & SENSOR_TYPE_GPU) && (type & SENSOR_TYPE_TEMP)) {
+               v = get_att(NV_CTRL_TARGET_TYPE_GPU,
+                           id,
+                           NV_CTRL_GPU_CORE_THRESHOLD);
+               s->max = v;
+       }
+
        free(strnid);
 
        return s;