53 printf(
"Usage: pmmd [-dh] [-c file] [-l file]\n");
55 printf(
" -c file : specify config file\n");
56 printf(
" -l file : specify log file\n");
57 printf(
" -d : run in daemon (background) mode\n");
58 printf(
" -h : print this help\n");
59 printf(
" -b : exit after all models are built\n");
60 printf(
" -p : pause after each benchmark execution\n");
79 static struct option long_options[] =
81 {
"daemon", no_argument, 0,
'd'},
82 {
"config-file", required_argument, 0,
'c'},
83 {
"log-file", required_argument, 0,
'l'},
84 {
"help", no_argument, 0,
'h'},
85 {
"build-only", no_argument, 0,
'b'},
86 {
"pause", no_argument, 0,
'p'},
92 c = getopt_long(argc, argv,
"dc:l:hbp", long_options, &option_index);
138 printf(
"Usage: pmm_view -h | -c file [ -l | -r routine [-p param -p ...] "
139 "[-ai] [-I|-w wait]]\n");
140 printf(
"Options:\n");
141 printf(
" -c file : specify config file\n");
142 printf(
" -f model : specify model file to plot\n");
143 printf(
" -h : print this help\n");
144 printf(
" -l : list routines\n");
145 printf(
" -r routine : specify routine to plot\n");
146 printf(
" -a : plot averaged datapoints\n");
147 printf(
" -i : plot intervals (not supported in slice plot)\n");
148 printf(
" -I : enter interactive mode after plotting\n");
149 printf(
" -m : plot maximum speed datapoints only\n");
150 printf(
" -p param : specify a parameter axis to plot (max 2)\n");
151 printf(
" -P : plot using palette\n");
152 printf(
" -s slice : specify a slice of model to plot (see man page)\n");
153 printf(
" -S style : specify a gnuplot plot style (see gnuplot help)\n");
154 printf(
" -t [n] : interploate model with n points (default 100)\n");
155 printf(
" -w wait : replot model every 'wait' seconds\n");
156 printf(
" -o file : write plot to file (with png or ps extension)\n");
173 int argc,
char **argv)
196 static struct option long_options[] =
198 {
"config-file", required_argument, 0,
'c'},
199 {
"model-file", required_argument, 0,
'f'},
200 {
"help", no_argument, 0,
'h'},
201 {
"list-routines", no_argument, 0,
'l'},
202 {
"routine", required_argument, 0,
'r'},
203 {
"plot-average", no_argument, 0,
'a'},
204 {
"plot-intervals", no_argument, 0,
'i'},
205 {
"interactive-mode", no_argument, 0,
'I'},
206 {
"plot-max", no_argument, 0,
'm'},
207 {
"param-index", required_argument, 0,
'p'},
208 {
"palette", no_argument, 0,
'P'},
209 {
"slice", required_argument, 0,
's'},
210 {
"plot-style", required_argument, 0,
'S'},
211 {
"interpolate", optional_argument, 0,
't'},
212 {
"wait-period", required_argument, 0,
'w'},
213 {
"output-file", required_argument, 0,
'o'},
214 {
"greyscale", no_argument, 0,
'g'},
220 c = getopt_long(argc, argv,
"c:f:hlr:aiImp:Ps:S:t:w:o:g", long_options,
235 ERRPRINTF(
"Cannot plot average and max at the same time.\n");
247 ERRPRINTF(
"Cannot enter interactive mode when replotting is set"
262 ERRPRINTF(
"Cannot do more than one action (list routines, "
263 "view routines or view model files.\n");
272 ERRPRINTF(
"Cannot plot more than %d routines at once.\n",
280 ERRPRINTF(
"Cannot plot average and max at the same time.\n");
288 ERRPRINTF(
"cannot specify more than 2 parameter boundaries.\n");
293 ERRPRINTF(
"Cannot specify parameter boundary and slice plotting"
294 " at the same time.\n");
304 ERRPRINTF(
"Cannot specify palette plot and style together.\n");
311 ERRPRINTF(
"Cannot specify parameter boundary and slice plotting"
312 " at the same time.\n");
317 ERRPRINTF(
"Error parsing slice string\n");
324 ERRPRINTF(
"Cannot specify palette plot and style together.\n");
346 ERRPRINTF(
"Cannot do more than one action (list routines, "
347 "view routines or view model files.\n");
356 ERRPRINTF(
"Cannot plot more than %d routines at once.\n",
364 ERRPRINTF(
"Cannot replot when interactive mode is set by -I\n");
377 ERRPRINTF(
"Cannot do more than one action (list routines, "
378 "view routines or view model files.\n");
428 str_copy = strdup(str);
429 if(str_copy == NULL) {
430 ERRPRINTF(
"Error duplicating string.\n");
434 token = strtok(str_copy, delimiters);
435 while(token != NULL) {
437 token = strtok(NULL, delimiters);
474 const char *delimiters =
":,";
476 enum states {SLICE_PINDEX, SLICE_PVALUE} state;
493 ERRPRINTF(
"Error counting tokens in slice string.\n");
497 ERRPRINTF(
"No tokens in slice string.\n");
511 str_copy = strdup(slice_str);
512 if(str_copy == NULL) {
513 ERRPRINTF(
"Error duplicating slice string.\n");
517 state = SLICE_PINDEX;
518 token = strtok(str_copy, delimiters);
521 while(token != NULL) {
522 DBGPRINTF(
"token:%s\n", token);
525 if(strncmp(token,
"p", 1) == 0) {
526 p_index = atoi(&(token[1]));
527 state = SLICE_PVALUE;
530 ERRPRINTF(
"Error parsing slice string.\n");
540 if(strcmp(token,
"max") == 0) {
545 else if(strcmp(token,
"min") == 0) {
552 p_value = atoi(token);
559 DBGPRINTF(
"slice_i:%d slice_val:%d i:%d\n",
564 state = SLICE_PINDEX;
572 token = strtok(NULL, delimiters);
577 ERRPRINTF(
"Unexpected number of slice tokens parsed (i:%d n:%d).\n",