comparison src/event/ngx_event.c @ 426:3f88935a02e8

nginx-0.0.10-2004-09-14-23:39:54 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 14 Sep 2004 19:39:54 +0000
parents 5ce6561246a5
children 5cdc4838d4e8
comparison
equal deleted inserted replaced
425:bd39260a1383 426:3f88935a02e8
60 ngx_atomic_t *ngx_accept_mutex_ptr; 60 ngx_atomic_t *ngx_accept_mutex_ptr;
61 ngx_atomic_t *ngx_accept_mutex; 61 ngx_atomic_t *ngx_accept_mutex;
62 ngx_uint_t ngx_accept_mutex_held; 62 ngx_uint_t ngx_accept_mutex_held;
63 ngx_msec_t ngx_accept_mutex_delay; 63 ngx_msec_t ngx_accept_mutex_delay;
64 ngx_int_t ngx_accept_disabled; 64 ngx_int_t ngx_accept_disabled;
65
66
67 #if (NGX_STAT_STUB)
68
69 ngx_atomic_t ngx_stat_accepted0;
70 ngx_atomic_t *ngx_stat_accepted = &ngx_stat_accepted0;
71 ngx_atomic_t ngx_stat_requests0;
72 ngx_atomic_t *ngx_stat_requests = &ngx_stat_requests0;
73 ngx_atomic_t ngx_stat_active0;
74 ngx_atomic_t *ngx_stat_active = &ngx_stat_active0;
75 ngx_atomic_t ngx_stat_reading0;
76 ngx_atomic_t *ngx_stat_reading = &ngx_stat_reading0;
77 ngx_atomic_t ngx_stat_writing0;
78 ngx_atomic_t *ngx_stat_writing = &ngx_stat_reading0;
79
80 #endif
65 81
66 82
67 83
68 static ngx_command_t ngx_events_commands[] = { 84 static ngx_command_t ngx_events_commands[] = {
69 85
185 /* TODO: 128 is cache line size */ 201 /* TODO: 128 is cache line size */
186 202
187 size = 128 /* ngx_accept_mutex */ 203 size = 128 /* ngx_accept_mutex */
188 + 128; /* ngx_connection_counter */ 204 + 128; /* ngx_connection_counter */
189 205
206 #if (NGX_STAT_STUB)
207
208 size += 128 /* ngx_stat_accepted */
209 + 128 /* ngx_stat_requests */
210 + 128 /* ngx_stat_active */
211 + 128 /* ngx_stat_reading */
212 + 128; /* ngx_stat_writing */
213
214 #endif
215
190 if (!(shared = ngx_create_shared_memory(size, cycle->log))) { 216 if (!(shared = ngx_create_shared_memory(size, cycle->log))) {
191 return NGX_ERROR; 217 return NGX_ERROR;
192 } 218 }
193 219
194 ngx_accept_mutex_ptr = (ngx_atomic_t *) shared; 220 ngx_accept_mutex_ptr = (ngx_atomic_t *) shared;
195 ngx_connection_counter = (ngx_atomic_t *) (shared + 128); 221 ngx_connection_counter = (ngx_atomic_t *) (shared + 128);
222
223 #if (NGX_STAT_STUB)
224
225 ngx_stat_accepted = (ngx_atomic_t *) (shared + 2 * 128);
226 ngx_stat_requests = (ngx_atomic_t *) (shared + 3 * 128);
227 ngx_stat_active = (ngx_atomic_t *) (shared + 4 * 128);
228 ngx_stat_reading = (ngx_atomic_t *) (shared + 5 * 128);
229 ngx_stat_writing = (ngx_atomic_t *) (shared + 6 * 128);
230
231 #endif
196 232
197 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, 233 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
198 "counter: " PTR_FMT ", %d", 234 "counter: " PTR_FMT ", %d",
199 ngx_connection_counter, *ngx_connection_counter); 235 ngx_connection_counter, *ngx_connection_counter);
200 236