From 9c331dce494881b54db75e1e93a4ce6414a61f20 Mon Sep 17 00:00:00 2001 From: Joe Myre Date: Sun, 24 May 2009 10:41:35 -0500 Subject: [PATCH] omped it up --- src/common.c | 3 +++ src/conky.c | 21 +++++++++++++++++++++ src/temphelper.c | 3 +++ 3 files changed, 27 insertions(+) diff --git a/src/common.c b/src/common.c index 17d246f6..2e79ce12 100644 --- a/src/common.c +++ b/src/common.c @@ -338,6 +338,9 @@ void update_stuff(void) /* clear speeds and up status in case device was removed and doesn't get * updated */ + #ifdef HAVE_OPENMP + #pragma omp parallel for + #endif /* HAVE_OPENMP */ for (i = 0; i < 16; i++) { if (netstats[i].dev) { netstats[i].up = 0; diff --git a/src/conky.c b/src/conky.c index bffc9ca5..cbbf46dd 100644 --- a/src/conky.c +++ b/src/conky.c @@ -3898,9 +3898,15 @@ static void generate_text_internal(char *p, int p_max_size, #endif if(!obj->a) obj->a = DEFAULT_BAR_WIDTH_NO_X; barnum = round_to_int( ( barnum * obj->a ) / 100); + #ifdef HAVE_OPENMP + #pragma omp parallel for + #endif /* HAVE_OPENMP */ for(i=0; ia; i++) { *(p+i)='_'; } @@ -5288,13 +5294,22 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object * objsub = obj->sub; p[0]=0; + #ifdef HAVE_OPENMP + #pragma omp parallel for + #endif /* HAVE_OPENMP */ for(i=0; i<2; i++) { nr_rows[i] = 1; nextstart = 0; ll_rows[i] = malloc(sizeof(struct llrows)); current[i] = ll_rows[i]; + #ifdef HAVE_OPENMP + #pragma omp parallel for + #endif /* HAVE_OPENMP */ for(j=0; jsub; generate_text_internal(buf[i], max_user_text, *objsub, cur); + #ifdef HAVE_OPENMP + #pragma omp parallel for reduction (+:nr_rows[i]) + #endif /* HAVE_OPENMP */ for(j=0; buf[i][j] != 0; j++) { if(buf[i][j] == '\t') buf[i][j] = ' '; if(buf[i][j] == '\n') { @@ -5326,8 +5341,14 @@ static void generate_text_internal(char *p, int p_max_size, strcat(p, current[1]->row); } strcat(p, "\n"); + #ifdef HAVE_OPENMP + #pragma omp parallel for + #endif /* HAVE_OPENMP */ for(i=0; i<2; i++) if(current[i]) current[i]=current[i]->next; } + #ifdef HAVE_OPENMP + #pragma omp parallel for + #endif /* HAVE_OPENMP */ for(i=0; i<2; i++) { while(ll_rows[i] != NULL) { current[i]=ll_rows[i]; diff --git a/src/temphelper.c b/src/temphelper.c index 473fbbc7..c2e6966d 100644 --- a/src/temphelper.c +++ b/src/temphelper.c @@ -53,6 +53,9 @@ set_temp_output_unit(const char *name) return 1; buf = strdup(name); + #ifdef HAVE_OPENMP + #pragma omp parallel for + #endif /* HAVE_OPENMP */ for (i = 0; i < strlen(name); i++) buf[i] = tolower(name[i]);