summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-03-31 12:12:17 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-03-31 12:12:17 -0400
commitad2abb298af730cbdebf77c749db936bb2e3f621 (patch)
treeea309fda4fca5c0130f00a74e44a1c6373cf3591 /gpsd.c
parent4b758aa04224d588415f04cd8975d1e559a219e1 (diff)
downloadgpsd-ad2abb298af730cbdebf77c749db936bb2e3f621.tar.gz
gps_maskdump() has been a CPU hog. Drastically reduce the number of calls...
...and guard them with debug level so they won't be done when the output would never be shipped anywhere.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/gpsd.c b/gpsd.c
index f13e0fba..4e8275b4 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1294,9 +1294,6 @@ static void pseudonmea_report(struct subscriber_t *sub,
&& !TEXTUAL_PACKET_TYPE(device->packet.type)) {
char buf[MAX_PACKET_LENGTH * 3 + 2];
- gpsd_report(LOG_PROG, "data mask is %s\n",
- gps_maskdump(device->gpsdata.set));
-
if ((changed & REPORT_IS) != 0) {
nmea_tpv_dump(device, buf, sizeof(buf));
gpsd_report(LOG_IO, "<= GPS (binary tpv) %s: %s\n",
@@ -1417,10 +1414,12 @@ static void consume_packets(struct gps_device_t *device)
if ((changed & PACKET_SET) == 0)
break;
- gpsd_report(LOG_DATA,
- "packet from %s with %s\n",
- device->gpsdata.dev.path,
- gps_maskdump(device->gpsdata.set));
+ /* conditional prevents mask dumper from eating CPU */
+ if (debuglevel >= LOG_DATA)
+ gpsd_report(LOG_DATA,
+ "packet from %s with %s\n",
+ device->gpsdata.dev.path,
+ gps_maskdump(device->gpsdata.set));
#ifdef SOCKET_EXPORT_ENABLE
/* add any just-identified device to watcher lists */
@@ -1550,10 +1549,12 @@ static void consume_packets(struct gps_device_t *device)
/* some listeners may be in watcher mode */
if (sub->policy.watcher) {
if (changed & DATA_IS) {
- gpsd_report(LOG_PROG,
- "Changed mask: %s with %sreliable cycle detection\n",
- gps_maskdump(changed),
- device->cycle_end_reliable ? "" : "un");
+ /* guard keeps mask dumper from eating CPU */
+ if (debuglevel >= LOG_PROG)
+ gpsd_report(LOG_PROG,
+ "Changed mask: %s with %sreliable cycle detection\n",
+ gps_maskdump(changed),
+ device->cycle_end_reliable ? "" : "un");
if ((changed & REPORT_IS) != 0)
gpsd_report(LOG_PROG, "time to report a fix\n");