summaryrefslogtreecommitdiff
path: root/navcom.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2008-12-27 09:15:40 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2008-12-27 09:15:40 +0000
commite6b2b986ff8c91f2ec1f8dbc05a62f5bf9fcd91b (patch)
treea0b4e270d5b7fdf0c2e9aa2551c29bce51dc088a /navcom.c
parentd4bee24389232b37dd0ae816789806f8fe1f34fa (diff)
downloadgpsd-e6b2b986ff8c91f2ec1f8dbc05a62f5bf9fcd91b.tar.gz
Add a wrapper function around gpsd_hexdump to avoid hexdumping buffers...
...and copying ascii strings around when they're not going to be printed. This saves quite a lot of CPU. I processed a 50MB ubx binary file. With no "-D" options, this saved nearly 2.2M calls to gpsd_hexdump and the processing time for this file went from 84 seconds to 35 seconds.
Diffstat (limited to 'navcom.c')
-rw-r--r--navcom.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/navcom.c b/navcom.c
index 000cdc9e..36a024c7 100644
--- a/navcom.c
+++ b/navcom.c
@@ -83,7 +83,8 @@ static u_int8_t checksum(unsigned char *buf, size_t len)
static bool navcom_send_cmd(struct gps_device_t *session, unsigned char *cmd, size_t len)
{
- gpsd_report(LOG_RAW, "Navcom: command dump: %s\n", gpsd_hexdump(cmd, len));
+ gpsd_report(LOG_RAW, "Navcom: command dump: %s\n",
+ gpsd_hexdump_wrapper(cmd, len, LOG_RAW));
return (gpsd_write(session, cmd, len) == (ssize_t)len);
}
@@ -1160,7 +1161,7 @@ gps_mask_t navcom_parse(struct gps_device_t *session, unsigned char *buf, size_t
/*@ -usedef -compdef @*/
gpsd_report(LOG_RAW, "Navcom: packet type 0x%02x, length %d: %s\n",
- cmd_id, msg_len, gpsd_hexdump(buf, len));
+ cmd_id, msg_len, gpsd_hexdump_wrapper(buf, len, LOG_RAW));
/*@ +usedef +compdef @*/
(void)snprintf(session->gpsdata.tag, sizeof(session->gpsdata.tag),