Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28569
Modified Files:
Makefile xdb.c
Added Files:
fbpacket.c
Log Message:
Added code for performance testing of xlisten.
Index: xdb.c
===================================================================
RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** xdb.c 19 Jun 2005 23:03:53 -0000 1.7
--- xdb.c 28 Jun 2005 20:03:48 -0000 1.8
***************
*** 77,80 ****
--- 77,81 ----
}
+
/**
* Executes the given SQL command through the Postgres library (libpq)
***************
*** 87,94 ****
*
*/
! int xdb_execute(char *command)
! {
int errno = 0;
! printf("%s\n", command);
PGconn *conn = xdb_connect();
--- 88,96 ----
*
*/
! int
! xdb_execute(char *command) {
!
int errno = 0;
! //printf("%s\n", command);
PGconn *conn = xdb_connect();
***************
*** 177,180 ****
--- 179,184 ----
+ // FIXME: If db exists, make sure to set the
+ // default name to that db name.
int
xdb_db_exists(const char * dbname) {
--- NEW FILE: fbpacket.c ---
/**
* $Id: fbpacket.c,v 1.1 2005/06/28 20:03:48 doolin Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
#include <sys/times.h>
#include "xdb.h"
#include "xsensors.h"
#include "boards/fireboard.h"
#include "args.h"
/*
uint8_t hours;
uint8_t minutes;
uint8_t Lat_deg;
uint8_t Long_deg;
float dec_sec;
float Lat_dec_min;
float Long_dec_min;
uint8_t NSEWind;
uint8_t fixQuality;
uint8_t num_sats;
*/
// This next block is required to get the program to
// link, has no use in the program.
const char *g_version =
"$Id: fbpacket.c,v 1.1 2005/06/28 20:03:48 doolin Exp $";
int g_istream; //!< Handle of input stream
int
xmain_get_verbose(s_params * g_params) {
//return !g_params->bits.mode_quiet;
return 0;
}
// end useless block
/* Function call adds 1 clock_t to each cycle
* through the loop compared to setting the
* values in the loop.
*/
void
init_gga_data(GGA_Data * gga_data) {
gga_data->hours = 1;
gga_data->minutes = 1;
gga_data->Lat_deg = 1;
gga_data->Long_deg = 1;
gga_data->dec_sec = 1;
gga_data->Lat_dec_min = 1;
gga_data->Long_dec_min = 1;
gga_data->NSEWind = 1;
gga_data->fixQuality = 1;
gga_data->num_sats = 1;
}
/** Clocking code is shitty, should be abstracted
* out into a set of small useful functions, or
* use a more convenient libc API.
*/
int
main(int argc, char **argv) {
int i;
//struct tms tms_start, tms_end;
clock_t start, stop;
GGA_Data gga_data = {0};
XbowSensorboardPacket packet = {0};
start = clock();
printf("start: %d\n",start);
init_gga_data(&gga_data);
// This is a royal pain in the ass because the packets
// on the mote side are built using inheritance with
// embedded headers, but on the processing side the data
// is assumed to be aggregated. What a fuckin bitch for
// writing test code.
memcpy(packet.data,&gga_data,sizeof(packet.data));
for (i=0; i<100; i++) {
fb_pg_log_gga_data(&packet);
}
stop = clock();
printf("stop: %d\n",stop);
printf("clocks per sec: %d\n", CLOCKS_PER_SEC);
printf("Elapsed time: %f\n", ((float)(stop - start)/CLOCKS_PER_SEC));
return 0;
}
Index: Makefile
===================================================================
RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/Makefile,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Makefile 19 Jun 2005 22:28:33 -0000 1.8
--- Makefile 28 Jun 2005 20:03:48 -0000 1.9
***************
*** 9,13 ****
# Main xlisten sources
! SRCS = xlisten.c xpacket.c xconvert.c xdb.c
SRCS += xserial.c xsocket.c args.c
--- 9,13 ----
# Main xlisten sources
! SRCS = xpacket.c xconvert.c xdb.c
SRCS += xserial.c xsocket.c args.c
***************
*** 19,22 ****
--- 19,23 ----
+
INCLUDES = -I../../../tos/sensorboards/mts400/GPS
INCLUDES += -I../../../apps/XSensorMTS400
***************
*** 37,44 ****
SRCS += timestamp/timestamp.c
! all: xlisten
xlisten: $(SRCS)
! $(CC) $(CFLAGS) -o $@ $(SRCS) $(INCLUDES) $(LFLAGS)
xlisten-arm: $(SRCS)
--- 38,48 ----
SRCS += timestamp/timestamp.c
! all: xlisten fbpacket
xlisten: $(SRCS)
! $(CC) $(CFLAGS) -o $@ xlisten.c $(SRCS) $(INCLUDES) $(LFLAGS)
!
! fbpacket: fbpacket.c
! $(CC) $(CFLAGS) -o $@ fbpacket.c $(SRCS) $(INCLUDES) $(LFLAGS)
xlisten-arm: $(SRCS)
***************
*** 46,48 ****
clean:
! rm -f *.o boards/*.o xlisten xlisten-arm xlisten.exe
--- 50,52 ----
clean:
! rm -f *.o boards/*.o xlisten xlisten-arm xlisten.exe fbpacket.exe
|