Changeset: 1d2192d211bc for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1d2192d211bc
Modified Files:
clients/mapiclient/dotmonetdb.c
clients/mapiclient/tomograph.c
Branch: default
Log Message:
Merged from Feb2013
diffs (truncated from 2123 to 300 lines):
diff --git a/clients/mapiclient/dotmonetdb.c b/clients/mapiclient/dotmonetdb.c
--- a/clients/mapiclient/dotmonetdb.c
+++ b/clients/mapiclient/dotmonetdb.c
@@ -95,7 +95,7 @@ parse_dotmonetdb(char **user, char **pas
if (user)
*user = strdup(q);
q = NULL;
- } else if (strcmp(buf, "password") == 0 || strcmp(buf,
"passwd") == 0) {
+ } else if (strcmp(buf, "password") == 0) {
if (passwd)
*passwd = strdup(q);
q = NULL;
diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -34,6 +34,7 @@
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
+#include "mprompt.h"
#include "dotmonetdb.h"
#ifndef HAVE_GETOPT_LONG
@@ -64,7 +65,8 @@ static struct {
char *ptag; /* which profiler group counter is needed */
char *name; /* which logical counter is needed */
int status; /* trace it or not */
-} profileCounter[] = {
+}
+profileCounter[] = {
/* 0 */ { 'a', "aggregate", "total count", 0 },
/* 1 */ { 'a', "aggregate", "total ticks", 0 },
/* 2 */ { 'e', "event", "event id", 0 },
@@ -76,7 +78,7 @@ static struct {
/* 8 */ { 'c', "cpu", "cutime", 0 },
/* 9 */ { 'c', "cpu", "stime", 0 },
/* 0 */ { 'c', "cpu", "cstime", 0 },
- /* 1 */ { 'm', "memory", "arena", 0 },/* memory details are ignored*/
+ /* 1 */ { 'm', "memory", "arena", 0 }, /* memory details are ignored*/
/* 2 */ { 'm', "memory", "ordblks", 0 },
/* 3 */ { 'm', "memory", "smblks", 0 },
/* 4 */ { 'm', "memory", "hblkhd", 0 },
@@ -126,16 +128,16 @@ typedef struct _wthread {
static wthread *thds = NULL;
static char hostname[128];
-static char *filename="tomograph";
-static char *tracefile=0;
-static long startrange=0, endrange= 0;
-static char *title =0;
+static char *filename = "tomograph";
+static char *tracefile = 0;
+static long startrange = 0, endrange = 0;
+static char *title = 0;
static int debug = 0;
static int colormap = 0;
-static int beat= 50;
+static int beat = 50;
static char *sqlstatement = NULL;
static int batch = 1; /* number of queries to combine in one run */
-static long maxio=0;
+static long maxio = 0;
static int cpus = 0;
static FILE *gnudata;
@@ -162,16 +164,16 @@ usage(void)
}
-#define die(dbh, hdl) while (1) {(hdl ? mapi_explain_query(hdl, stderr) : \
- dbh ? mapi_explain(dbh, stderr) :
\
- fprintf(stderr, "!! %scommand
failed\n", id)); \
- goto stop_disconnect;}
+#define die(dbh, hdl) while (1) { (hdl ? mapi_explain_query(hdl, stderr) :
\
+ dbh ?
mapi_explain(dbh, stderr) : \
+
fprintf(stderr, "!! %scommand failed\n", id)); \
+ goto
stop_disconnect; }
#define doQ(X) \
- if ((wthr->hdl = mapi_query(wthr->dbh, X)) == NULL ||
mapi_error(wthr->dbh) != MOK) \
- die(wthr->dbh, wthr->hdl);
+ if ((wthr->hdl = mapi_query(wthr->dbh, X)) == NULL ||
mapi_error(wthr->dbh) != MOK) \
+ die(wthr->dbh, wthr->hdl);
#define doQsql(X) \
if ((hdlsql = mapi_query(dbhsql, X)) == NULL || mapi_error(dbhsql) !=
MOK) \
- die(dbhsql, hdlsql);
+ die(dbhsql, hdlsql);
/* Any signal should be captured and turned into a graceful
@@ -179,20 +181,22 @@ usage(void)
static void createTomogram(void);
static int activated = 0;
-static void deactivateBeat(void){
+static void deactivateBeat(void)
+{
wthread *wthr;
- char *id ="deactivateBeat";
- if ( activated == 0)
+ char *id = "deactivateBeat";
+ if (activated == 0)
return;
activated = 0;
- if ( debug)
- fprintf(stderr,"Deactivate beat\n");
+ if (debug)
+ fprintf(stderr, "Deactivate beat\n");
/* deactivate all connections */
- for (wthr = thds; wthr != NULL; wthr = wthr->next)
- if (wthr->dbh ){
- doQ("profiler.deactivate(\"ping\");\n");
- doQ("profiler.stop();");
- }
+ for (wthr = thds; wthr != NULL; wthr = wthr->next)
+ if (wthr->dbh) {
+ doQ("profiler.deactivate(\"ping\");\n");
+ doQ("profiler.stop();");
+ }
+
return;
stop_disconnect:
;
@@ -202,14 +206,14 @@ static void
stopListening(int i)
{
wthread *walk;
- (void)i;
- if ( debug)
- fprintf(stderr,"Interrupt received\n");
+ (void) i;
+ if (debug)
+ fprintf(stderr, "Interrupt received\n");
batch = 0;
deactivateBeat();
/* kill all connections */
for (walk = thds; walk != NULL; walk = walk->next) {
- if (walk->s != NULL){
+ if (walk->s != NULL) {
mnstr_close(walk->s);
}
}
@@ -231,25 +235,27 @@ setCounter(char *nme)
return k;
}
-static void activateBeat(void){
+static void activateBeat(void)
+{
char buf[BUFSIZ];
- char *id ="activateBeat";
+ char *id = "activateBeat";
wthread *wthr;
- if ( debug)
- fprintf(stderr,"Activate beat\n");
- if ( activated == 1)
+ if (debug)
+ fprintf(stderr, "Activate beat\n");
+ if (activated == 1)
return;
activated = 1;
- snprintf(buf, BUFSIZ, "profiler.activate(\"ping%d\");\n",beat);
+ snprintf(buf, BUFSIZ, "profiler.activate(\"ping%d\");\n", beat);
/* activate all connections */
- for (wthr = thds; wthr != NULL; wthr = wthr->next)
- if (wthr->dbh ){
- doQ(buf);
- }
+ for (wthr = thds; wthr != NULL; wthr = wthr->next)
+ if (wthr->dbh) {
+ doQ(buf);
+ }
+
return;
stop_disconnect:
- if ( wthr ){
+ if (wthr) {
mapi_disconnect(wthr->dbh);
mapi_destroy(wthr->dbh);
wthr->dbh = 0;
@@ -259,7 +265,7 @@ stop_disconnect:
#define MAXTHREADS 2048
#define MAXBOX 32678
-typedef struct BOX{
+typedef struct BOX {
int row;
int color;
int thread;
@@ -277,24 +283,25 @@ int threads[MAXTHREADS];
long lastclk[MAXTHREADS];
int prevthreads[MAXTHREADS];
Box box[MAXBOX];
-int topbox=0;
+int topbox = 0;
-long totalclkticks= 0; /* number of clock ticks reported */
-long totalexecticks= 0; /* number of ticks reported for processing */
-long lastclktick=0;
+long totalclkticks = 0; /* number of clock ticks reported */
+long totalexecticks = 0; /* number of ticks reported for processing */
+long lastclktick = 0;
-long starttime=0;
+long starttime = 0;
-static void dumpbox(int i){
+static void dumpbox(int i)
+{
printf("[%d] row %d color %d ", i, box[i].row, box[i].color);
- if ( box[i].fcn)
+ if (box[i].fcn)
printf("%s ", box[i].fcn);
printf("thread %d ", box[i].thread);
printf("clk %ld - %ld ", box[i].clkstart, box[i].clkend);
printf("mem %ld - %ld ", box[i].memstart, box[i].memend);
printf("ticks %ld ", box[i].ticks);
- if ( box[i].stmt)
+ if (box[i].stmt)
printf("%s ", box[i].stmt);
printf("\n");
}
@@ -304,309 +311,314 @@ static void dumpbox(int i){
struct {
char *name;
char *hsv;
- int red,green,blue;
-} dictionary[] ={
- {"aliceblue","#F0F8FF",240,248,255},
- {"antiquewhite","#FAEBD7",250,235,215},
- {"aqua","#00FFFF",0,255,255},
- {"aquamarine","#7FFFD4",127,255,212},
- {"azure","#F0FFFF",240,255,255},
- {"beige","#F5F5DC",245,245,220},
- {"bisque","#FFE4C4",255,228,196},
- {"black","#000000",0,0,0},
- {"blanchedalmond","#FFEBCD",255,235,205},
- {"blue","#0000FF",0, 0,255},
- {"blueviolet","#8A2BE2",138, 43,226},
- {"brown","#A52A2A",165, 42, 42},
- {"burlywood","#DEB887",222,184,135},
- {"cadetblue","#5F9EA0",95,158,160},
- {"chartreuse","#7FFF00",127,255, 0},
- {"chocolate","#D2691E",210,105, 30},
- {"coral","#FF7F50",255,127, 80},
- {"cornflowerblue","#6495ED",100,149,237},
- {"cornsilk","#FFF8DC",255,248,220},
- {"crimson","#DC143C",220,20,60},
- {"cyan","#00FFFF",0,255,255},
- {"darkblue","#00008B",0,0,139},
- {"darkcyan","#008B8B",0,139,139},
- {"darkgoldenrod","#B8860B",184,134, 11},
- {"darkgray","#A9A9A9",169,169,169},
- {"darkgreen","#006400",0,100, 0},
- {"darkkhaki","#BDB76B",189,183,107},
- {"darkmagenta","#8B008B",139, 0,139},
- {"darkolivegreen","#556B2F",85,107, 47},
- {"darkorange","#FF8C00",255,140, 0},
- {"darkorchid","#9932CC",153, 50,204},
- {"darkred","#8B0000",139, 0, 0},
- {"darksalmon","#E9967A",233,150,122},
- {"darkseagreen","#8FBC8F",143,188,143},
- {"darkslateblue","#483D8B",72, 61,139},
- {"darkslategray","#2F4F4F",47, 79, 79},
- {"darkturquoise","#00CED1",0,206,209},
- {"darkviolet","#9400D3",148, 0,211},
- {"deeppink","#FF1493",255, 20,147},
- {"deepskyblue","#00BFFF",0,191,255},
- {"dimgray","#696969",105,105,105},
- {"dodgerblue","#1E90FF",30,144,255},
- {"firebrick","#B22222",178, 34, 34},
- {"floralwhite","#FFFAF0",255,250,240},
- {"forestgreen","#228B22",34,139, 34},
- {"fuchsia","#FF00FF",255,0,255},
- {"gainsboro","#DCDCDC",220,220,220},
- {"ghostwhite","#F8F8FF",248,248,255},
- {"gold","#FFD700",255,215, 0},
- {"goldenrod","#DAA520",218,165, 32},
- {"gray","#7F7F7F",127,127,127},
- {"green","#008000",0,128,0},
- {"greenyellow","#ADFF2F",173,255, 47},
- {"honeydew","#F0FFF0",240,255,240},
- {"hotpink","#FF69B4",255,105,180},
- {"indianred","#CD5C5C",205, 92, 92},
- {"indigo","#4B0082",75,0,130},
- {"ivory","#FFFFF0",255,255,240},
- {"khaki","#F0E68C",240,230,140},
- {"lavender","#E6E6FA",230,230,250},
- {"lavenderblush","#FFF0F5",255,240,245},
- {"lawngreen","#7CFC00",124,252, 0},
- {"lemonchiffon","#FFFACD",255,250,205},
- {"lightblue","#ADD8E6",173,216,230},
- {"lightcoral","#F08080",240,128,128},
- {"lightcyan","#E0FFFF",224,255,255},
- {"lightgoldenrodyellow","#FAFAD2",250,250,210},
- {"lightgreen","#90EE90",144,238,144},
- {"lightgrey","#D3D3D3",211,211,211},
- {"lightpink","#FFB6C1",255,182,193},
- {"lightsalmon","#FFA07A",255,160,122},
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list