summaryrefslogtreecommitdiff
path: root/gpspipe.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-09-22 03:00:57 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-09-22 03:00:57 -0400
commit2e125acaf727e8d8e6662e57be4594fcdec7a7da (patch)
tree0541738d73ed048908dd66be0271095712a76a66 /gpspipe.c
parent15c7578266d06d7f0b7f8be8e66c075252a061e6 (diff)
downloadgpsd-2e125acaf727e8d8e6662e57be4594fcdec7a7da.tar.gz
Asdd a gpspipe option to enable profiling.
Diffstat (limited to 'gpspipe.c')
-rw-r--r--gpspipe.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gpspipe.c b/gpspipe.c
index 23672ce2..c65719dd 100644
--- a/gpspipe.c
+++ b/gpspipe.c
@@ -105,6 +105,7 @@ static void usage(void)
"-s [serial dev] emulate a 4800bps NMEA GPS on serial port (use with '-r').\n"
"-n [count] exit after count packets.\n"
"-v Print a little spinner.\n"
+ "-p Include profiling info in the JSON.\n"
"-V Print version and exit.\n\n"
"You must specify one, or more, of -r, -R, or -w\n"
"You must use -o if you use -d.\n");
@@ -123,6 +124,7 @@ int main(int argc, char **argv)
bool new_line = true;
bool raw = false;
bool watch = false;
+ bool profile = false;
long count = -1;
int option;
unsigned int vflag = 0, l = 0;
@@ -136,7 +138,7 @@ int main(int argc, char **argv)
/*@-branchstate@*/
flags = WATCH_ENABLE;
- while ((option = getopt(argc, argv, "?dD:lhrRwtT:vVn:s:o:")) != -1) {
+ while ((option = getopt(argc, argv, "?dD:lhrRwtT:vVn:s:o:p")) != -1) {
switch (option) {
case 'D':
debug = atoi(optarg);
@@ -179,6 +181,9 @@ int main(int argc, char **argv)
flags |= WATCH_JSON;
watch = true;
break;
+ case 'p':
+ profile = true;
+ break;
case 'V':
(void)fprintf(stderr, "%s: %s (revision %s)\n",
argv[0], VERSION, REVISION);
@@ -265,6 +270,8 @@ int main(int argc, char **argv)
}
/*@ +nullpass +onlytrans @*/
+ if (profile)
+ flags |= WATCH_TIMING;
if (source.device != NULL)
flags |= WATCH_DEVICE;
(void)gps_stream(&gpsdata, flags, source.device);