a_timeEngine->activate(a_counterRecorderClock); // start clock
}
- // Log statistics concepts
- if(cl.exists("logStatisticSamples")) {
- std::string list = cl.getValue("logStatisticSamples");
- anna::statistics::Engine &statEngine = anna::statistics::Engine::instantiate();
-
- if(list == "all") {
- if(statEngine.enableSampleLog(/* -1: all concepts */))
- LOGDEBUG(anna::Logger::debug("Sample log activation for all statistic concepts", ANNA_FILE_LOCATION));
- } else {
- anna::Tokenizer lst;
- lst.apply(cl.getValue("logStatisticSamples"), ",");
-
- if(lst.size() >= 1) {
- anna::Tokenizer::const_iterator tok_min(lst.begin());
- anna::Tokenizer::const_iterator tok_max(lst.end());
- anna::Tokenizer::const_iterator tok_iter;
- int conceptId;
-
- for(tok_iter = tok_min; tok_iter != tok_max; tok_iter++) {
- conceptId = atoi(anna::Tokenizer::data(tok_iter));
-
- if(statEngine.enableSampleLog(conceptId))
- LOGDEBUG(anna::Logger::debug(anna::functions::asString("Sample log activation for statistic concept id = %d", conceptId), ANNA_FILE_LOCATION));
- }
- }
- }
- }
-
+ /////////////////////////////
+ // Log statistics concepts //
+ /////////////////////////////
+ if(cl.exists("logStatisticSamples"))
+ logStatisticsSamples(cl.getValue("logStatisticSamples"));
// Start client connections //////////////////////////////////////////////////////////////////////////////////
MyDiameterEntity *entity;
result += "\n This operation applies over all the registered host nodes";
result += "\n except if one specific working node has been set.";
result += "\nforceCountersRecord Forces dump to file the current counters of the process.";
+ result += "\nlog-statistics-samples|<list> Log statistics samples for the provided comma-separated concept id";
+ result += "\n list, over './sample.<concept id>.csv' files. For example: \"1,2\"";
+ result += "\n will log concepts 1 and 2. Reserved words \"all\"/\"none\" activates/";
+ result += "\n deactivates all registered statistics concept identifiers. That ids";
+ result += "\n are shown at context dump.";
result += "\nchange-dir[|directory] Changes the execution point which could be fine to ease some";
result += "\n file system interaction tasks. Be care about some requirements";
result += "\n (for example if you have a user defined counters directory as";
return result;
}
+
+void Launcher::logStatisticsSamples(const std::string &conceptsList) throw() {
+ anna::statistics::Engine &statEngine = anna::statistics::Engine::instantiate();
+
+ if(conceptsList == "all") {
+ if(statEngine.enableSampleLog(/* -1: all concepts */))
+ LOGDEBUG(anna::Logger::debug("Sample log activation for all statistic concepts", ANNA_FILE_LOCATION));
+ }
+ else if(conceptsList == "none") {
+ if(statEngine.disableSampleLog(/* -1: all concepts */))
+ LOGDEBUG(anna::Logger::debug("Sample log deactivation for all statistic concepts", ANNA_FILE_LOCATION));
+ } else {
+ anna::Tokenizer lst;
+ lst.apply(conceptsList, ",");
+
+ if(lst.size() >= 1) {
+ anna::Tokenizer::const_iterator tok_min(lst.begin());
+ anna::Tokenizer::const_iterator tok_max(lst.end());
+ anna::Tokenizer::const_iterator tok_iter;
+ int conceptId;
+
+ for(tok_iter = tok_min; tok_iter != tok_max; tok_iter++) {
+ conceptId = atoi(anna::Tokenizer::data(tok_iter));
+
+ if(statEngine.enableSampleLog(conceptId))
+ LOGDEBUG(anna::Logger::debug(anna::functions::asString("Sample log activation for statistic concept id = %d", conceptId), ANNA_FILE_LOCATION));
+ }
+ }
+ }
+}
+
+
void Launcher::eventOperation(const std::string &operation, std::string &response_content) throw(anna::RuntimeException) {
LOGMETHOD(anna::TraceMethod tm("Launcher", "eventOperation", ANNA_FILE_LOCATION));
if (operation == "") return; // ignore
bool wrongBody = false;
if((opType == "change-dir") && (numParams > 1)) wrongBody = true;
+ if((opType == "log-statistics-samples") && (numParams != 1)) wrongBody = true;
if((opType == "node") && (numParams > 1)) wrongBody = true;
if((opType == "node_auto") && (numParams > 0)) wrongBody = true;
return;
}
+ if(opType == "log-statistics-samples") {
+ logStatisticsSamples(param1);
+ response_content = anna::functions::asString("Log statistics samples for '%s' concepts", param1.c_str());
+ return;
+ }
+
// Change execution directory:
if(opType == "change-dir") {
if (param1 == "") param1 = a_initialWorkingDirectory;
commandLine.add("cntDir", anna::CommandLine::Argument::Optional, "Counters directory. By default is the current execution directory. Warning: a counter file will be dump per record period; take care about the possible accumulation of files");
commandLine.add("tmDir", anna::CommandLine::Argument::Optional, "Test manager directory. By default is the current execution directory. Warning: report files could be dump during system testing (see help for management operation 'test|report|result'); take care about the possible accumulation of files");
commandLine.add("cntRecordPeriod", anna::CommandLine::Argument::Optional, "Counters record procedure period in milliseconds. If missing, default value of 300000 (5 minutes) will be assigned. Value of 0 disables the record procedure.");
- commandLine.add("logStatisticSamples", anna::CommandLine::Argument::Optional, "Log statistics samples for the provided concept id list, over './sample.<concept id>.csv' files. For example: \"1,2\" will log concepts 1 and 2. Reserved word \"all\" activates all registered statistics concept identifiers. That ids are shown at context dump (see help to get it).");
+ commandLine.add("logStatisticSamples", anna::CommandLine::Argument::Optional, "Log statistics samples for the provided comma-separated concept id list, over './sample.<concept id>.csv' files. For example: \"1,2\" will log concepts 1 and 2. Reserved words \"all\"/\"none\" activates/deactivates all registered statistics concept identifiers. That ids are shown at context dump (see help to get it).");
commandLine.add("disableLogs", anna::CommandLine::Argument::Optional, "Overrides every node configuration regarding traffic log in order to disable it and ease production or system test startup.", false);
// Communications
// For all concepts:
_concept_identification_map_nc_iter it_min(a_concept_identification_map.begin());
_concept_identification_map_nc_iter it_max(a_concept_identification_map.end());
-
for(it = it_min; it != it_max; it++) {
realName = "";
-
if(providedName != "") realName = anna::functions::asString("%s.%d.csv", providedName.c_str(), (*it).first);
-
SampleFile_ptr = &((*it).second.SampleFile);
*SampleFile_ptr = realName;
}
//--------------------------------------------------- Engine::disableSampleLog()
//------------------------------------------------------------------------------
bool Engine::disableSampleLog(const int & id) throw() {
- _concept_identification_map_nc_iter it = a_concept_identification_map.find(id);
- if(it == a_concept_identification_map.end()) return false;
+ if(id != -1) {
+ _concept_identification_map_nc_iter it = a_concept_identification_map.find(id);
- // Access to map
- std::string *SampleFile_ptr = &((*it).second.SampleFile);
- *SampleFile_ptr = "";
- return true;
+ if(it == a_concept_identification_map.end()) return false;
+
+ // Access to map
+ std::string *SampleFile_ptr = &((*it).second.SampleFile);
+ *SampleFile_ptr = "";
+ return true;
+ }
+
+ // For all concepts:
+ return enableSampleLog(id /* -1 */, "");
}