refactor and add 2 function

1. add alarm function
2. add performance statistic function