diff options
author | Jorge Boncompte [DTI2] <jorge@dti2.net> | 2012-05-07 16:53:12 +0000 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2012-05-22 20:35:51 +0200 |
commit | 41af338ecd56b9891d996f0fc850e02318b0c01a (patch) | |
tree | 8543da475e3e82e6a63a8e2c8d8f0175bc447c2d /lib | |
parent | 47d3b6078a6c885e03d28bae3397b71a827473f5 (diff) |
lib: remove RUSAGE_T from struct thread
* thread.c: It's only temporarily used in thread_call() to calculate the
diffs. Saves 80 bytes per copy.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/thread.c | 11 | ||||
-rw-r--r-- | lib/thread.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/thread.c b/lib/thread.c index dd0413b3..784b29c6 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1146,7 +1146,7 @@ int thread_should_yield (struct thread *thread) { quagga_get_relative (NULL); - return (timeval_elapsed(relative_time, thread->ru.real) > + return (timeval_elapsed(relative_time, thread->real) > THREAD_YIELD_TIME_SLOT); } @@ -1175,7 +1175,7 @@ void thread_call (struct thread *thread) { unsigned long realtime, cputime; - RUSAGE_T ru; + RUSAGE_T before, after; /* Cache a pointer to the relevant cpu history thread, if the thread * does not have it yet. @@ -1194,13 +1194,14 @@ thread_call (struct thread *thread) (void * (*) (void *))cpu_record_hash_alloc); } - GETRUSAGE (&thread->ru); + GETRUSAGE (&before); + thread->real = before.real; (*thread->func) (thread); - GETRUSAGE (&ru); + GETRUSAGE (&after); - realtime = thread_consumed_time (&ru, &thread->ru, &cputime); + realtime = thread_consumed_time (&after, &before, &cputime); thread->hist->real.total += realtime; if (thread->hist->real.max < realtime) thread->hist->real.max = realtime; diff --git a/lib/thread.h b/lib/thread.h index dfc51e28..56f4d073 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -77,7 +77,7 @@ struct thread int fd; /* file descriptor in case of read/write. */ struct timeval sands; /* rest of time sands value. */ } u; - RUSAGE_T ru; /* Indepth usage info. */ + struct timeval real; struct cpu_thread_history *hist; /* cache pointer to cpu_history */ char* funcname; }; |