gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] gpsd using excessive cpu


From: sean d'epagnier
Subject: [gpsd-dev] gpsd using excessive cpu
Date: Sun, 15 Nov 2015 10:45:19 +0200

I have found that with a 1hz binary gps that gpsd is using up to 6%
cpu on my haswell processor.

I found a solution to the problem:

diff --git a/libgpsd_core.c b/libgpsd_core.c
index 31fec2a..ac03e64 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -1015,6 +1015,7 @@ int gpsd_await_data(fd_set *rfds,
      */
     errno = 0;

+    usleep(100000);
     status = pselect(maxfd + 1, rfds, NULL, NULL, NULL, NULL);
     if (status == -1) {
        if (errno == EINTR)



>From what I can tell, the pselect returns after every single byte
received, and there is a lot of overhead between it returning until it
is called again.   If it could buffer to return only when a complete
message is sent then it wouldn't use much cpu.

Adding the sleep may not be the best solution, but it surely makes the
cpu usage drop to 0%


Sean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]