1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

convert cpu_barval to double

This commit is contained in:
Phil Sutter 2009-12-04 01:19:07 +01:00
parent bfd7eabc0f
commit d46a2cb1b2
3 changed files with 6 additions and 6 deletions

View File

@ -484,9 +484,9 @@ uint8_t cpu_percentage(struct text_object *obj)
return round_to_int(info.cpu_usage[obj->data.i] * 100.0); return round_to_int(info.cpu_usage[obj->data.i] * 100.0);
} }
uint8_t cpu_barval(struct text_object *obj) double cpu_barval(struct text_object *obj)
{ {
return round_to_int(info.cpu_usage[obj->data.i] * 255.0); return info.cpu_usage[obj->data.i];
} }
#define PRINT_HR_GENERATOR(name) \ #define PRINT_HR_GENERATOR(name) \

View File

@ -71,7 +71,7 @@ uint8_t loadgraphval(struct text_object *);
#endif /* X11 */ #endif /* X11 */
uint8_t cpu_percentage(struct text_object *); uint8_t cpu_percentage(struct text_object *);
uint8_t cpu_barval(struct text_object *); double cpu_barval(struct text_object *);
void print_mem(struct text_object *, char *, int); void print_mem(struct text_object *, char *, int);
void print_memeasyfree(struct text_object *, char *, int); void print_memeasyfree(struct text_object *, char *, int);

View File

@ -407,19 +407,19 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
DBGP2("Adding $cpu for CPU %d", obj->data.i); DBGP2("Adding $cpu for CPU %d", obj->data.i);
END OBJ(cpugauge, &update_cpu_usage) END OBJ(cpugauge, &update_cpu_usage)
SCAN_CPU(arg, obj->data.i); SCAN_CPU(arg, obj->data.i);
scan_gauge(obj, arg, 255); scan_gauge(obj, arg, 1);
obj->callbacks.gaugeval = &cpu_barval; obj->callbacks.gaugeval = &cpu_barval;
DBGP2("Adding $cpugauge for CPU %d", obj->data.i); DBGP2("Adding $cpugauge for CPU %d", obj->data.i);
END OBJ(cpubar, &update_cpu_usage) END OBJ(cpubar, &update_cpu_usage)
SCAN_CPU(arg, obj->data.i); SCAN_CPU(arg, obj->data.i);
scan_bar(obj, arg, 255); scan_bar(obj, arg, 1);
obj->callbacks.barval = &cpu_barval; obj->callbacks.barval = &cpu_barval;
DBGP2("Adding $cpubar for CPU %d", obj->data.i); DBGP2("Adding $cpubar for CPU %d", obj->data.i);
#ifdef X11 #ifdef X11
END OBJ(cpugraph, &update_cpu_usage) END OBJ(cpugraph, &update_cpu_usage)
char *buf = 0; char *buf = 0;
SCAN_CPU(arg, obj->data.i); SCAN_CPU(arg, obj->data.i);
buf = scan_graph(obj, arg, 255); buf = scan_graph(obj, arg, 1);
DBGP2("Adding $cpugraph for CPU %d", obj->data.i); DBGP2("Adding $cpugraph for CPU %d", obj->data.i);
if (buf) free(buf); if (buf) free(buf);
obj->callbacks.graphval = &cpu_barval; obj->callbacks.graphval = &cpu_barval;