Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
42 lines (31 sloc)
1.03 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef __PROFILER_H__ | |
| #define __PROFILER_H__ | |
| #include <sys/time.h> | |
| #ifdef PROFILE | |
| typedef struct { | |
| long time_S9xDoHBlankProcessing; | |
| long time_S9xMainLoop; | |
| } profile_t; | |
| extern profile_t profile_data; | |
| #define START_PROFILE_FUNC(name) \ | |
| static timeval __func_time_start; \ | |
| static timeval __func_time_finish; \ | |
| \ | |
| gettimeofday (& __func_time_start, 0); | |
| #define FINISH_PROFILE_FUNC(name) \ | |
| gettimeofday (& __func_time_finish, 0); \ | |
| \ | |
| profile_data.time_##name += ( \ | |
| (((__func_time_finish.tv_sec - \ | |
| __func_time_start.tv_sec) * 1000000) + \ | |
| (__func_time_finish.tv_usec) - \ | |
| __func_time_start.tv_usec) \ | |
| ); | |
| #define RESET_PROFILE_FUNC(name) \ | |
| profile_data.time_##name = 0; | |
| #else | |
| #define START_PROFILE_FUNC(name) ; | |
| #define FINISH_PROFILE_FUNC(name) ; | |
| #define RESET_PROFILE_FUNC(name) ; | |
| #endif /* PROFILE_GFX */ | |
| #endif /* __PROFILER_H__ */ |