Changeset: 32fd2e1375e6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=32fd2e1375e6
Modified Files:
monetdb5/mal/mal.c
monetdb5/mal/mal.h
tools/mserver/mserver5.c
Branch: default
Log Message:
Include the stethoscope argument decoding
This allows more control over the inline profiling.
diffs (126 lines):
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -177,7 +177,7 @@
char monet_cwd[PATHLENGTH] = { 0 };
size_t monet_memory;
-int mal_trace; /* enable profile events on console */
+char *mal_trace; /* enable profile events on console */
#include "mal_stack.h"
#include "mal_linker.h"
@@ -257,18 +257,35 @@ int mal_init(void){
if( malBootstrap() == 0)
return -1;
/* set up the profiler if needed, output sent to console */
- if ( mal_trace) {
+ /* Use the same shortcuts as stethoscope */
+ if ( mal_trace && *mal_trace) {
+ char *s;
setFilterAll();
openProfilerStream(mal_clients[0].fdout);
- activateCounter("thread");
- activateCounter("start");
- activateCounter("ticks");
- activateCounter("time");
- activateCounter("event");
- activateCounter("pc");
- activateCounter("stmt");
+ for ( s= mal_trace; *s; s++)
+ switch(*s){
+ case 'a': activateCounter("aggregate");break;
+ case 'b': activateCounter("rbytes");
+ activateCounter("wbytes");break;
+ case 'c': activateCounter("cpu");break;
+ case 'e': activateCounter("event");break;
+ case 'f': activateCounter("function");break;
+ case 'i': activateCounter("pc");break;
+ case 'm': activateCounter("memory");break;
+ case 'p': activateCounter("process");break;
+ case 'r': activateCounter("reads");break;
+ case 's': activateCounter("stmt");break;
+ case 't': activateCounter("ticks");break;
+ case 'u': activateCounter("user");break;
+ case 'w': activateCounter("writes");break;
+ case 'y': activateCounter("type");break;
+ case 'D': activateCounter("dot");break;
+ case 'I': activateCounter("thread");break;
+ case 'T': activateCounter("time");break;
+ case 'S': activateCounter("start");
+ }
startProfiling();
- }
+ } else mal_trace =0;
return 0;
}
/*
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -50,7 +50,7 @@ mal_export char monet_cwd[PATHLENGTH
mal_export size_t monet_memory;
mal_export lng memorypool; /* memory claimed by
concurrent threads */
mal_export int memoryclaims; /* number of threads active
with expensive operations */
-mal_export int mal_trace; /* enable profile events on
console */
+mal_export char *mal_trace; /* enable profile
events on console */
/*
See gdk/gdk.mx for the definition of all debug masks.
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -107,7 +107,7 @@ usage(char *prog, int xit)
#endif
fprintf(stderr, " --performance\n");
fprintf(stderr, " --optimizers\n");
- fprintf(stderr, " --trace\n");
+ fprintf(stderr, " --trace[=<stethoscope flags>]\n");
fprintf(stderr, " --forcemito\n");
fprintf(stderr, " --debug=<bitmask>\n");
@@ -231,7 +231,7 @@ main(int argc, char **av)
{ "properties", 0, 0, 0 },
{ "io", 0, 0, 0 },
{ "transactions", 0, 0, 0 },
- { "trace", 0, 0, 0 },
+ { "trace", 2, 0, 't' },
{ "modules", 0, 0, 0 },
{ "algorithms", 0, 0, 0 },
{ "optimizers", 0, 0, 0 },
@@ -285,7 +285,7 @@ main(int argc, char **av)
for (;;) {
int option_index = 0;
- int c = getopt_long(argc, av, "c:d::rs:?",
+ int c = getopt_long(argc, av, "c:::d?:r:s:::::t:::::",
long_options, &option_index);
if (c == -1)
@@ -372,7 +372,7 @@ main(int argc, char **av)
break;
}
if (strcmp(long_options[option_index].name, "trace") ==
0) {
- mal_trace =1;
+ mal_trace = optarg? optarg:"ISTest";
break;
}
if (strcmp(long_options[option_index].name, "heaps") ==
0) {
@@ -401,11 +401,14 @@ main(int argc, char **av)
if (tmp) {
*tmp = '\0';
setlen = mo_add_option(&set, setlen,
opt_cmdline, optarg, tmp + 1);
- } else {
+ } else
fprintf(stderr, "ERROR: wrong format %s\n",
optarg);
}
- }
- break;
+ break;
+ case 't':
+ if (strcmp(long_options[option_index].name, "trace") ==
0)
+ mal_trace = optarg? optarg:"ISTest";
+ break;
case '?':
/* a bit of a hack: look at the option that the
current `c' is based on and see if we recognize
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list