IMPALA-879: impalad crashes while trying to serialize a runtime profile

The problem appears to be that query events in the runtime profile
are also exposed through QueryExecState, and there is no synchronization
to guard against corruption - impalad crashed while attempting to serialize
and compress a corrupted profile

This patch adds a lock to the EventSequence class to guard against
concurrently adding and reading events.

Change-Id: Iceda7ee5fb26bc82c8562447918150427c75779d
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1912
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins