If you explore the FlowMonitor code, On receiving a packet, it is doing the following while recording
delayHistogram (check
flow-monitor.cc)
Time now = Simulator::Now();
Time delay = (now - tracked->second.firstSeenTime);
probe->AddPacketStats(flowId, packetSize, delay);
FlowStats& stats = GetStatsForFlow(flowId);
stats.delaySum += delay;
stats.delayHistogram.AddValue(delay.GetSeconds());
so, according to this,
delay = (now - tracked->second.firstSeenTime);
is EQUAL to your
latency = t_received - t_generated
because 'racked->second.firstSeenTime' will be the time of transmission of that packet for the first time.
There are different definitions given to delay and latency in different contexts.
I think, in this case, the 'delay histogram' itself is recording the latency that you are defining.
Correct me if I am wrong.
Of course, you can calculate this by your own custom method. But I hope that the same may be possible with the Data that FlowMonitor is recording.
Anyway, anyone who knows the internals of FlowMonitor may give the correct difference between delay and latency from the perspective of data that FlowMonitor is recording.