aop之应用 时间记录器及日志
来源:互联网 发布:php curl rest son 编辑:程序博客网 时间:2024/06/05 17:53
struct TimeElapsedAspect{void Before(int i){m_lastTime = m_t.elapsed();}void After(int i){std::cout << "time elapsed: " << m_t.elapsed() - m_lastTime << "ms" <<std::endl;}private:double m_lastTime;Timer m_t;};struct LoggingAspect{void Before(int i){std::cout << "entering" << std::endl;}void After(int i){std::cout << "leaving" << std::endl;}};void foo(int a){std::cout << "real HT function: " << a << std::endl;for (int i = 0; i < 10000; i+=a ){if (i % 1000 == 0)std::cout << i << std::endl;}}
Invoke<LoggingAspect, TimeElapsedAspect>(&foo, 1); //织入方法std::cout << "-----------------------" << std::endl;Invoke<TimeElapsedAspect, LoggingAspect>(&foo, 1);
Invoke的实现:http://blog.csdn.net/ozuoqi/article/details/50261353
TImer的实现:http://blog.csdn.net/ozuoqi/article/details/50261151
1 0
- aop之应用 时间记录器及日志
- 日志记录器
- AOP应用之------测试方法运行时间
- 创建型模式之工厂方法模式(日志记录器)
- golang环境下的日志记录器-系列之二
- golang环境下的日志记录器-系列之三
- Sysklogd 系统日志记录器
- Sysklogd 系统日志记录器
- Sysklogd 系统日志记录器
- Sysklogd系统日志记录器
- log4j(日志记录器)
- tomcat(7)日志记录器
- Log4j日志记录器
- 第七章 日志记录器
- Spring Aop 日志拦截应用
- spring-Aop应用日志处理
- ACE提供的日志记录器
- Sysklogd 系统日志记录器使用指南
- 补码小知识
- JAVA的线程
- Remove Linked List Elements
- JavaScript:['1','2','3'].map(parseInt)问题解析
- Lex与Yacc
- aop之应用 时间记录器及日志
- table中th高度设置无效
- 亲自安装快速行进法(fast marching)MATLAB工具箱遇到的问题及解决
- 腾讯云服务器Ubuntu入门:搭建环境
- Kafka producer程序本地运行时发送信息失败解决方案
- 基于JSPatch的iOS应用线上Bug的即时修复方案,附源码.
- 内存中的 double 与 十六进制
- 开发中常见坑
- 78,id 动态类型