on bosch systems (lh, trionic, motronic) there is a pin that goes outbound to the system the displays such things as fuel consumption, miles to empty, and so on.
the display system has the choice of giving you real time figures, or average over time (most are 10 minutes)
they are rather accurate.
because all (known to me) EFI systems use a fuel pressure regulator that keeps the fuel behind the injector at a constant pressure relative to the (ever changing) manifold pressure, the amount of fuel injected will be dependent only on the time the injector is open (~2.4 ms at idle, 2.8 at cruise, max ~8ms under throttle snap or heavy load)

the system dates back to the mid 80's