The implementation of up_perf_*() is in a different static library in nuttx: Hardware: libarch.a Software: libdrivers.a (weak function) Since functions with weak attributes cannot be correctly replaced in multiple static libraries, this PR will use macros to replace whether the arch supports hardware perf events Signed-off-by: chao an <anchao@xiaomi.com>