Add extra guard around perf enablement

Change-Id: Ie0954f5b13610dfd32e0e585466e878a75961391