code: func (s *Stream) Read(max int) (events []Event, err error) {
  	if max > maxEventBufferSize {
  		return nil, ErrMaxBuffer
  	}
  	if max < minEventBufferSize {
  		return nil, ErrMinBuffer
  	}
  	buffer := make([]C.PmEvent, max)
  	numEvents := C.Pm_Read(unsafe.Pointer(s.pmStream), &buffer[0], C.int32_t(max))
  	if numEvents < 0 {
  		return nil, convertToError(C.PmError(numEvents))
  	}
  	events = make([]Event, numEvents)
  	for i := 0; i < int(numEvents); i++ {
  		events[i] = Event{
  			Timestamp: Timestamp(buffer[i].timestamp),
  			Status:    int64(buffer[i].message) & 0xFF,
  			Data1:     (int64(buffer[i].message) >> 8) & 0xFF,
  			Data2:     (int64(buffer[i].message) >> 16) & 0xFF,
  		}
  	}
  	return
  }
docs: // Reads from the input stream, the max number events to be read are
  // determined by max.