diff --git a/src/core/main.lua b/src/core/main.lua index 5c22b845ff..a7b756ca0e 100644 --- a/src/core/main.lua +++ b/src/core/main.lua @@ -35,8 +35,8 @@ Available options are: -jp=args[,.output] ]] -local debug_on_error = false -local profiling = false +debug_on_error = false +profiling = false -- List of parameters passed on the command line. parameters = {} diff --git a/src/designs/nfv/nfv b/src/designs/nfv/nfv index 80142a488a..6991dde8d8 100755 --- a/src/designs/nfv/nfv +++ b/src/designs/nfv/nfv @@ -50,12 +50,19 @@ function run (npackets) else npackets = tonumber(npackets) print(app.app_table.vm.input.rx.stats.rxpackets) - local start, packets = 0, 0 + local start, packets, bytes = 0, 0, 0 local done = function () if start == 0 and app.app_table.vm.input.rx.stats.rxpackets > 0 then -- started receiving, record time and packet count packets = app.app_table.vm.input.rx.stats.rxpackets + bytes = app.app_table.vm.input.rx.stats.rxbytes start = C.get_monotonic_time() + if os.getenv("NFV_PROF") then + require("jit.p").start(os.getenv("NFV_PROF")) + main.profiling = true + else + print("No LuaJIT profiling enabled ($NFV_PROF unset).") + end end return app.app_table.vm.input.rx.stats.rxpackets - packets >= npackets end @@ -65,9 +72,10 @@ function run (npackets) local runtime = finish - start packets = app.app_table.vm.input.rx.stats.rxpackets - packets + bytes = app.app_table.vm.input.rx.stats.rxbytes - bytes engine.report() print() - print(("Processed %.1f million packets in %.2f seconds"):format(packets / 1e6, runtime)) + print(("Processed %.1f million packets in %.2f seconds (%d bytes; %.2f Gbps)"):format(packets / 1e6, runtime, bytes, bytes * 8.0 / 1e9 / runtime)) print(("Made %s breaths: %.2f packets per breath; %.2fus per breath"):format(lib.comma_value(engine.breaths), packets / engine.breaths, runtime / engine.breaths * 1e6)) print(("Rate(Mpps):\t%.3f"):format(packets / runtime / 1e6)) end