98 std::stringstream ss(identifier);
99 uint32_t identifierNum;
100 if (!(ss >> identifierNum))
102 NS_FATAL_ERROR(
"Cannot convert '" << identifier <<
"' to number");
105 NS_ASSERT_MSG(collector !=
nullptr,
106 "Unable to find collector with identifier " << identifierNum);
112 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
113 NS_ASSERT(c !=
nullptr);
114 c->TraceSinkUinteger32(0, rbdcTraceKbps);
120 Ptr<UnitConversionCollector> c = collector->GetObject<UnitConversionCollector>();
121 NS_ASSERT(c !=
nullptr);
122 c->TraceSinkUinteger32(0, rbdcTraceKbps);
134 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
135 NS_ASSERT(c !=
nullptr);
136 c->TraceSinkUinteger32(0, rbdcTraceKbps);
140 Ptr<DistributionCollector> c = collector->GetObject<DistributionCollector>();
141 NS_ASSERT(c !=
nullptr);
142 c->TraceSinkUinteger32(0, rbdcTraceKbps);
148 <<
" is not a valid output type for this statistics.");
156 NS_LOG_FUNCTION(
this);
162 <<
" is not a valid output type for this statistics.");
172 "EnableContextPrinting",
180 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
183 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
187 &MultiFileAggregator::Write1d);
202 EnumValue(UnitConversionCollector::TRANSPARENT));
206 &MultiFileAggregator::Write2d);
221 "EnableContextPrinting",
225 Ptr<MultiFileAggregator> fileAggregator =
227 NS_ASSERT(fileAggregator !=
nullptr);
231 DistributionCollector::OutputType_t outputType =
232 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
235 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
239 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
246 MakeCallback(&MultiFileAggregator::Write2d, fileAggregator));
250 MakeCallback(&MultiFileAggregator::AddContextHeading, fileAggregator));
254 MakeCallback(&MultiFileAggregator::EnableContextWarning, fileAggregator));
259 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
262 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
264 Callback<void, double> callback =
270 it->second->TraceConnectWithoutContext(
"Output", callback);
284 DistributionCollector::OutputType_t outputType =
285 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
288 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
292 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
298 &MultiFileAggregator::Write2d);
301 &MultiFileAggregator::AddContextHeading);
304 &MultiFileAggregator::EnableContextWarning);
313 <<
" is not a valid output type for this statistics.");
323 Ptr<MagisterGnuplotAggregator> plotAggregator =
325 NS_ASSERT(plotAggregator !=
nullptr);
327 plotAggregator->SetLegend(
"Time (in seconds)",
"RBDC requested (in kbps)");
328 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
333 EnumValue(UnitConversionCollector::TRANSPARENT));
339 const std::string context = it->second->GetName();
340 plotAggregator->Add2dDataset(context, context);
344 &MagisterGnuplotAggregator::Write2d);
359 Ptr<MagisterGnuplotAggregator> plotAggregator =
361 NS_ASSERT(plotAggregator !=
nullptr);
363 plotAggregator->SetLegend(
"RBDC requested (in kbps)",
"Frequency");
364 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
370 DistributionCollector::OutputType_t outputType =
371 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
374 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
378 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
385 MakeCallback(&MagisterGnuplotAggregator::Write2d, plotAggregator));
391 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
394 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
396 Callback<void, double> callback =
402 it->second->TraceConnectWithoutContext(
"Output", callback);
413 Ptr<MagisterGnuplotAggregator> plotAggregator =
415 NS_ASSERT(plotAggregator !=
nullptr);
417 plotAggregator->SetLegend(
"RBDC requested (in kbps)",
"Frequency");
418 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
422 DistributionCollector::OutputType_t outputType =
423 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
426 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
430 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
438 const std::string context = it->second->GetName();
439 plotAggregator->Add2dDataset(context, context);
443 &MagisterGnuplotAggregator::Write2d);
450 NS_FATAL_ERROR(
"SatStatsDelayHelper - Invalid output type");
461 NS_LOG_FUNCTION(
this);
463 Callback<void, std::string, uint32_t> callback =
466 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
467 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
469 std::ostringstream context;
481 NS_FATAL_ERROR(
"SatStatsRbdcRequestHelper - Invalid identifier type");
486 Ptr<SatNetDevice> satDev = dev->GetObject<
SatNetDevice>();
487 NS_ASSERT(satDev !=
nullptr);
488 Ptr<SatLlc> satLlc = satDev->GetLlc();
489 NS_ASSERT(satLlc !=
nullptr);
490 Ptr<SatUtLlc> utLlc = satLlc->GetObject<
SatUtLlc>();
491 NS_ASSERT(utLlc !=
nullptr);
492 Ptr<SatRequestManager> requestManager = utLlc->GetRequestManager();
494 const bool ret = requestManager->TraceConnect(
"RbdcTrace", context.str(), callback);
495 NS_ASSERT_MSG(ret,
"Error connecting to CrTraceLog of node " << (*it)->GetId());
496 NS_LOG_INFO(
this <<
" successfully connected" <<
" with node ID " << (*it)->GetId());
Ptr< DataCollectionObject > CreateAggregator(std::string aggregatorTypeId, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue())
Create the aggregator according to the output type.