Пример #1
0
 Report & operator()(const std::string &name, T value, bool sum = true) {
     _max_name = std::max(name.length(), _max_name);
     _elements.push_back(ReportEntry(name, value, sum));
     if(sum) {
         _total += value;
     }
     return *this;
 }
ComponentReport ReasonerStandardImplementation::prepareReport() {

	ComponentReport result;

	{	// Disallow other access to aggregated data fields
		unique_lock<mutex> dataLock( dataMutex );

		result.addEntry( "ANOMAL_RUNTIME_MS", ReportEntry( ReportEntry::Type::SIOX_INTERNAL_INFO, VariableDatatype( anomaliesTriggered * update_intervall_ms )));
		result.addEntry( "OBSERVED_RUNTIME_MS", ReportEntry( ReportEntry::Type::SIOX_INTERNAL_INFO, VariableDatatype( cyclesTriggered * update_intervall_ms )));

		result.addEntry( "STATES_SENT_UPSTREAM", ReportEntry( ReportEntry::Type::SIOX_INTERNAL_INFO,  nPushesSent));
		result.addEntry( "STATES_RECEIVED", ReportEntry( ReportEntry::Type::SIOX_INTERNAL_INFO,  nPushesReceived));

		if ( nPushesReceived > 0 ){
			const char * text [] = {
				"UTILIZATION_CPU",
				"UTILIZATION_MEMORY",
				"UTILIZATION_IO",
				"UTILIZATION_NETWORK_SEND",
				"UTILIZATION_NETWORK_RECEIVE",
				"CONSUMED_CPU_SECONDS",
				"CONSUMED_ENERGY_JOULE",
				"CONSUMED_MEMORY_BYTES",
				"CONSUMED_NETWORK_BYTES",
				"CONSUMED_IO_BYTES",
			};

			for (int i=0; i < NODE_STATISTIC_COUNT; i++){
				result.addEntry( text[i], ReportEntry( ReportEntry::Type::APPLICATION_PERFORMANCE,  node_statistics[i] ));
			}
		}

		// for debugging
		ostringstream reportText;
		reportText << this;
		result.addEntry( "TEXT_STATE", ReportEntry( ReportEntry::Type::SIOX_INTERNAL_DEBUG, VariableDatatype( reportText.str() )));
	}

	return result;
}
Пример #3
0
 Report & add_space() {
     _elements.push_back(ReportEntry());
     return *this;
 }
Пример #4
0
 Report & operator()(const std::string &name) {
     _elements.push_back(ReportEntry(name, 0, false));
     _elements.back().has_val = false;
     return *this;
 }