From c868e3f8d629e1caddff1a51a7d2dd04f49994a3 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Apr 2016 13:00:16 +0200 Subject: Imported Upstream version 0.5.1 --- htop.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'htop.c') diff --git a/htop.c b/htop.c index be162f0..a0f431a 100644 --- a/htop.c +++ b/htop.c @@ -416,7 +416,18 @@ int main(int argc, char** argv) { int acc = 0; bool follow = false; + + struct timeval tv; + double time = 0.0; + double oldTime = 0.0; + bool recalculate; + while (!quit) { + gettimeofday(&tv, NULL); + time = ((double)tv.tv_sec * 10) + ((double)tv.tv_usec / 100000); + recalculate = (time - oldTime > CRT_delay); + if (recalculate) + oldTime = time; if (doRefresh) { incSearchIndex = 0; incSearchBuffer[0] = 0; @@ -425,7 +436,8 @@ int main(int argc, char** argv) { int currScrollV = lb->scrollV; if (follow) currPid = ProcessList_get(pl, currPos)->pid; - ProcessList_scan(pl); + if (recalculate) + ProcessList_scan(pl); if (refreshTimeout == 0) { ProcessList_sort(pl); refreshTimeout = 1; -- cgit v1.2.3