Slicing a mysql result is easy with
select from_unixtime(unix_timestamp(timestamp) -unix_timestamp(timestamp) % $slicecount) as slice, count(*) from event group
by slice
by slice
This will return the mysql statement sliced on the given number of slices.