Add an extra guard around perf enablement

Change-Id: I3b03ffa27ca744d8392301e6b4a8e67aa88bca53