| 509 | } |
| 510 | |
| 511 | struct task_result FlowGen::RunTask(Context *ctx, bess::PacketBatch *batch, |
| 512 | void *) { |
| 513 | if (children_overload_ > 0) { |
| 514 | return { |
| 515 | .block = true, .packets = 0, .bits = 0, |
| 516 | }; |
| 517 | } |
| 518 | |
| 519 | const int pkt_overhead = 24; |
| 520 | |
| 521 | GeneratePackets(ctx, batch); |
| 522 | RunNextModule(ctx, batch); |
| 523 | |
| 524 | uint32_t cnt = batch->cnt(); |
| 525 | return {.block = (cnt == 0), |
| 526 | .packets = cnt, |
| 527 | .bits = ((template_size_ + pkt_overhead) * cnt) * 8}; |
| 528 | } |
| 529 | |
| 530 | std::string FlowGen::GetDesc() const { |
| 531 | return bess::utils::Format("%d flows", active_flows_); |