1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +00:00

* Improved performance slightly

* Added mpd_interval config option to specify an update interval for the
    mpd thread

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@954 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2007-09-02 03:02:33 +00:00
parent 38d2cdfc84
commit 16ea4f6587
5 changed files with 42 additions and 7 deletions

View File

@ -1,5 +1,10 @@
# $Id$ # $Id$
2007-09-01
* Improved performance slightly
* Added 'mpd_interval' config option to specify an update interval for the
mpd thread
2007-08-31 2007-08-31
* _Really_ fix mpd SIGPIPE issues * _Really_ fix mpd SIGPIPE issues
* Fix timed thread race condition, seen esp. on new kernel scheduler (cfs). * Fix timed thread race condition, seen esp. on new kernel scheduler (cfs).

View File

@ -269,6 +269,13 @@
<para></para></listitem> <para></para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><command><option>mpd_interval</option></command></term>
<listitem>
MPD thread update interval (defaults to Conky's update interval)
<para></para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><command><option>net_avg_samples</option></command></term> <term><command><option>net_avg_samples</option></command></term>
<listitem> <listitem>

View File

@ -234,7 +234,7 @@ void update_stuff()
if (NEED(INFO_MPD)) { if (NEED(INFO_MPD)) {
if (!mpd_timed_thread) { if (!mpd_timed_thread) {
init_mpd_stats(&info); init_mpd_stats(&info);
mpd_timed_thread = timed_thread_create((void*)update_mpd, (void*) NULL, update_interval * 1000000); mpd_timed_thread = timed_thread_create((void*)update_mpd, (void*) NULL, info.mpd.interval * 1000000);
if (!mpd_timed_thread) { if (!mpd_timed_thread) {
ERR("Failed to create MPD timed thread"); ERR("Failed to create MPD timed thread");
} }

View File

@ -687,7 +687,6 @@ static void new_font(char *buf, char * args) {
struct special_t *s = new_special(buf, FONT); struct special_t *s = new_special(buf, FONT);
int tmp = selected_font; int tmp = selected_font;
selected_font = s->font_added = 0; selected_font = s->font_added = 0;
load_fonts();
selected_font = tmp; selected_font = tmp;
} }
} }
@ -1113,6 +1112,7 @@ enum text_object_type {
OBJ_mpd_host, OBJ_mpd_host,
OBJ_mpd_port, OBJ_mpd_port,
OBJ_mpd_password, OBJ_mpd_password,
OBJ_mpd_interval,
OBJ_mpd_bar, OBJ_mpd_bar,
OBJ_mpd_elapsed, OBJ_mpd_elapsed,
OBJ_mpd_length, OBJ_mpd_length,
@ -3878,9 +3878,7 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
#endif /* __OpenBSD__ */ #endif /* __OpenBSD__ */
OBJ(font) { OBJ(font) {
#ifdef X11
new_font(p, obj->data.s); new_font(p, obj->data.s);
#endif /* X11 */
} }
void format_diskio(unsigned int diskio_value) void format_diskio(unsigned int diskio_value)
{ {
@ -6814,9 +6812,9 @@ static void set_default_configurations(void)
own_window = 0; own_window = 0;
window.type=TYPE_NORMAL; window.type=TYPE_NORMAL;
window.hints=0; window.hints=0;
strcpy(window.class_name, "Conky"); strcpy(window.class_name, "Conky");
update_uname(); update_uname();
sprintf(window.title,"%s - conky",info.uname_s.nodename); sprintf(window.title,"%s - conky",info.uname_s.nodename);
#endif #endif
stippled_borders = 0; stippled_borders = 0;
border_margin = 3; border_margin = 3;
@ -7050,6 +7048,12 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
else else
CONF_ERR; CONF_ERR;
} }
CONF("mpd_interval") {
if (value)
info.mpd.interval = strtod(value, 0);
else
CONF_ERR;
}
#endif #endif
#ifdef __OpenBSD__ #ifdef __OpenBSD__
CONF("sensor_device") { CONF("sensor_device") {
@ -7318,6 +7322,12 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
update_interval = strtod(value, 0); update_interval = strtod(value, 0);
else else
CONF_ERR; CONF_ERR;
#ifdef MPD
if (info.mpd.interval == 0) {
// default to update_interval
info.mpd.interval = update_interval;
}
#endif /* MPD */
} }
CONF("total_run_times") { CONF("total_run_times") {
if (value) if (value)
@ -7404,6 +7414,12 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
fclose(fp); fclose(fp);
#undef CONF_ERR #undef CONF_ERR
#ifdef MPD
if (info.mpd.interval == 0) {
// default to update_interval
info.mpd.interval = update_interval;
}
#endif /* MPD */
} }
@ -7608,6 +7624,12 @@ int main(int argc, char **argv)
case 'u': case 'u':
update_interval = strtod(optarg, 0); update_interval = strtod(optarg, 0);
#ifdef MPD
if (info.mpd.interval == 0) {
// default to update_interval
info.mpd.interval = update_interval;
}
#endif /* MPD */
break; break;
case 'i': case 'i':

View File

@ -177,6 +177,7 @@ struct mpd_s {
unsigned int port; unsigned int port;
char host[128]; char host[128];
char password[128]; char password[128];
double interval;
float progress; float progress;
int bitrate; int bitrate;
int length; int length;