Added NVidia GPU graphics, memory, PCIe and video usage.
[psensor.git] / src / lib / psensor.c
index 61ef19d..ec145b2 100644 (file)
 #include <libintl.h>
 #define _(str) gettext(str)
 
-#include "hdd.h"
-#include "psensor.h"
-#include "lmsensor.h"
+#include <hdd.h>
+#include <psensor.h>
+#include <lmsensor.h>
+#include <temperature.h>
 
 #ifdef HAVE_GTOP
 #include "cpu.h"
@@ -209,16 +210,6 @@ int is_fan_type(unsigned int type)
        return type & SENSOR_TYPE_FAN;
 }
 
-double celsius_to_fahrenheit(double c)
-{
-       return c * (9.0/5.0) + 32;
-}
-
-double fahrenheit_to_celsius(double f)
-{
-       return (f - 32) * (5.0/9.0);
-}
-
 char *
 psensor_value_to_str(unsigned int type, double value, int use_celsius)
 {
@@ -437,8 +428,20 @@ struct psensor **get_all_sensors(int use_libatasmart, int values_max_length)
 
 const char *psensor_type_to_str(unsigned int type)
 {
-       if (type & SENSOR_TYPE_NVCTRL)
-               return "NVidia GPU";
+       if (type & SENSOR_TYPE_NVCTRL) {
+               if (type & SENSOR_TYPE_TEMP)
+                       return "Temperature";
+               else if (type & SENSOR_TYPE_GRAPHICS)
+                       return "Graphics usage";
+               else if (type & SENSOR_TYPE_VIDEO)
+                       return "Video usage";
+               else if (type & SENSOR_TYPE_MEMORY)
+                       return "Memory usage";
+               else if (type & SENSOR_TYPE_PCIE)
+                       return "PCIe usage";
+               else
+                       return "NVIDIA GPU";
+       }
 
        if (type & SENSOR_TYPE_ATIADL) {
                if (type & SENSOR_TYPE_TEMP)