debugging thing
This commit is contained in:
parent
33766c95e9
commit
8aba6313c9
@ -95,8 +95,8 @@ battery_percentage(void)
|
||||
#ifdef CPU_USAGE
|
||||
// stat(2) ->
|
||||
#define CPU_PROC_BASE
|
||||
#define TOTAL "head /proc/stat -n 1 | cut -c 6- | sed 's/ /\\+/g' | bc"
|
||||
#define IDLE "head /proc/stat -n 1 | cut -c 6- | awk '{print $4}'"
|
||||
#define CPU_TOTAL "head /proc/stat -n 1 | cut -c 6- | sed 's/ /\\+/g' | bc"
|
||||
#define CPU_IDLE "head /proc/stat -n 1 | cut -c 6- | awk '{print $4}'"
|
||||
static char*
|
||||
cpu_usage(void)
|
||||
{
|
||||
@ -106,13 +106,13 @@ cpu_usage(void)
|
||||
static char buf[SMALL_BUF];
|
||||
unsigned total, idle;
|
||||
// get the total time
|
||||
query_p = popen(TOTAL, "r");
|
||||
query_p = popen(CPU_TOTAL, "r");
|
||||
fgets(buf, sizeof(buf)-1, query_p);
|
||||
total = atoi(buf);
|
||||
pclose(query_p);
|
||||
|
||||
// get the idle time
|
||||
query_p = popen(IDLE, "r");
|
||||
query_p = popen(CPU_IDLE, "r");
|
||||
fgets(buf, sizeof(buf)-1, query_p);
|
||||
idle = atoi(buf);
|
||||
pclose(query_p);
|
||||
@ -182,7 +182,11 @@ main(void)
|
||||
remainder -= written;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%s\n", stat_output);
|
||||
#else
|
||||
XSetRoot(stat_output);
|
||||
#endif
|
||||
sleep(TIME_DELAY);
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user