add perf counter into lib