1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 20:44:56 +00:00

omped it up

This commit is contained in:
Joe Myre 2009-05-24 10:41:35 -05:00
parent bf2d9de16a
commit 9c331dce49
3 changed files with 27 additions and 0 deletions

View File

@ -338,6 +338,9 @@ void update_stuff(void)
/* clear speeds and up status in case device was removed and doesn't get /* clear speeds and up status in case device was removed and doesn't get
* updated */ * updated */
#ifdef HAVE_OPENMP
#pragma omp parallel for
#endif /* HAVE_OPENMP */
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (netstats[i].dev) { if (netstats[i].dev) {
netstats[i].up = 0; netstats[i].up = 0;

View File

@ -3898,9 +3898,15 @@ static void generate_text_internal(char *p, int p_max_size,
#endif #endif
if(!obj->a) obj->a = DEFAULT_BAR_WIDTH_NO_X; if(!obj->a) obj->a = DEFAULT_BAR_WIDTH_NO_X;
barnum = round_to_int( ( barnum * obj->a ) / 100); barnum = round_to_int( ( barnum * obj->a ) / 100);
#ifdef HAVE_OPENMP
#pragma omp parallel for
#endif /* HAVE_OPENMP */
for(i=0; i<barnum; i++) { for(i=0; i<barnum; i++) {
*(p+i)='#'; *(p+i)='#';
} }
#ifdef HAVE_OPENMP
#pragma omp parallel for
#endif /* HAVE_OPENMP */
for(; i < obj->a; i++) { for(; i < obj->a; i++) {
*(p+i)='_'; *(p+i)='_';
} }
@ -5288,13 +5294,22 @@ static void generate_text_internal(char *p, int p_max_size,
struct text_object * objsub = obj->sub; struct text_object * objsub = obj->sub;
p[0]=0; p[0]=0;
#ifdef HAVE_OPENMP
#pragma omp parallel for
#endif /* HAVE_OPENMP */
for(i=0; i<2; i++) { for(i=0; i<2; i++) {
nr_rows[i] = 1; nr_rows[i] = 1;
nextstart = 0; nextstart = 0;
ll_rows[i] = malloc(sizeof(struct llrows)); ll_rows[i] = malloc(sizeof(struct llrows));
current[i] = ll_rows[i]; current[i] = ll_rows[i];
#ifdef HAVE_OPENMP
#pragma omp parallel for
#endif /* HAVE_OPENMP */
for(j=0; j<i; j++) objsub = objsub->sub; for(j=0; j<i; j++) objsub = objsub->sub;
generate_text_internal(buf[i], max_user_text, *objsub, cur); 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++) { for(j=0; buf[i][j] != 0; j++) {
if(buf[i][j] == '\t') buf[i][j] = ' '; if(buf[i][j] == '\t') buf[i][j] = ' ';
if(buf[i][j] == '\n') { 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, current[1]->row);
} }
strcat(p, "\n"); 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; 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++) { for(i=0; i<2; i++) {
while(ll_rows[i] != NULL) { while(ll_rows[i] != NULL) {
current[i]=ll_rows[i]; current[i]=ll_rows[i];

View File

@ -53,6 +53,9 @@ set_temp_output_unit(const char *name)
return 1; return 1;
buf = strdup(name); buf = strdup(name);
#ifdef HAVE_OPENMP
#pragma omp parallel for
#endif /* HAVE_OPENMP */
for (i = 0; i < strlen(name); i++) for (i = 0; i < strlen(name); i++)
buf[i] = tolower(name[i]); buf[i] = tolower(name[i]);