Lines Matching refs:self
29 MYSQLND_METHOD(mysqlnd_debug, open)(MYSQLND_DEBUG * self, bool reopen) in MYSQLND_METHOD()
31 if (!self->file_name) { in MYSQLND_METHOD()
35 self->stream = php_stream_open_wrapper(self->file_name, in MYSQLND_METHOD()
36 reopen == TRUE || self->flags & MYSQLND_DEBUG_APPEND? "ab":"wb", in MYSQLND_METHOD()
38 return self->stream? PASS:FAIL; in MYSQLND_METHOD()
45 MYSQLND_METHOD(mysqlnd_debug, log)(MYSQLND_DEBUG * self, in MYSQLND_METHOD()
54 unsigned int flags = self->flags; in MYSQLND_METHOD()
58 if (!self->stream && FAIL == self->m->open(self, FALSE)) { in MYSQLND_METHOD()
63 level = zend_stack_count(&self->call_stack); in MYSQLND_METHOD()
74 snprintf(pid_buffer, sizeof(pid_buffer) - 1, "%5u: ", self->pid); in MYSQLND_METHOD()
117 ret = php_stream_write(self->stream, message_line, message_line_len)? PASS:FAIL; in MYSQLND_METHOD()
120 self->m->close(self); in MYSQLND_METHOD()
121 self->m->open(self, TRUE); in MYSQLND_METHOD()
130 MYSQLND_METHOD(mysqlnd_debug, log_va)(MYSQLND_DEBUG *self, in MYSQLND_METHOD()
141 unsigned int flags = self->flags; in MYSQLND_METHOD()
145 if (!self->stream && FAIL == self->m->open(self, FALSE)) { in MYSQLND_METHOD()
150 level = zend_stack_count(&self->call_stack); in MYSQLND_METHOD()
161 snprintf(pid_buffer, sizeof(pid_buffer) - 1, "%5u: ", self->pid); in MYSQLND_METHOD()
208 ret = php_stream_write(self->stream, message_line, message_line_len)? PASS:FAIL; in MYSQLND_METHOD()
212 self->m->close(self); in MYSQLND_METHOD()
213 self->m->open(self, TRUE); in MYSQLND_METHOD()
223 MYSQLND_METHOD(mysqlnd_debug, func_enter)(MYSQLND_DEBUG * self, in MYSQLND_METHOD()
227 if ((self->flags & MYSQLND_DEBUG_DUMP_TRACE) == 0 || self->file_name == NULL) { in MYSQLND_METHOD()
230 if ((uint32_t) zend_stack_count(&self->call_stack) >= self->nest_level_limit) { in MYSQLND_METHOD()
234 if ((self->flags & MYSQLND_DEBUG_TRACE_MEMORY_CALLS) == 0 && self->skip_functions) { in MYSQLND_METHOD()
235 const char ** p = self->skip_functions; in MYSQLND_METHOD()
238 zend_stack_push(&self->call_stack, &mysqlnd_debug_empty_string); in MYSQLND_METHOD()
240 if (self->flags & MYSQLND_DEBUG_PROFILE_CALLS) { in MYSQLND_METHOD()
242 zend_stack_push(&self->call_time_stack, &some_time); in MYSQLND_METHOD()
251 zend_stack_push(&self->call_stack, &func_name); in MYSQLND_METHOD()
253 if (self->flags & MYSQLND_DEBUG_PROFILE_CALLS) { in MYSQLND_METHOD()
255 zend_stack_push(&self->call_time_stack, &some_time); in MYSQLND_METHOD()
259 if (zend_hash_num_elements(&self->not_filtered_functions) && in MYSQLND_METHOD()
260 0 == zend_hash_str_exists(&self->not_filtered_functions, func_name, strlen(func_name))) in MYSQLND_METHOD()
265 self->m->log_va(self, line, file, zend_stack_count(&self->call_stack) - 1, NULL, ">%s", func_name); in MYSQLND_METHOD()
291 MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int line, const char * con… in MYSQLND_METHOD()
296 bool profile_calls = self->flags & MYSQLND_DEBUG_PROFILE_CALLS? TRUE:FALSE; in MYSQLND_METHOD()
298 if ((self->flags & MYSQLND_DEBUG_DUMP_TRACE) == 0 || self->file_name == NULL) { in MYSQLND_METHOD()
301 if ((uint32_t) zend_stack_count(&self->call_stack) >= self->nest_level_limit) { in MYSQLND_METHOD()
305 func_name = zend_stack_top(&self->call_stack); in MYSQLND_METHOD()
309 mine_non_own_time_ptr = zend_stack_top(&self->call_time_stack); in MYSQLND_METHOD()
311 zend_stack_del_top(&self->call_time_stack); /* callee - removing ourselves */ in MYSQLND_METHOD()
317 } else if (!zend_hash_num_elements(&self->not_filtered_functions) || in MYSQLND_METHOD()
318 1 == zend_hash_str_exists(&self->not_filtered_functions, (*func_name), strlen((*func_name)))) in MYSQLND_METHOD()
323 …self->m->log_va(self, line, file, zend_stack_count(&self->call_stack) - 1, NULL, "<%s", *func_name… in MYSQLND_METHOD()
332 …self->m->log_va(self, line, file, zend_stack_count(&self->call_stack) - 1, NULL, "<%s (total=%u ow… in MYSQLND_METHOD()
336 …if ((f_profile = zend_hash_str_find_ptr(&self->function_profiles, *func_name, func_name_len)) != N… in MYSQLND_METHOD()
380 …zend_hash_str_add_mem(&self->function_profiles, *func_name, func_name_len, f_profile, sizeof(struc… in MYSQLND_METHOD()
382 if ((uint32_t) zend_stack_count(&self->call_time_stack)) { in MYSQLND_METHOD()
385 parent_non_own_time_ptr = zend_stack_top(&self->call_time_stack); in MYSQLND_METHOD()
388 zend_stack_del_top(&self->call_time_stack); /* the caller */ in MYSQLND_METHOD()
389 zend_stack_push(&self->call_time_stack, &parent_non_own_time); /* add back the caller */ in MYSQLND_METHOD()
395 zend_stack_del_top(&self->call_stack); in MYSQLND_METHOD()
403 MYSQLND_METHOD(mysqlnd_debug, close)(MYSQLND_DEBUG * self) in MYSQLND_METHOD()
405 if (self->stream) { in MYSQLND_METHOD()
407 if (!(self->flags & MYSQLND_DEBUG_FLUSH) && (self->flags & MYSQLND_DEBUG_PROFILE_CALLS)) { in MYSQLND_METHOD()
411 self->m->log_va(self, __LINE__, __FILE__, 0, "info : ", in MYSQLND_METHOD()
412 "number of functions: %d", zend_hash_num_elements(&self->function_profiles)); in MYSQLND_METHOD()
413 ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&self->function_profiles, string_key, f_profile) { in MYSQLND_METHOD()
414 self->m->log_va(self, __LINE__, __FILE__, -1, "info : ", in MYSQLND_METHOD()
448 php_stream_close(self->stream); in MYSQLND_METHOD()
449 self->stream = NULL; in MYSQLND_METHOD()
459 MYSQLND_METHOD(mysqlnd_debug, free)(MYSQLND_DEBUG * self) in MYSQLND_METHOD()
461 if (self->file_name && self->file_name != mysqlnd_debug_default_trace_file) { in MYSQLND_METHOD()
462 efree(self->file_name); in MYSQLND_METHOD()
463 self->file_name = NULL; in MYSQLND_METHOD()
465 zend_stack_destroy(&self->call_stack); in MYSQLND_METHOD()
466 zend_stack_destroy(&self->call_time_stack); in MYSQLND_METHOD()
467 zend_hash_destroy(&self->not_filtered_functions); in MYSQLND_METHOD()
468 zend_hash_destroy(&self->function_profiles); in MYSQLND_METHOD()
469 free(self); in MYSQLND_METHOD()
484 MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const mode) in MYSQLND_METHOD()
491 self->flags = 0; in MYSQLND_METHOD()
492 self->nest_level_limit = 0; in MYSQLND_METHOD()
493 if (self->file_name && self->file_name != mysqlnd_debug_default_trace_file) { in MYSQLND_METHOD()
494 efree(self->file_name); in MYSQLND_METHOD()
495 self->file_name = NULL; in MYSQLND_METHOD()
497 if (zend_hash_num_elements(&self->not_filtered_functions)) { in MYSQLND_METHOD()
498 zend_hash_destroy(&self->not_filtered_functions); in MYSQLND_METHOD()
499 zend_hash_init(&self->not_filtered_functions, 0, NULL, NULL, 0); in MYSQLND_METHOD()
506 self->flags |= MYSQLND_DEBUG_FLUSH; in MYSQLND_METHOD()
511 self->flags |= MYSQLND_DEBUG_APPEND; in MYSQLND_METHOD()
527 self->file_name = estrndup(mode + i + 2, j - i - 2); in MYSQLND_METHOD()
531 if (!self->file_name) in MYSQLND_METHOD()
532 self->file_name = (char *) mysqlnd_debug_default_trace_file; in MYSQLND_METHOD()
561 zend_hash_str_add_empty_element(&self->not_filtered_functions, in MYSQLND_METHOD()
595 self->flags |= MYSQLND_DEBUG_DUMP_FILE; in MYSQLND_METHOD()
599 self->flags |= MYSQLND_DEBUG_DUMP_PID; in MYSQLND_METHOD()
603 self->flags |= MYSQLND_DEBUG_DUMP_LINE; in MYSQLND_METHOD()
607 self->flags |= MYSQLND_DEBUG_DUMP_LEVEL; in MYSQLND_METHOD()
621 self->nest_level_limit = atoi(value_str); in MYSQLND_METHOD()
626 self->nest_level_limit = 200; /* default value for FF DBUG */ in MYSQLND_METHOD()
628 self->flags |= MYSQLND_DEBUG_DUMP_TRACE; in MYSQLND_METHOD()
632 self->flags |= MYSQLND_DEBUG_DUMP_TIME; in MYSQLND_METHOD()
642 self->flags |= MYSQLND_DEBUG_TRACE_MEMORY_CALLS; in MYSQLND_METHOD()
646 self->flags |= MYSQLND_DEBUG_PROFILE_CALLS; in MYSQLND_METHOD()