1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-06 05:17:57 +00:00

Code formatting.

This commit is contained in:
Brenden Matthews 2009-08-05 14:35:20 -06:00
parent 4d35595e5e
commit 2115d925e4

View File

@ -106,7 +106,7 @@ static struct process *new_process(int p)
#ifdef IOSTATS #ifdef IOSTATS
process->previous_read_bytes = ULLONG_MAX; process->previous_read_bytes = ULLONG_MAX;
process->previous_write_bytes = ULLONG_MAX; process->previous_write_bytes = ULLONG_MAX;
#endif #endif /* IOSTATS */
process->counted = 1; process->counted = 1;
/* process_find_name(process); */ /* process_find_name(process); */
@ -304,7 +304,7 @@ static int process_parse_io(struct process *process)
return 0; return 0;
} }
#endif #endif /* IOSTATS */
/****************************************** /******************************************
* Get process structure for process pid * * Get process structure for process pid *
@ -318,15 +318,13 @@ static int calculate_stats(struct process *process)
/* compute each process cpu usage by reading /proc/<proc#>/stat */ /* compute each process cpu usage by reading /proc/<proc#>/stat */
rc = process_parse_stat(process); rc = process_parse_stat(process);
if (rc) if (rc) return 1;
return 1;
/* rc = process_parse_statm(process); if (rc) return 1; */ /* rc = process_parse_statm(process); if (rc) return 1; */
#ifdef IOSTATS #ifdef IOSTATS
rc = process_parse_io(process); rc = process_parse_io(process);
if (rc) if (rc) return 1;
return 1; #endif /* IOSTATS */
#endif
/* /*
* Check name against the exclusion list * Check name against the exclusion list
@ -507,7 +505,7 @@ static void calc_io_each(void)
for (p = first_process; p; p = p->next) for (p = first_process; p; p = p->next)
p->io_perc = 100.0 * (p->read_bytes + p->write_bytes) / (float) sum; p->io_perc = 100.0 * (p->read_bytes + p->write_bytes) / (float) sum;
} }
#endif #endif /* IOSTATS */
/****************************************** /******************************************
* Find the top processes * * Find the top processes *
@ -572,7 +570,7 @@ static int compare_io(struct process *a, struct process *b)
return 0; return 0;
} }
} }
#endif #endif /* IOSTATS */
/* insert this process into the list in a sorted fashion, /* insert this process into the list in a sorted fashion,
* or destroy it if it doesn't fit on the list */ * or destroy it if it doesn't fit on the list */
@ -655,7 +653,7 @@ void process_find_top(struct process **cpu, struct process **mem,
struct process **ptime struct process **ptime
#ifdef IOSTATS #ifdef IOSTATS
, struct process **io , struct process **io
#endif #endif /* IOSTATS */
) )
{ {
struct sorted_process *spc_head = NULL, *spc_tail = NULL, *spc_cur = NULL; struct sorted_process *spc_head = NULL, *spc_tail = NULL, *spc_cur = NULL;
@ -663,14 +661,14 @@ void process_find_top(struct process **cpu, struct process **mem,
struct sorted_process *spt_head = NULL, *spt_tail = NULL, *spt_cur = NULL; struct sorted_process *spt_head = NULL, *spt_tail = NULL, *spt_cur = NULL;
#ifdef IOSTATS #ifdef IOSTATS
struct sorted_process *spi_head = NULL, *spi_tail = NULL, *spi_cur = NULL; struct sorted_process *spi_head = NULL, *spi_tail = NULL, *spi_cur = NULL;
#endif #endif /* IOSTATS */
struct process *cur_proc = NULL; struct process *cur_proc = NULL;
unsigned long long total = 0; unsigned long long total = 0;
if (!top_cpu && !top_mem && !top_time if (!top_cpu && !top_mem && !top_time
#ifdef IOSTATS #ifdef IOSTATS
&& !top_io && !top_io
#endif #endif /* IOSTATS */
) { ) {
return; return;
} }
@ -681,7 +679,7 @@ void process_find_top(struct process **cpu, struct process **mem,
process_cleanup(); /* cleanup list from exited processes */ process_cleanup(); /* cleanup list from exited processes */
#ifdef IOSTATS #ifdef IOSTATS
calc_io_each(); /* percentage of I/O for each task */ calc_io_each(); /* percentage of I/O for each task */
#endif #endif /* IOSTATS */
cur_proc = first_process; cur_proc = first_process;
@ -707,18 +705,14 @@ void process_find_top(struct process **cpu, struct process **mem,
insert_sp_element(spi_cur, &spi_head, &spi_tail, MAX_SP, insert_sp_element(spi_cur, &spi_head, &spi_tail, MAX_SP,
&compare_io); &compare_io);
} }
#endif #endif /* IOSTATS */
cur_proc = cur_proc->next; cur_proc = cur_proc->next;
} }
if (top_cpu) if (top_cpu) sp_acopy(spc_head, cpu, MAX_SP);
sp_acopy(spc_head, cpu, MAX_SP); if (top_mem) sp_acopy(spm_head, mem, MAX_SP);
if (top_mem) if (top_time) sp_acopy(spt_head, ptime, MAX_SP);
sp_acopy(spm_head, mem, MAX_SP);
if (top_time)
sp_acopy(spt_head, ptime, MAX_SP);
#ifdef IOSTATS #ifdef IOSTATS
if (top_io) if (top_io) sp_acopy(spi_head, io, MAX_SP);
sp_acopy(spi_head, io,MAX_SP); #endif /* IOSTATS */
#endif
} }