ndnSIM仿真平台中获取仿真数据有两种方式:
- 打印输出运行日志,并在其中配置需要查看的数据,具体方式可以查看教程:ndnSIM 如何打印 运行日志 获取日志 调试 获取实验数据_ndnsim运行日志-优快云博客
- 通过平台内建输出程序获取,即使用trace helpers来对仿真结果进行跟踪,生成数据文件txt
其中,第一种方式比较灵活,可以输出的数据种类比较多,便于分析,并且可以在需要的地方去修改源码打印任何变量到日志中。第二种方式则比较简单,需要完成的代码比较少,风险低代码容易运行成功,ndnSIM已经提供了常用指标的输出与处理,比较稳定成熟。
对于常用指标,ndnSIM提供了相应的平台内建输出程序可以获取实验结果,具体可以参考 NFD’s Content Store 和 Obtaining metrics(比较重要)。平台内建输出程序的使用方式如下:
为了获得模拟结果,您需要连接到ndnSIM类提供的一个或多个跟踪源。
也可以使用现有的跟踪助手,该助手在文本文件中收集和汇总请求的统计信息。
Packet-level trace helpers
1、L3RateTracer
用于获取节点吞吐量指标(官网示例文件:ndn-tree-tracers.cpp),可以 跟踪NDN节点转发的兴趣/数据包的字节数和速率
以下示例启用了对所有模拟节点的跟踪:
// the following should be put just before calling Simulator::Run in the scenario
L3RateTracer::InstallAll("rate-trace.txt", Seconds(1.0));
Simulator::Run();
...
生成结果文件rate-trace.txt,包含以下内容:
Time Node FaceId FaceDescr Type Packets Kilobytes PacketRaw KilobytesRaw
0.5 leaf-1 1 internal:// InInterests 0 0 0 0
0.5 leaf-1 1 internal:// OutInterests 0 0 0 0
0.5 leaf-1 1 internal:// InData 0 0 0 0
0.5 leaf-1 1 internal:// OutData 0 0 0 0
0.5 leaf-1 1 internal:// InNacks 0 0 0 0
0.5 leaf-1 1 internal:// OutNacks 0 0 0 0
0.5 leaf-1 1 internal:// InSatisfiedInterests 0 0 0 0
0.5 leaf-1 1 internal:// InTimedOutInterests 0 0 0 0
0.5 leaf-1 1 internal:// OutSatisfiedInterests 1.6 0 1 0
0.5 leaf-1 1 internal:// OutTimedOutInterests 0 0 0 0
输出文件格式是以制表符分隔的值,第一行指定列的名称。有关列的说明,请参阅下表:
字段名称 | 描述 |
---|---|
Time |
模拟时间 |
Node |
节点ID,全局唯一 |
FaceId |
接口ID(-1为组合指标) |
Type |
测量类型:
|
Packets |
最后平均周期内的数据包的估计速率(EWMA平均)(数据包数/秒)。 |
Kilobytes |
上一个平均周期内的估计速率(EWMA平均值)( |