bin/top: Remove busy_wait_time

This commit is contained in:
Pawel Dziepak
2013-12-12 03:18:47 +01:00
parent 4c125ccacd
commit 39f6ced055
+6 -16
View File
@@ -151,8 +151,6 @@ static void
compare( compare(
thread_time_list_t *old, thread_time_list_t *old,
thread_time_list_t *new, thread_time_list_t *new,
bigtime_t old_busy,
bigtime_t new_busy,
bigtime_t uinterval, bigtime_t uinterval,
int refresh int refresh
) )
@@ -238,7 +236,7 @@ compare(
printf("%6s %7s %7s %7s %4s %16s %16s\n", "thid", "total", "user", "kernel", printf("%6s %7s %7s %7s %4s %16s %16s\n", "thid", "total", "user", "kernel",
"%cpu", "team name", "thread name"); "%cpu", "team name", "thread name");
linecount = 1; linecount = 1;
idletime = new_busy - old_busy; idletime = 0;
gtotal = 0; gtotal = 0;
ktotal = 0; ktotal = 0;
utotal = 0; utotal = 0;
@@ -338,7 +336,6 @@ setup_term(bool onlyRows)
static thread_time_list_t static thread_time_list_t
gather( gather(
thread_time_list_t *old, thread_time_list_t *old,
bigtime_t *busy_wait_time,
int refresh int refresh
) )
{ {
@@ -347,7 +344,6 @@ gather(
thread_info t; thread_info t;
team_info tm; team_info tm;
thread_time_list_t times; thread_time_list_t times;
bigtime_t old_busy;
int i; int i;
system_info info; system_info info;
bigtime_t oldLastMeasure; bigtime_t oldLastMeasure;
@@ -358,10 +354,6 @@ gather(
oldLastMeasure = lastMeasure; oldLastMeasure = lastMeasure;
lastMeasure = system_time(); lastMeasure = system_time();
get_system_info(&info);
old_busy = *busy_wait_time;
*busy_wait_time = info._busy_wait_time;
while (get_next_team_info(&tmcookie, &tm) == B_NO_ERROR) { while (get_next_team_info(&tmcookie, &tm) == B_NO_ERROR) {
thcookie = 0; thcookie = 0;
while (get_next_thread_info(tm.team, &thcookie, &t) == B_NO_ERROR) { while (get_next_thread_info(tm.team, &thcookie, &t) == B_NO_ERROR) {
@@ -377,8 +369,7 @@ gather(
setup_term(true); setup_term(true);
screen_size_changed = 0; screen_size_changed = 0;
} }
compare(old, &times, old_busy, *busy_wait_time, compare(old, &times, system_time() - oldLastMeasure, refresh);
system_time() - oldLastMeasure, refresh);
free_times(old); free_times(old);
} }
return (times); return (times);
@@ -414,7 +405,6 @@ main(int argc, char **argv)
bigtime_t then; bigtime_t then;
bigtime_t uinterval; bigtime_t uinterval;
bigtime_t elapsed; bigtime_t elapsed;
bigtime_t busy;
char *myname; char *myname;
get_system_info (&sysinfo); get_system_info (&sysinfo);
@@ -460,22 +450,22 @@ main(int argc, char **argv)
if (iters < 0) { if (iters < 0) {
// You will only have to wait half a second for the first iteration. // You will only have to wait half a second for the first iteration.
uinterval = 1 * 1000000 / 2; uinterval = 1 * 1000000 / 2;
baseline = gather(NULL, &busy, refresh); baseline = gather(NULL, refresh);
elapsed = system_time() - lastMeasure; elapsed = system_time() - lastMeasure;
if (elapsed < uinterval) if (elapsed < uinterval)
snooze(uinterval - elapsed); snooze(uinterval - elapsed);
then = system_time(); then = system_time();
baseline = gather(&baseline, &busy, refresh); baseline = gather(&baseline, refresh);
} else } else
baseline = gather(NULL, &busy, refresh); baseline = gather(NULL, refresh);
uinterval = interval * 1000000; uinterval = interval * 1000000;
for (i = 0; iters < 0 || i < iters; i++) { for (i = 0; iters < 0 || i < iters; i++) {
elapsed = system_time() - lastMeasure; elapsed = system_time() - lastMeasure;
if (elapsed < uinterval) if (elapsed < uinterval)
snooze(uinterval - elapsed); snooze(uinterval - elapsed);
baseline = gather(&baseline, &busy, refresh); baseline = gather(&baseline, refresh);
} }
exit(0); exit(0);
} }