summaryrefslogtreecommitdiff
path: root/bits.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 /bits.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 'bits.c')
-rw-r--r--bits.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bits.c b/bits.c
index ae5a4a2b..e12891a2 100644
--- a/bits.c
+++ b/bits.c
@@ -31,7 +31,8 @@ unsigned long long ubits(char buf[], unsigned int start, unsigned int width)
fld |= (unsigned char)buf[i];
}
#ifdef DEBUG
- printf("Extracting %d:%d from %s: segment 0x%llx = %lld\n", start, width, gpsd_hexdump(buf, 12), fld, fld);
+ printf("Extracting %d:%d from %s: segment 0x%llx = %lld\n", start, width,
+ gpsd_hexdump(buf, 12), fld, fld);
#endif /* DEBUG */
end = (start + width) % BITS_PER_BYTE;