Runtime Grouping?

I record the power consumption of a machine. The machine is not used continuously. I want the sum of consumption per machine usage.
_time _value
00:00:01 0
00:00:02 1
00:00:03 2
00:00:04 1
00:00:05 0
00:00:06 1
00:00:07 1
00:00:08 0
00:00:09 1
00:00:10 0

In this example, the machine has been on three times. So I would like to have three rows, each with the sum of _value
1 4
2 2
3 1

How can I do this with Flux?