diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-03-31 12:12:17 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-03-31 12:12:17 -0400 |
commit | ad2abb298af730cbdebf77c749db936bb2e3f621 (patch) | |
tree | ea309fda4fca5c0130f00a74e44a1c6373cf3591 /gpsd.c | |
parent | 4b758aa04224d588415f04cd8975d1e559a219e1 (diff) | |
download | gpsd-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.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -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"); |