Skip to content

Commit

Permalink
added quiet option to command line
Browse files Browse the repository at this point in the history
  • Loading branch information
lee218llnl committed Sep 19, 2016
1 parent e3acc5d commit b3c7056
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/STAT.C
Expand Up @@ -105,15 +105,6 @@ int main(int argc, char **argv)

statFrontEnd = new STAT_FrontEnd();

gettimeofday(&timeStamp, NULL);
currentTime = timeStamp.tv_sec;
localtimeResult = localtime(&currentTime);
if (localtimeResult == NULL)
statFrontEnd->printMsg(STAT_WARNING, __FILE__, __LINE__, "localtime() returned NULL %s\n", strerror(errno));
else if (strftime(timeBuf, BUFSIZE, "%Y-%m-%d-%T", localtimeResult) != 0)
statFrontEnd->printMsg(STAT_STDOUT, __FILE__, __LINE__, "STAT started at %s\n", timeBuf);
else
statFrontEnd->printMsg(STAT_WARNING, __FILE__, __LINE__, "strftime() returned 0\n");

/* Parse arguments and fill in class variables */
statArgs = (StatArgs_t *)calloc(1, sizeof(StatArgs_t));
Expand All @@ -137,6 +128,16 @@ int main(int argc, char **argv)
return 0;
}

gettimeofday(&timeStamp, NULL);
currentTime = timeStamp.tv_sec;
localtimeResult = localtime(&currentTime);
if (localtimeResult == NULL)
statFrontEnd->printMsg(STAT_WARNING, __FILE__, __LINE__, "localtime() returned NULL %s\n", strerror(errno));
else if (strftime(timeBuf, BUFSIZE, "%Y-%m-%d-%T", localtimeResult) != 0)
statFrontEnd->printMsg(STAT_STDOUT, __FILE__, __LINE__, "STAT started at %s\n", timeBuf);
else
statFrontEnd->printMsg(STAT_WARNING, __FILE__, __LINE__, "strftime() returned 0\n");

/* Push the arguments into the output file */
invocationString = "STAT invoked with: ";
for (i = 0; i < argc; i++)
Expand Down Expand Up @@ -386,7 +387,7 @@ int main(int argc, char **argv)
statFrontEnd->printMsg(statError, __FILE__, __LINE__, "Failed to detach from application\n");

statFrontEnd->shutDown();
printf("\nResults written to %s\n\n", statFrontEnd->getOutDir());
statFrontEnd->printMsg(STAT_STDOUT, __FILE__, __LINE__, "\nResults written to %s\n\n", statFrontEnd->getOutDir());

delete statFrontEnd;
free(statArgs);
Expand Down Expand Up @@ -468,6 +469,7 @@ StatError_t parseArgs(StatArgs_t *statArgs, STAT_FrontEnd *statFrontEnd, int arg
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{"verbose", no_argument, 0, 'v'},
{"quiet", no_argument, 0, 'q'},
{"withpc", no_argument, 0, 'P'},
{"withmoduleoffset", no_argument, 0, 'P'},
{"withline", no_argument, 0, 'i'},
Expand Down Expand Up @@ -520,9 +522,9 @@ StatError_t parseArgs(StatArgs_t *statArgs, STAT_FrontEnd *statFrontEnd, int arg
while (1)
{
#ifdef DYSECTAPI
opt = getopt_long(argc, argv,"hVvPmiocwyaCIAxSMUf:n:p:j:r:R:t:T:d:F:s:l:L:u:D:X:b:Y:", longOptions, &optionIndex);
opt = getopt_long(argc, argv,"hVvqPmiocwyaCIAxSMUf:n:p:j:r:R:t:T:d:F:s:l:L:u:D:X:b:Y:", longOptions, &optionIndex);
#else
opt = getopt_long(argc, argv,"hVvPmiocwyaCIAxSMUf:n:p:j:r:R:t:T:d:F:s:l:L:u:D:", longOptions, &optionIndex);
opt = getopt_long(argc, argv,"hVvqPmiocwyaCIAxSMUf:n:p:j:r:R:t:T:d:F:s:l:L:u:D:", longOptions, &optionIndex);
#endif
if (opt == -1)
break;
Expand All @@ -549,6 +551,9 @@ StatError_t parseArgs(StatArgs_t *statArgs, STAT_FrontEnd *statFrontEnd, int arg
case 'v':
statFrontEnd->setVerbose(STAT_VERBOSE_FULL);
break;
case 'q':
statFrontEnd->setVerbose(STAT_VERBOSE_ERROR);
break;
case 'w':
statArgs->withThreads = true;
statArgs->sampleType |= STAT_SAMPLE_THREADS;
Expand Down

0 comments on commit b3c7056

Please sign in to comment.