#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"
+#include <cpu.h>
+#include <pmem.h>
#endif
struct psensor *psensor_create(char *id,
struct psensor **psensor_list_add(struct psensor **sensors,
struct psensor *sensor)
{
- int size = psensor_list_size(sensors);
+ int size;
+
+ size = psensor_list_size(sensors);
struct psensor **result
= malloc((size + 1 + 1) * sizeof(struct psensor *));
return result;
}
+void psensor_list_append(struct psensor ***sensors, struct psensor *sensor)
+{
+ struct psensor **tmp;
+
+ if (!sensor)
+ return ;
+
+ tmp = psensor_list_add(*sensors, sensor);
+
+ if (tmp != *sensors) {
+ free(*sensors);
+ *sensors = tmp;
+ }
+}
+
+
struct psensor *psensor_list_get_by_id(struct psensor **sensors, const char *id)
{
struct psensor **sensors_cur = sensors;
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)
{
}
#endif
+#ifdef HAVE_GTOP
+ mem_psensor_list_add(&psensors, values_max_length);
+#endif
+
if (!psensors) { /* there is no detected sensors */
psensors = malloc(sizeof(struct psensor *));
*psensors = NULL;
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)
if (type & SENSOR_TYPE_TEMP)
return "Temperature";
- if (type & SENSOR_TYPE_FAN)
+ if (type & SENSOR_TYPE_RPM)
return "Fan";
if (type & SENSOR_TYPE_CPU)
if (type & SENSOR_TYPE_REMOTE)
return "Remote";
+ if (type & SENSOR_TYPE_MEMORY)
+ return "Memory";
+
return "N/A";
}
#ifdef HAVE_GTOP
cpu_psensor_list_update(sensors);
+ mem_psensor_list_update(sensors);
#endif
if (psensor_list_contains_type(sensors, SENSOR_TYPE_HDDTEMP))