comparison src/misc/ngx_google_perftools_module.c @ 635:e67b227c8dbb default tip

Merge with current.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 25 Apr 2011 04:07:55 +0400
parents be4f34123024
children
comparison
equal deleted inserted replaced
578:f3a9e57d2e17 635:e67b227c8dbb
6 6
7 #include <ngx_config.h> 7 #include <ngx_config.h>
8 #include <ngx_core.h> 8 #include <ngx_core.h>
9 9
10 /* 10 /*
11 * declare Profiler here interface because 11 * declare Profiler interface here because
12 * <google/profiler.h> is C++ header file 12 * <google/profiler.h> is C++ header file
13 */ 13 */
14 14
15 int ProfilerStart(u_char* fname); 15 int ProfilerStart(u_char* fname);
16 void ProfilerStop(void); 16 void ProfilerStop(void);
71 if (gptcf == NULL) { 71 if (gptcf == NULL) {
72 return NULL; 72 return NULL;
73 } 73 }
74 74
75 /* 75 /*
76 * set by pcalloc() 76 * set by ngx_pcalloc()
77 * 77 *
78 * gptcf->profiles = { 0, NULL }; 78 * gptcf->profiles = { 0, NULL };
79 */ 79 */
80 80
81 return gptcf; 81 return gptcf;
99 if (profile == NULL) { 99 if (profile == NULL) {
100 return NGX_OK; 100 return NGX_OK;
101 } 101 }
102 102
103 if (getenv("CPUPROFILE")) { 103 if (getenv("CPUPROFILE")) {
104
105 /* disable inherited Profiler enabled in master process */ 104 /* disable inherited Profiler enabled in master process */
106 ProfilerStop(); 105 ProfilerStop();
107 } 106 }
108 107
109 ngx_sprintf(profile, "%V.%d%Z", &gptcf->profiles, ngx_pid); 108 ngx_sprintf(profile, "%V.%d%Z", &gptcf->profiles, ngx_pid);
110 109
111 if (ProfilerStart(profile)) { 110 if (ProfilerStart(profile)) {
112
113 /* start ITIMER_PROF timer */ 111 /* start ITIMER_PROF timer */
114 ProfilerRegisterThread(); 112 ProfilerRegisterThread();
115 113
116 } else { 114 } else {
117 ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_errno, 115 ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_errno,