Changeset: 1fd73ace099d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1fd73ace099d
Modified Files:
sql/backends/monet5/datacell/actuator.mx
sql/backends/monet5/datacell/basket.mx
sql/backends/monet5/datacell/dcoperator.mx
sql/backends/monet5/datacell/dcsocket.mx
sql/backends/monet5/datacell/emitter.mx
sql/backends/monet5/datacell/opt_datacell.mx
sql/backends/monet5/datacell/opt_dataflow.mx
sql/backends/monet5/datacell/petrinet.mx
sql/backends/monet5/datacell/receptor.mx
sql/backends/monet5/datacell/sensor.mx
Branch: default
Log Message:
indentation: make hurt less
diffs (truncated from 4434 to 300 lines):
diff --git a/sql/backends/monet5/datacell/actuator.mx
b/sql/backends/monet5/datacell/actuator.mx
--- a/sql/backends/monet5/datacell/actuator.mx
+++ b/sql/backends/monet5/datacell/actuator.mx
@@ -59,28 +59,29 @@
#define ACout GDKout
FILE *fd;
-typedef struct ACTUATORCLI{
+typedef struct ACTUATORCLI {
str name;
stream *fromServer;
SOCKET newsockfd;
- struct ACTUATORCLI *nxt, *prev;
-}ACrecord, *Actuator;
+ struct ACTUATORCLI *nxt, *prev;
+} ACrecord, *Actuator;
-static Actuator acAnchor=NULL;
+static Actuator acAnchor = NULL;
static Actuator
-ACnew(str nme){
+ACnew(str nme)
+{
Actuator ac;
- ac= (Actuator) GDKzalloc(sizeof(ACrecord));
- ac->name= GDKstrdup(nme);
- ac->nxt= acAnchor;
- acAnchor= ac;
+ ac = (Actuator)GDKzalloc(sizeof(ACrecord));
+ ac->name = GDKstrdup(nme);
+ ac->nxt = acAnchor;
+ acAnchor = ac;
return ac;
}
#define TCP 1
#define UDP 2
-static int protocol= TCP;
+static int protocol = TCP;
void
usage()
@@ -100,62 +101,64 @@
static char *host = "localhost";
static int port = 50000;
-static char *actuator="X";
-static int server=0;
-static int trace=0;
-static int stamp=1; /* first column is a timestamp*/
+static char *actuator = "X";
+static int server = 0;
+static int trace = 0;
+static int stamp = 1; /* first column is a timestamp*/
-static int statistics=1;
-/*if(statistics!=0)
- print statistics;
-else don't
-collect statistics based on assumption that first
-column denotes time of actuator emission */
+static int statistics = 1;
+/*if(statistics!=0)
+ print statistics;
+ else don't
+ collect statistics based on assumption that first
+ column denotes time of actuator emission */
-static int received=0;
-static lng totallatency=0;
-static lng sendFirst=0;
-static lng receivedLast=0;
-static lng receivedFirst=0;
-static int characters=0;
+static int received = 0;
+static lng totallatency = 0;
+static lng sendFirst = 0;
+static lng receivedLast = 0;
+static lng receivedFirst = 0;
+static int characters = 0;
/* control the display and auto terminate the actuator */
static int batchsize = 1;
static int sequence = -1;
-static int tuples=0;
+static int tuples = 0;
@-
The statistics are shown after a fixed number of tuples
-have been received. Align this number with the batches
+have been received.Align this number with the batches
generated by the sensor and you get a good impression
of batch effect.
@c
-void showStatistics(){
+void showStatistics()
+{
double elaps;
- int tuplesIntheBuffer=2222;
- if( received ==0) return;
+ int tuplesIntheBuffer = 2222;
+ if (received == 0) return;
- mnstr_printf(ACout, "MYBUFSIZ :%d\n", MYBUFSIZ );
- mnstr_printf(ACout, "Tuples in the buffer :%d\n", tuplesIntheBuffer );
-
- mnstr_printf(ACout, "\nEvents %d\n",received);
- mnstr_printf(ACout, "Latency per tuple %6.2f
microsec\n",(((double)totallatency)/received)/tuplesIntheBuffer);
- elaps=(double)((receivedLast-sendFirst)*tuplesIntheBuffer/(received));
+ mnstr_printf(ACout, "MYBUFSIZ :%d\n", MYBUFSIZ);
+ mnstr_printf(ACout, "Tuples in the buffer :%d\n", tuplesIntheBuffer);
+
+ mnstr_printf(ACout, "\nEvents %d\n", received);
+ mnstr_printf(ACout, "Latency per tuple %6.2f microsec\n",
(((double)totallatency) / received) / tuplesIntheBuffer);
+ elaps = (double)((receivedLast - sendFirst) * tuplesIntheBuffer /
(received));
/*mnstr_printf(ACout, "receivedLast-sendFirst %d microsec\n",
receivedLast-sendFirst);*/
mnstr_printf(ACout, "Elapsed per batch %5.2f microsec\n", elaps);
mnstr_printf(ACout, "Throughput %8.2f tpl/sec\n", 1000000.0 / elaps *
tuplesIntheBuffer);
- mnstr_printf(ACout, "Bandwidth %zu bytes\n", characters*sizeof(char));
+ mnstr_printf(ACout, "Bandwidth %zu bytes\n", characters * sizeof(char));
-
- /* sent a short tuple to stderr for gnuplot datafile*/
- if( trace)
- fprintf(stderr,"events %d throughput %6.2f\n",
- received,1000000.0 /elaps * tuplesIntheBuffer);
+
+ /* sent a short tuple to stderr for gnuplot datafile*/
+ if (trace)
+ fprintf(stderr, "events %d throughput %6.2f\n",
+ received, 1000000.0 / elaps * tuplesIntheBuffer);
}
-void terminate(Actuator ac){
+void terminate(Actuator ac)
+{
#ifdef _DEBUG_ACTUATOR_
mnstr_printf(ACout, "about to shutdown the actuator\n");
#endif
@@ -163,12 +166,13 @@
exit(0);
}
-void stopListening(int i){
- (void) i;
- signal(i, SIG_IGN);
- if (statistics)
- showStatistics();
- exit(0);
+void stopListening(int i)
+{
+ (void)i;
+ signal(i, SIG_IGN);
+ if (statistics)
+ showStatistics();
+ exit(0);
}
extern int consumeStream(Actuator ac);
@@ -178,78 +182,78 @@
{
int i, j = 0;
char *err = NULL;
- char name[MYBUFSIZ+1];
+ char name[MYBUFSIZ + 1];
static SOCKET sockfd;
Actuator ac = NULL;
- int option_index=0;
+ int option_index = 0;
- static struct option long_options[11] = {
- {"port", 1, 0, 'p'},
- {"actuator", 1, 0, 'a'},
- {"server", 1, 0, 's'},
- {"statistics", 1, 0, 'S'},
- {"sequence", 1, 0, 's'},
- {"batch", 1, 0, 'b'},
- {"host", 1, 0, 'h'},
- {"help", 1, 0, '?'},
- {"trace", 1, 0, 't'},
- {"timestamp", 1, 0, 't'},
- {0, 0, 0, 0}
+ static struct option long_options[11] = {
+ { "port", 1, 0, 'p' },
+ { "actuator", 1, 0, 'a' },
+ { "server", 1, 0, 's' },
+ { "statistics", 1, 0, 'S' },
+ { "sequence", 1, 0, 's' },
+ { "batch", 1, 0, 'b' },
+ { "host", 1, 0, 'h' },
+ { "help", 1, 0, '?' },
+ { "trace", 1, 0, 't' },
+ { "timestamp", 1, 0, 't' },
+ { 0, 0, 0, 0 }
};
- THRdata[0] = (void *) file_wastream(stdout, "stdout");
- THRdata[1] = (void *) file_rastream(stdin, "stdin");
- for (i = 0; i < THREADS; i++) {
- GDKthreads[i].tid = i + 1;
- }
+ THRdata[0] = (void *)file_wastream(stdout, "stdout");
+ THRdata[1] = (void *)file_rastream(stdin, "stdin");
+ for (i = 0; i < THREADS; i++) {
+ GDKthreads[i].tid = i + 1;
+ }
- for(;;){
- /* int option_index=0;*/
- int c= getopt_long(argc, argv,
"a:p:s:S:b:h:?:t:0",long_options, &option_index);
+ for (;; ) {
+ /* int option_index=0;*/
+ int c = getopt_long(argc, argv, "a:p:s:S:b:h:?:t:0",
long_options, &option_index);
- if( c == -1)
+ if (c == -1)
break;
-
- switch(c){
+
+ switch (c) {
case 't':
- if(
strcmp(long_options[option_index].name,"timestamp")==0) {
- stamp= atol(optarg);
+ if (strcmp(long_options[option_index].name,
"timestamp") == 0) {
+ stamp = atol(optarg);
break;
}
- if( strcmp(long_options[option_index].name,"trace")==0)
{
- trace= atol(optarg);
+ if (strcmp(long_options[option_index].name, "trace") ==
0) {
+ trace = atol(optarg);
break;
} else {
usage();
exit(0);
- }
+ }
break;
case 'b':
- batchsize= atol(optarg);
+ batchsize = atol(optarg);
break;
case 'a':
- actuator= optarg;
+ actuator = optarg;
break;
case 's':
- if(
strcmp(long_options[option_index].name,"sequence")==0) {
- sequence= atol(optarg);
+ if (strcmp(long_options[option_index].name, "sequence")
== 0) {
+ sequence = atol(optarg);
break;
}
- if(
strcmp(long_options[option_index].name,"server")==0) {
- server= atol(optarg);
+ if (strcmp(long_options[option_index].name, "server")
== 0) {
+ server = atol(optarg);
break;
} else {
usage();
exit(0);
- }
+ }
break;
case 'S':
statistics = atol(optarg);
break;
case 'p':
- port= atol(optarg);
+ port = atol(optarg);
break;
case 'h':
- host= optarg;
+ host = optarg;
break;
case '?':
default:
@@ -269,24 +273,24 @@
signal(SIGINT, stopListening);
/* display properties */
- if( trace){
- mnstr_printf(ACout, "--host=%s\n",host);
- mnstr_printf(ACout, "--port=%d\n",port);
- mnstr_printf(ACout, "--actuator=%s\n",actuator);
- mnstr_printf(ACout, "--trace=%d\n",trace);
- mnstr_printf(ACout, "--timestamp=%d\n",stamp);
- mnstr_printf(ACout, "--statistics=%d\n",statistics);
- mnstr_printf(ACout, "--server=%d\n",server);
- mnstr_printf(ACout, "--sequence=%d\n",sequence);
- mnstr_printf(ACout, "--batch=%d\n",batchsize);
+ if (trace) {
+ mnstr_printf(ACout, "--host=%s\n", host);
+ mnstr_printf(ACout, "--port=%d\n", port);
+ mnstr_printf(ACout, "--actuator=%s\n", actuator);
+ mnstr_printf(ACout, "--trace=%d\n", trace);
+ mnstr_printf(ACout, "--timestamp=%d\n", stamp);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list