Real-time Event-based Energy Metering