comparison audioDB.h @ 280:3be15407e814

Merge sampling branch (-r361:405, though I hope that the branch is now finished) onto trunk. API developers take note. Things still to clear up: * whether the threshold distance it currently reports bears any relation to reality; * if not, how to bring it a bit more into alignment; * minor code cleanup issues in sample.cpp; * incorporating --absolute-threshold handling into sampling; * writing suitable test cases.
author mas01cr
date Wed, 02 Jul 2008 14:07:10 +0000
parents 210b2f661b88
children cacad987d785
comparison
equal deleted inserted replaced
275:d209e8470a60 280:3be15407e814
10 #include <math.h> 10 #include <math.h>
11 #include <sys/time.h> 11 #include <sys/time.h>
12 #include <assert.h> 12 #include <assert.h>
13 #include <float.h> 13 #include <float.h>
14 #include <signal.h> 14 #include <signal.h>
15 #include <gsl/gsl_rng.h>
15 16
16 // includes for web services 17 // includes for web services
17 #include "soapH.h" 18 #include "soapH.h"
18 #include "cmdline.h" 19 #include "cmdline.h"
19 20
27 #define COM_STATUS "--STATUS" 28 #define COM_STATUS "--STATUS"
28 #define COM_L2NORM "--L2NORM" 29 #define COM_L2NORM "--L2NORM"
29 #define COM_POWER "--POWER" 30 #define COM_POWER "--POWER"
30 #define COM_DUMP "--DUMP" 31 #define COM_DUMP "--DUMP"
31 #define COM_SERVER "--SERVER" 32 #define COM_SERVER "--SERVER"
33 #define COM_SAMPLE "--SAMPLE"
32 34
33 // parameters 35 // parameters
34 #define COM_CLIENT "--client" 36 #define COM_CLIENT "--client"
35 #define COM_DATABASE "--database" 37 #define COM_DATABASE "--database"
36 #define COM_QTYPE "--qtype" 38 #define COM_QTYPE "--qtype"
174 size_t l2normTableLength; 176 size_t l2normTableLength;
175 177
176 // Flags and parameters 178 // Flags and parameters
177 unsigned verbosity; // how much do we want to know? 179 unsigned verbosity; // how much do we want to know?
178 180
181 unsigned nsamples;
182
179 //off_t size; // given size (for creation) 183 //off_t size; // given size (for creation)
180 unsigned datasize; // size in MB 184 unsigned datasize; // size in MB
181 unsigned ntracks; 185 unsigned ntracks;
182 unsigned datadim; 186 unsigned datadim;
183 187
245 void insert_data_vectors(off_t offset, void *buffer, size_t size); 249 void insert_data_vectors(off_t offset, void *buffer, size_t size);
246 void insert(const char* dbName, const char* inFile); 250 void insert(const char* dbName, const char* inFile);
247 void batchinsert(const char* dbName, const char* inFile); 251 void batchinsert(const char* dbName, const char* inFile);
248 void query(const char* dbName, const char* inFile, adb__queryResponse *adbQueryResponse=0); 252 void query(const char* dbName, const char* inFile, adb__queryResponse *adbQueryResponse=0);
249 void status(const char* dbName, adb__statusResponse *adbStatusResponse=0); 253 void status(const char* dbName, adb__statusResponse *adbStatusResponse=0);
254 unsigned random_track(unsigned *propTable, unsigned total, gsl_rng *);
255 void sample(const char *dbName);
250 void ws_status(const char*dbName, char* hostport); 256 void ws_status(const char*dbName, char* hostport);
251 void ws_query(const char*dbName, const char *trackKey, const char* hostport); 257 void ws_query(const char*dbName, const char *trackKey, const char* hostport);
252 void l2norm(const char* dbName); 258 void l2norm(const char* dbName);
253 void power_flag(const char *dbName); 259 void power_flag(const char *dbName);
254 bool powers_acceptable(double p1, double p2); 260 bool powers_acceptable(double p1, double p2);
289 dataBufLength(0), \ 295 dataBufLength(0), \
290 timesTableLength(0), \ 296 timesTableLength(0), \
291 powerTableLength(0), \ 297 powerTableLength(0), \
292 l2normTableLength(0), \ 298 l2normTableLength(0), \
293 verbosity(1), \ 299 verbosity(1), \
300 nsamples(2000), \
294 datasize(O2_DEFAULT_DATASIZE), \ 301 datasize(O2_DEFAULT_DATASIZE), \
295 ntracks(O2_DEFAULT_NTRACKS), \ 302 ntracks(O2_DEFAULT_NTRACKS), \
296 datadim(O2_DEFAULT_DATADIM), \ 303 datadim(O2_DEFAULT_DATADIM), \
297 queryType(O2_POINT_QUERY), \ 304 queryType(O2_POINT_QUERY), \
298 pointNN(O2_DEFAULT_POINTNN), \ 305 pointNN(O2_DEFAULT_POINTNN), \