mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 12:10:03 +00:00
add entropy_perc
There is no rounding done, so e.g. 3.6% get 3%. But double casting and calling round_to_int() is just too ugly.
This commit is contained in:
parent
9d7fc86275
commit
20e4e19f83
@ -1,3 +1,6 @@
|
||||
2009-06-04
|
||||
* Add entropy_perc printing the available entropy as percentage
|
||||
|
||||
2009-05-31
|
||||
* Fix hostname resolution for mpd_host
|
||||
|
||||
|
@ -725,6 +725,15 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>entropy_perc</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Percentage of entropy available in comparison to the poolsize
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>entropy_poolsize</option></command>
|
||||
|
@ -945,6 +945,7 @@ static void free_text_objects(struct text_object *root, int internal)
|
||||
break;
|
||||
#endif /* HDDTEMP */
|
||||
case OBJ_entropy_avail:
|
||||
case OBJ_entropy_perc:
|
||||
case OBJ_entropy_poolsize:
|
||||
case OBJ_entropy_bar:
|
||||
break;
|
||||
@ -2761,6 +2762,7 @@ static struct text_object *construct_text_object(const char *s,
|
||||
tcp_portmon_init(arg, &obj->data.tcp_port_monitor);
|
||||
#endif /* TCP_PORT_MONITOR */
|
||||
END OBJ(entropy_avail, INFO_ENTROPY)
|
||||
END OBJ(entropy_perc, INFO_ENTROPY)
|
||||
END OBJ(entropy_poolsize, INFO_ENTROPY)
|
||||
END OBJ(entropy_bar, INFO_ENTROPY)
|
||||
SIZE_DEFAULTS(bar);
|
||||
@ -5395,6 +5397,11 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(entropy_avail) {
|
||||
snprintf(p, p_max_size, "%d", cur->entropy.entropy_avail);
|
||||
}
|
||||
OBJ(entropy_perc) {
|
||||
percent_print(p, p_max_size,
|
||||
cur->entropy.entropy_avail *
|
||||
100 / cur->entropy.poolsize);
|
||||
}
|
||||
OBJ(entropy_poolsize) {
|
||||
snprintf(p, p_max_size, "%d", cur->entropy.poolsize);
|
||||
}
|
||||
|
@ -396,6 +396,7 @@ enum text_object_type {
|
||||
OBJ_scroll,
|
||||
OBJ_combine,
|
||||
OBJ_entropy_avail,
|
||||
OBJ_entropy_perc,
|
||||
OBJ_entropy_poolsize,
|
||||
OBJ_entropy_bar,
|
||||
#ifdef APCUPSD
|
||||
|
Loading…
Reference in New Issue
Block a user