【发布时间】:2017-01-31 22:55:22
【问题描述】:
我想在下面的跟踪文件中测量传输和接收数据包之间的时间。
输入:
+ 0.01 /NodeList/1/DeviceList/1/$ns3::PointToPointNetDevice/TxQueue/Enqueue
- 0.01 /NodeList/1/DeviceList/1/$ns3::PointToPointNetDevice/TxQueue/Dequeue
r 0.0200001 /NodeList/0/DeviceList/2/$ns3::PointToPointNetDevice/MacRx
+ 0.11 /NodeList/1/DeviceList/1/$ns3::PointToPointNetDevice/TxQueue/Enqueue
- 0.11 /NodeList/1/DeviceList/1/$ns3::PointToPointNetDevice/TxQueue/Dequeue
r 0.12 /NodeList/0/DeviceList/2/$ns3::PointToPointNetDevice/MacRx
+ 0.12 /NodeList/0/DeviceList/3/$ns3::PointToPointNetDevice/TxQueue/Enqueue
- 0.12 /NodeList/0/DeviceList/3/$ns3::PointToPointNetDevice/TxQueue/Dequeue
r 0.120001 /NodeList/2/DeviceList/2/$ns3::PointToPointNetDevice/MacRx
这里+代表发送数据,r代表接收数据。跟踪文件中的第 2 列显示时间。
如何使用 awk 代码测量整个文件的 r 和 + 之间的时间?
预期输出如下:
输出:
0.0100001
0.01
0.000001
如果有人提供帮助,我将不胜感激。
【问题讨论】:
-
edit 您的问题包括简洁、可测试的样本输入和预期输出。如果您需要一个外部网站来展示它,那么您还没有努力使其最小化(如minimal reproducible example)。